# no cases now: we always use a rotation, translation and reflection.

#4D4D4D

$\text{NEW FIGURE}$

Reset app

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

#eeeeee

#2E006758

#2EB00020

\text{Drag to translate.}

\text{Drag to rotate.}

\text{Click to reflect}

If(¬reflected, {218 / 255, 37 / 255, 112 / 255}, {117 / 255, 117 / 255, 117 / 255})

If(currentTransformation ≟ cROTATE ∧ PRotate ≠ rotatePoints(-1) ∧ (¬correct), {218 / 255, 37 / 255, 112 / 255}, {117 / 255, 117 / 255, 117 / 255})

$\text{REVIEW}$

\text{Select the transformations in any order}

$\textsf{REFLECT}$

$\textsf{ROTATE}$

$\textsf{TRANSLATE}$

$\textsf{REFLECT}$

$\textsf{ROTATE}$

$\textsf{TRANSLATE}$

$\textbf{TRY AGAIN}$

randomNumVerts = Shuffle({3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5})
randomAngles = Shuffle(Sequence[A, A, pi / 6, pi - pi / 6, pi / 6])
randomAnchorX = Shuffle(Sequence[15, 22])
randomAnchorY = Shuffle({2, 4})
randomIndices = Shuffle(Sequence[1, 49])
randomReflectShifts = Shuffle(Sequence[-3, 3])
countQuestion = 1
numVertices = If(countQuestion ≟ 0, 3, Element[randomNumVerts, Mod[countQuestion, Length[randomNumVerts]] + 1])
rotationAngle = Element(randomAngles, Mod[countQuestion, Length[randomAngles]] + 1)
Anchor: (0, 0)
possiblePoints = Sequence(Rotate[(3, 0), K, Anchor], K, 0, (2 * pi), pi / 24)
maxIndex: floor(Length[possiblePoints] / numVertices) - 5
indices = Sequence(Mod[randomIndices(Mod[(countQuestion * 5) + i, Length[randomIndices]] + 1), maxIndex] + (i * (maxIndex + 5)), i, 0, numVertices - 1)
initialPoints = Sequence(possiblePoints(indices(A) + 5), A, 1, numVertices)
currentPoints: {(2.121320343559643, 2.1213203435596424), (-1.5000000000000007, 2.5980762113533156), (-2.974334584121431, 0.3915785766601573), (-1.148050297095276, -2.7716385975338573), (1.4999999999999911, -2.5980762113533213)}
Anchor2: (randomAnchorX(Mod[countQuestion, Length[randomAnchorX]] + 1), randomAnchorY(Mod[countQuestion, Length[randomAnchorY]] + 1))
vTrans = Vector(Anchor2 - Anchor)
CenterIntermediate = Translate(Mirror[Anchor, Line[initialPoints(1), initialPoints(2)]], vTrans)
currentTransformation = NaN
cTRANSLATE: 3
PulsePoint = If(currentTransformation ≟ cTRANSLATE, currentPoints(1), currentPoints(2))
moveBox = Polygon({(2, -11), (2, 8), (35, 8), (35, -11)})
staticPoints: {(2.598076211353316, 1.4999999999999998), (-2.121320343559647, -2.1213203435596384), (0.7764571353075532, -2.8977774788672073)}
caseNum: 1
intermediatePoints = Translate(Mirror[initialPoints, Line[initialPoints(1), initialPoints(2)]], vTrans)
finalPoints = Rotate(intermediatePoints, rotationAngle, intermediatePoints(1))
FIND: 1
TRANSFORM: 2
REVIEW: 3
mode: 2
nextPoints: {(2.121320343559643, 2.1213203435596424), (-1.5000000000000007, 2.5980762113533156), (-2.974334584121431, 0.3915785766601573), (-1.148050297095276, -2.7716385975338573), (1.4999999999999911, -2.5980762113533213)}
translatePath = Segment(currentPoints(1), nextPoints(1))
PTranslate = Point(translatePath)
reflected = false
reflectPoly = Polygon(If[reflected, nextPoints, currentPoints])
cROTATE: 1
showRotation: currentTransformation ≟ cROTATE ∧ mode ≟ TRANSFORM
cDILATE: 2
cREFLECT: 4
showReflection: currentTransformation ≟ cREFLECT ∧ mode ≟ TRANSFORM
reflectionComplete: showReflection ∧ Vertex[reflectPoly, 3] ≟ nextPoints(3)
rotatePoints = Sequence(Rotate[currentPoints(2), K, currentPoints(1)], K, 0, rotationAngle, pi / 24)
PRotate = Point(rotatePoints)
rotationComplete: showRotation ∧ PRotate ≟ rotatePoints(-1)
completedTransformations: {}
transformationInProgress = false
translationComplete: PTranslate ≟ nextPoints(1) ∧ currentTransformation ≟ cTRANSLATE
transformationComplete: (reflectionComplete ∨ rotationComplete ∨ translationComplete) ∧ (¬transformationInProgress)
currentStep = 0
availableTransformations: {cROTATE, cTRANSLATE, cREFLECT}
transformationDescription: {"Rotate", "Reflect", "Translate", ""}
cNONE: -1
allTransformations: {cROTATE, cREFLECT, cTRANSLATE, cNONE}
showTranslation: currentTransformation ≟ cTRANSLATE ∧ mode ≟ TRANSFORM
R1: currentPoints(1)
R2: currentPoints(2)
finalFigureOK = Polygon(finalPoints)
correct: transformationComplete ∧ Length[completedTransformations] ≟ 2
onboardingRotate = true
pixelsPRotate = PointToPixels(Corner[1], Corner[3], Corner[5], PRotate)
onboardingReflect = true
xShiftR2 = Element(randomReflectShifts, Mod[countQuestion + 1, Length[randomReflectShifts]] + 1)
xShiftR1 = Element(randomReflectShifts, Mod[countQuestion, Length[randomReflectShifts]] + 1)
initialFigure = Polygon(initialPoints)
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
layoutY: 178
layoutX: 16
layoutAppSize = Corner(5)
finalFigureOutline = Polygon(finalPoints)
setupMode = false
rotatePoly = Polygon(Zip[Rotate[A, Angle[currentPoints(2), currentPoints(1), PRotate], currentPoints(1)], A, currentPoints])
onboardingTranslate = true
pulsingSpeed: 8
pulsing = 0.1 (slider from 0 to 1, step 0.1)
onboardingX = 100 (slider from -5 to 200)
onboardingY = 200 (slider from -5 to 500)
tries: 0
OnboardingTextOffsets = Zip(onboardingTextOffset[Corner[A, 1], Corner[A, 3], B, Corner[1], Corner[3], Corner[5]], A, {onboardingTextTranslate, onboardingTextRotate}, B, {4, 3})
onboardingDisplayTextTranslate: "" + (LaTeX[onboardingTextTranslate]) + ""
onboardingDisplayTextRotate: "" + (LaTeX[onboardingTextRotate]) + ""
onboarding1Offset = onboardingTextOffset(Corner[onboardingTextTranslate, 1], Corner[onboardingTextTranslate, 3], 4, Corner[1], Corner[3], Corner[5])
onboarding2Offset = onboardingTextOffset(Corner[onboardingTextRotate, 1], Corner[onboardingTextRotate, 3], 4, Corner[1], Corner[3], Corner[5])
onboardingDisplayTextReflect: "" + (LaTeX[onboardingTextReflect]) + ""
onboarding3Offset = onboardingTextOffset(Corner[onboardingTextReflect, 1], Corner[onboardingTextReflect, 3], 4, Corner[1], Corner[3], Corner[5])
colorReflectLine: {218 / 255, 37 / 255, 112 / 255}
rotationArrow = Segment(rotatePoints(Length[rotatePoints] - 1), rotatePoints(-1))
colorRotatePath: {218 / 255, 37 / 255, 112 / 255}
colorTransFigure = If(currentTransformation ≟ cTRANSLATE, {101 / 255, 87 / 255, 210 / 255}, {148 / 255, 148 / 255, 148 / 255})
destinationFigureDotted = Polygon(nextPoints)
angleIndices = Element({Append[Append[numVertices, Sequence[A, A, 1, numVertices]], 1], Append[Append[1, Sequence[A, A, numVertices, 1, -1]], numVertices]}, caseNum)
index = 2 (slider from 1 to numVertices, step 1)
stepComplete: currentPoints ≟ nextPoints
rotationArc = CircleArc(currentPoints(1), rotatePoints(1), rotatePoints(-1))
finalFigure = Polygon(finalPoints)
CenterPoint = Element({TriangleCenter[finalPoints(1), finalPoints(2), finalPoints(3), 1], Midpoint[finalPoints(1), finalPoints(3)], Midpoint[finalPoints(1), finalPoints(3)]}, numVertices - 2)
speed: 0
availableCurrent = Remove(availableTransformations, completedTransformations)
translationIndex = 0
translateImage = Polygon(nextPoints)
currentTransID: availableCurrent(translationIndex)
currentTransLatex = Element(transformationDescription, IndexOf[availableCurrent(translationIndex), allTransformations])
stepsCompleted: {}
StepsCompleted: {{}}
translatePoly = Translate(Polygon[currentPoints], Vector[currentPoints(1), PTranslate])
layoutButtonX: 11
layoutButtonY: 100
PStart = (21.66947019878691, 4.9250258582326545)
ReflectLine = Segment(R1 - Vector[R1, R2], R2 + Vector[R1, R2])
onboarding: true
initialFigureOutline = Polygon(initialPoints)
yMultiplier: 1
PulsePointPx = PointToPixels(Corner[1], Corner[3], Corner[5], PulsePoint)
pulsingObject = circlePixels(PulsePoint, 7 + (7 * pulsing), Corner[1], Corner[3], Corner[5])
labelPoints = Sequence(Rotate[currentPoints(A) + UnitVector[currentPoints(Mod[A - 1, numVertices] + 1) - currentPoints(A)], (0.5 * Angle[currentPoints(Mod[A - 1, numVertices] + 1), currentPoints(A), currentPoints(Mod[A + 1, numVertices] + 1)]), currentPoints(A)], A, 1, numVertices)
lblABC = Zip(Text[("" * A), B, false, true, 0, 0], A, {"A", "B", "C", "D", "E"}, B, Sequence[initialPoints(K) + (1.5 * UnitVector[initialPoints(K) - Anchor]), K, 1, Length[initialPoints]])
pulsingSegment = expandSegment(R1 - Vector[R1, R2], R2 + Vector[R1, R2], (7 * pulsing), Corner[1], Corner[3], Corner[5])
firstTime = true
CenterFinal = Rotate(CenterIntermediate, rotationAngle, finalPoints(1))
lblFINAL = Zip(Text[("" * A), B, false, true, 0, 0], A, {"L", "M", "N", "O", "P"}, B, Sequence[finalPoints(K) + (1.5 * UnitVector[finalPoints(K) - CenterFinal]), K, 1, Length[finalPoints]])
figType = If(numVertices ≟ 3, "\triangle", "figure ")
figName1 = Element({"\(A\)\(B\)\(C\)", "\(A\)\(B\)\(C\)\(D\)", "\(A\)\(B\)\(C\)\(D\)\(E\)"}, numVertices - 2)
figName2 = Element({"\(L\)\(M\)\(N\)", "\(L\)\(M\)\(N\)\(O\)", "\(L\)\(M\)\(N\)\(O\)\(P\)"}, numVertices - 2)
textQuestion: "\textsf{Verify that " + (LaTeX[figType]) + "}" + (LaTeX[figName1]) + " \textsf{ is congruent to " + (LaTeX[figType]) + "}" + (LaTeX[figName2]) + "."

Tool: PixelsToPoint
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: PixelsToPoint (command PixelsToPoint1)
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: freePentagon
freePentagon(A,B,C,D,E)
Input: A, B, C, D, E
Output: myPentagon

myPentagon = Polygon({A, B, C, D, E})

Tool: freeQuad
freeQuad(A,B,D,C)
Input: A, B, C, D
Output: myQuad

myQuad = Polygon({A, B, C, D})

Tool: freeTriangle
freeTriangle(A,B,C)
Input: A, B, C
Output: myPoly

A: (2, 3)
B: (1, 4)
C: (2, 5)
myPoly = Polygon({A, B, C})

Tool: expandTriangle
expandTriangle(A,B,C,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, C, pixelGap, Corner1, Corner3, Corner5
Output: newPolygon

Corner5: (800, 500)
Corner3: (7, 6)
Corner1: (-4, -2)
distanceY: (pixelGap / y(Corner5) * (y(Corner3) - y(Corner1)))
distanceX: (pixelGap / x(Corner5) * (x(Corner3) - x(Corner1)))
pointGap: distanceX
allVerts: {A, B, C}
concaveAngles = Zip(Angle[I, J, K] > 180°, I, Append[allVerts(-1), allVerts], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
allVecs = Zip(Vector[J, K], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
pVecs = Zip(Vector[UnitOrthogonalVector[A]], Vector[A], allVecs)
xyScale: (distanceY) / (distanceX)
circTemplate = CurveCartesian((pointGap * cos(t)), ((xyScale * pointGap) * sin(t)), t, 0, (2 * pi))
scaledVecs = Zip(Vector[(x(K), (xyScale * y(K)))], Vector[K], pVecs)
vPointsPre = Zip(A - (pointGap * B), A, allVerts, B, Append[scaledVecs(-1), scaledVecs])
vPointsPost = Zip(A - (pointGap * B), A, allVerts, Vector[B], scaledVecs)
endAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPost, M, allVerts)
startAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPre, J, vPointsPost, M, allVerts)
roundedCornersConvex = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, endAngles, C, startAngles)
roundedCornersConcave = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, startAngles, C, endAngles)
cornerAngles = Zip(Angle[A, B, C], A, vPointsPre, B, allVerts, C, vPointsPost)
cornerPoints = Flatten(Zip[If[¬Concave, {Element[D, 3]}, If[A < pi / 3 ∨ (¬Concave), {Element[C, 3]}, C]], A, cornerAngles, C, roundedCornersConcave, D, roundedCornersConvex, Concave, concaveAngles])
newPolygon = Polygon(cornerPoints)

Tool: circlePixels
circlePixels(A,pixelRadius,Corner1,Corner3,Corner5
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newCircle

pointRadius: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
newCircle = Circle(A, pointRadius)

Tool: onboardingTextOffset
onboardingTextOffset(textCorner1,textCorner3,case,corner1,corner3,corner5)
Input: CornerText1, CornerText3, case, Corner1, Corner3, Corner5
Output: TextOffset

xPixels: ((x(CornerText3) - x(CornerText1)) * x(Corner5) / (x(Corner3) - x(Corner1)))
yPixels: ((y(CornerText3) - y(CornerText1)) * y(Corner5) / (y(Corner3) - y(Corner1)))
xOffset = Element({27, (-xPixels) + 2, 16 - xPixels / 2, 16 - xPixels / 2}, case)
yOffset = Element({-23, -23, yPixels - 27, -49}, case)
TextOffset: (xOffset, yOffset)

Tool: PointToPixels
PointToPixels(Corner1,Corner3,Corner5,InputPoint)
Input: Corner1, Corner3, Corner5, InputPoint
Output: OutputPixels

Corner1: (-5, -5)
Corner3: (16, 6)
Corner5: (300, 200)
xLeft: x(Corner1)
xRight: x(Corner3)
yTop: y(Corner3)
yBottom: y(Corner1)
yPixels: (y(Corner5) * (yTop - y(InputPoint)) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)

Tool: expandSegment
expandSegment(A,B,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, pixelGap, Corner1, Corner3, Corner5
Output: newPoly

distanceX: (pixelGap / x(Corner5) * (x(Corner3) - x(Corner1)))
distanceY: (pixelGap / y(Corner5) * (y(Corner3) - y(Corner1)))
pointGap: distanceX
xyScale: distanceY / distanceX
A: (0, 0)
vecAB: B - A
pVec: (20 * UnitVector[(((-y(vecAB))) / xyScale, (x(vecAB) * xyScale))])
pVecAngle = Angle(xAxis, Line[(0, 0), pVec])
realAngle = If(pVecAngle ≟ pi / 2 ∨ pVecAngle ≟ (3 * pi / 2), pVecAngle, atand(tan(pVecAngle) / xyScale))
curveFunction = CurveCartesian((pointGap * cos(u)), ((pointGap * xyScale) * sin(u)), u, 0, (2 * pi))
K: curveFunction(realAngle)
vSpace = Vector(K)
allPoints: {A + vSpace, A - vSpace, B - vSpace, B + vSpace}
newPoly = Polygon(allPoints)