#4D4D4D

$\text{NEW PATTERN}$

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{SUBMIT}$

\text{Select the shapes to add color to create a tessellating pattern.}

\text{Slide to add patterns}

\text{Click to select}

$\text{SUBMIT}$

randomList2 = Shuffle(Sequence[15])
randomList1 = Shuffle(Sequence[20])
numAddFigures = 1 (slider from 1 to 5, step 1)
listColor: {0, 0, 0, 0, 0, 0, 0, 0}
numSlope = Sum(listColor)
countQuestion = 0
randomNum2 = Element(randomList2, Mod[countQuestion, 15] + 1)
randomNum1 = Element(randomList1, Mod[countQuestion, 20] + 1)
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
borderBox = Polygon(Zip[PixelsToPoint[Corner[1], Corner[3], Corner[5], A], A, {(pixelsLeft, pixelsTop), (pixelsLeft, y(Corner[5]) - pixelsBottom), Corner[5] - (pixelsRight, pixelsBottom), (x(Corner[5]) - pixelsRight, pixelsTop)}])
Dims = Corner(5)
numColorChanger = 7
StartTemplate = (-1.160303001707857, 4.22408707501296)
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 = orderColorTess(StartTemplate)
listTris: {t1, t2, t3, t4, t5, t6, t7, t8}
showSubmit: 1 ∈ listColor
StartPoints = Sequence(StartTemplate + ((2.5 * n), 0), n, 0, 4)
boolSubmit = false
tb9, tb10, tb11, tb12, tb13, tb14, tb15, tb16, tb5, tb6, tb7, tb8, tb1, tb2, tb3, tb4 = orderColorTess(StartPoints(2))
tc9, tc10, tc11, tc12, tc13, tc14, tc15, tc16, tc5, tc6, tc7, tc8, tc1, tc2, tc3, tc4 = orderColorTess(StartPoints(3))
te9, te10, te11, te12, te13, te14, te15, te16, te5, te6, te7, te8, te1, te2, te3, te4 = orderColorTess(StartPoints(4))
tf9, tf10, tf11, tf12, tf13, tf14, tf15, tf16, tf5, tf6, tf7, tf8, tf1, tf2, tf3, tf4 = orderColorTess(StartPoints(5))
yVals = Sequence((numSlope * n), n, 1, numAddFigures)
StartPointsLower = Flatten(Sequence[Zip[k - (0, (2 * n)), k, Take[StartPoints, n + 1]], n, 1, 5])
tp1, tp2, tp3, tp4, tp5, tp6, tp7, tp8, tp13, tp14, tp15, tp16, tp9, tp10, tp11, tp12 = orderColorTess(StartPointsLower(1))
tg9, tg10, tg11, tg12, tg13, tg14, tg15, tg16, tg5, tg6, tg7, tg8, tg1, tg2, tg3, tg4 = orderColorTess(StartPointsLower(2))
th9, th10, th11, th12, th13, th14, th15, th16, th5, th6, th7, th8, th1, th2, th3, th4 = orderColorTess(StartPointsLower(3))
ti9, ti10, ti11, ti12, ti13, ti14, ti15, ti16, ti5, ti6, ti7, ti8, ti1, ti2, ti3, ti4 = orderColorTess(StartPointsLower(4))
tj9, tj10, tj11, tj12, tj13, tj14, tj15, tj16, tj5, tj6, tj7, tj8, tj1, tj2, tj3, tj4 = orderColorTess(StartPointsLower(5))
tk9, tk10, tk11, tk12, tk13, tk14, tk15, tk16, tk5, tk6, tk7, tk8, tk1, tk2, tk3, tk4 = orderColorTess(StartPointsLower(6))
tl9, tl10, tl11, tl12, tl13, tl14, tl15, tl16, tl5, tl6, tl7, tl8, tl1, tl2, tl3, tl4 = orderColorTess(StartPointsLower(7))
tm9, tm10, tm11, tm12, tm13, tm14, tm15, tm16, tm5, tm6, tm7, tm8, tm1, tm2, tm3, tm4 = orderColorTess(StartPointsLower(8))
tn9, tn10, tn11, tn12, tn13, tn14, tn15, tn16, tn5, tn6, tn7, tn8, tn1, tn2, tn3, tn4 = orderColorTess(StartPointsLower(9))
to9, to10, to11, to12, to13, to14, to15, to16, to5, to6, to7, to8, to1, to2, to3, to4 = orderColorTess(StartPointsLower(10))
xMin = -7.50141
xMax = 5.54231
yMin = -0.85957
yMax = 7.29276
textLeftSide = TableText({"\vphantom{|}\textsf{Figure}", "\vphantom{|}\textsf{number}", "\vphantom{|}\left(\mathbf\it{n}\right)"}, "cv")
textRightSide = TableText({"\vphantom{|}\textsf{Purple}", "\vphantom{|}\textsf{\textcolor{#6557D2}{▲}s}", "\vphantom{|}\left(\mathbf\it{\textbf{t }}\right)"}, "cv")
xVals = Sequence(n, n, 1, numAddFigures)
textEquation: "t=\textcolor{" + (LaTeX[colorPurpleDark]) + "}\textbf{{" + (LaTeX[numSlope]) + "}}n"
textTable = TableText(Flatten[{textLeftSide, Zip[Text[n + "\vphantom{\frac{a}{b}}", (0, 0), true, true, 0, 0], n, xVals]}], Flatten[{textRightSide, Zip[Text[n], n, yVals]}], "cv|_")
OnboardingCorners = Sequence(Vertex[t3, n], n, 3, 1, -1)
onboarding = true
pulsingSpeed: 8
pulsing = 0.2 (slider from 0 to 1, step 0.1)
OnboardingPoint = PointToPixels((xMin, yMin), (xMax, yMax), (800, 500), OnboardingCorners(1))
onboardingX: x(OnboardingPoint) + 16
onboardingY: y(OnboardingPoint) + 12
onboardingCase: 1
pulsingObject = expandTriangle(OnboardingCorners(1), OnboardingCorners(2), OnboardingCorners(3), (1 * pulsing), Corner[1], Corner[3], Corner[5])
textFig = Sequence(Text["Fig. " + (n), (x(StartPoints(n)) - 0.8, 6.5), true, true], n, 1, numAddFigures)
btnSubmitInactive: btnSubmit
textArrows = Sequence(Text["\scalebox{3}{⤸}\color{" + colorPurpleDark + "}{\scalebox{2.5}{^{\scalebox{0.6}{\plus" + numSlope + "}}}}", (20.85, 2.7) - (0, (1.6 * n)), true, true], n, 0, numAddFigures - 2)
onboardingDisplayText = Text("\text{Click to select}", PixelsToPoint[(xMin, yMin), (xMax, yMax), (800, 500), (onboardingX + 30, onboardingY - 30)], true, true, 1, -1)

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: tessellationPattern
Input: A
Output: t1, t2, t3, t3', triTemplate, triTemplate', triTemplate'_{1}, triTemplate'_{2}

B: (x(A), y(A) + 1)
triTemplate, f, g, h, C = Polygon(A, B, 3)
triTemplate' = Mirror(triTemplate, f)
triTemplate'_{1} = Mirror(triTemplate, h)
triTemplate'_{2} = Mirror(triTemplate, A)
t1 = Mirror(triTemplate'_{2}, f)
t2 = Mirror(triTemplate'_{1}, A)
t3 = Translate(triTemplate'_{1}, (0, -1))
t3' = Mirror(t3, f)

Tool: colorTess
Input: A
Output: t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t3', triTemplate, triTemplate', triTemplate'_{1}, triTemplate'_{2}

B: (x(A), y(A) + 1)
triTemplate, f, g, h, C = Polygon(A, B, 3)
triTemplate' = Mirror(triTemplate, f)
triTemplate'_{1} = Mirror(triTemplate, h)
triTemplate'_{2} = Mirror(triTemplate, A)
t1 = Mirror(triTemplate'_{2}, f)
t2 = Mirror(triTemplate'_{1}, A)
t3 = Translate(triTemplate'_{1}, (0, -1))
t3' = Mirror(t3, f)
t4, t5, t6, t7, t8, t9, t10, t11 = tessellationPattern(A)

Tool: orderColorTess
Input: A
Output: t11, t10, t9, t8, t7, t6, t5, t4, t12, t3, t2, t1, t16, t15, t14, t13

t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 = colorTess(A)

Tool: listTess
listTess[ <Point> ]
Input: A
Output: l1, l2, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16

t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 = orderColorTess(A)
l1: {t1, t2, t3, t4, t5, t6, t7, t8}
l2 = Sequence(0, n, 1, Length[l1])

Tool: listTess1
listTess1[ <Point> ]
Input: A
Output: t16, t15, t14, t13, t12, t11, t10, t9, t8, t7, t6, t5, t4, t3, t2, t1, l1

t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16 = orderColorTess(A)
l1: {t1, t2, t3, t4, t5, t6, t7, t8}

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: 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: 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)