diff options
author | David Runge <dave@sleepmap.de> | 2016-01-04 21:42:51 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-01-04 21:42:51 +0100 |
commit | 24b14716a3ddadc15bfc4f2675990cceedf50e03 (patch) | |
tree | 15768487bddb88f36205e63e8dcbce62d7f6405d | |
parent | 36905d62db8c3f66edb4347109c02f16f4222835 (diff) | |
download | processing-sketchbook-24b14716a3ddadc15bfc4f2675990cceedf50e03.tar.gz processing-sketchbook-24b14716a3ddadc15bfc4f2675990cceedf50e03.tar.bz2 processing-sketchbook-24b14716a3ddadc15bfc4f2675990cceedf50e03.tar.xz processing-sketchbook-24b14716a3ddadc15bfc4f2675990cceedf50e03.zip |
AutoVisual/IGPTheGreatMosqueOfKairouan.pde: Adding class for The Great Mosque of Kairouan. A Square based class.
-rw-r--r-- | AutoVisual/IGPTheGreatMosqueOfKairouan.pde | 406 |
1 files changed, 406 insertions, 0 deletions
diff --git a/AutoVisual/IGPTheGreatMosqueOfKairouan.pde b/AutoVisual/IGPTheGreatMosqueOfKairouan.pde new file mode 100644 index 0000000..3dc58cf --- /dev/null +++ b/AutoVisual/IGPTheGreatMosqueOfKairouan.pde @@ -0,0 +1,406 @@ +class IGPTheGreatMosqueOfKairouan extends IGPSquare{ + + PVector[][] cornerPieces; + PVector[][] sidePieces; + PVector[][] middlePieces; + PVector[][] starPieces; + ArrayList <PVector> middleStar; + + IGPTheGreatMosqueOfKairouan(float x, float y, float d){ + super(x, y, d, 0); + setVectorsOnOuterSquare(); + setCornerPieces(); + setSidePieces(); + setMiddlePieces(); + setStarPieces(); + setMiddleStar(); + } + + void setVectorsOnOuterSquare(){ + vectorsOnOuterSquare = new ArrayList <PVector>(24); + vectorsOnOuterSquare.add(alphaCircleVectors.get(0)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(0)), getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(90)), mid.x+radius, false)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(45), mid.x+radius, false)); + vectorsOnOuterSquare.add(new PVector(mid.x+radius, mid.y+radius)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(45), mid.y+radius, true)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(0)), getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(0)), mid.y+radius, true)); + vectorsOnOuterSquare.add(new PVector(mid.x, mid.y+radius)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(90)), getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(270)), mid.y+radius, true)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(135), mid.y+radius, true)); + vectorsOnOuterSquare.add(new PVector(mid.x-radius, mid.y+radius)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), mid.x-radius, false)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(180)), getLineIntersection(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(45)), mid.x-radius, false)); + vectorsOnOuterSquare.add(new PVector(mid.x-radius, mid.y)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(225)), getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(45)), mid.x-radius, false)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(225), mid.x-radius, false)); + vectorsOnOuterSquare.add(new PVector(mid.x-radius, mid.y-radius)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(225), mid.y-radius, true)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(270)), getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(45)), mid.y-radius, true)); + vectorsOnOuterSquare.add(new PVector(mid.x, mid.y-radius)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(0)), getLineIntersection(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(45)), mid.y-radius, true)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), mid.y-radius, true)); + vectorsOnOuterSquare.add(new PVector(mid.x+radius, mid.y-radius)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(315), mid.x+radius, false)); + vectorsOnOuterSquare.add(getVectorOnExtendedLine(getLineIntersection(getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(0)), getLineIntersection(getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(270)), mid.x+radius, false)); + } + + void setMiddleStar(){ + middleStar = new ArrayList <PVector>(16); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5))); + middleStar.add(getLineIntersection(vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5))); + } + + void setCornerPieces(){ + cornerPieces = new PVector[4][4]; + PVector[] cornerPiece = new PVector[4]; + cornerPiece[0] = vectorsOnOuterSquare.get(2); + cornerPiece[1] = vectorsOnOuterSquare.get(3); + cornerPiece[2] = vectorsOnOuterSquare.get(4); + cornerPiece[3] = getVectorOnAlphaCircle(45); + cornerPieces[0] = cornerPiece; + cornerPiece = new PVector[4]; + cornerPiece[0] = vectorsOnOuterSquare.get(8); + cornerPiece[1] = vectorsOnOuterSquare.get(9); + cornerPiece[2] = vectorsOnOuterSquare.get(10); + cornerPiece[3] = getVectorOnAlphaCircle(135); + cornerPieces[1] = cornerPiece; + cornerPiece = new PVector[4]; + cornerPiece[0] = vectorsOnOuterSquare.get(14); + cornerPiece[1] = vectorsOnOuterSquare.get(15); + cornerPiece[2] = vectorsOnOuterSquare.get(16); + cornerPiece[3] = getVectorOnAlphaCircle(225); + cornerPieces[2] = cornerPiece; + cornerPiece = new PVector[4]; + cornerPiece[0] = vectorsOnOuterSquare.get(20); + cornerPiece[1] = vectorsOnOuterSquare.get(21); + cornerPiece[2] = vectorsOnOuterSquare.get(22); + cornerPiece[3] = getVectorOnAlphaCircle(315); + cornerPieces[3] = cornerPiece; + } + + void setSidePieces(){ + sidePieces = new PVector[8][6]; + PVector[] sidePiece = new PVector[6]; + sidePiece[0] = vectorsOnOuterSquare.get(0); + sidePiece[1] = vectorsOnOuterSquare.get(2); + sidePiece[2] = getVectorOnAlphaCircle(45); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(4)); + sidePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(6)); + sidePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(4)); + sidePieces[0] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = getVectorOnAlphaCircle(45); + sidePiece[1] = vectorsOnOuterSquare.get(4); + sidePiece[2] = vectorsOnOuterSquare.get(6); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + sidePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + sidePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + sidePieces[1] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = vectorsOnOuterSquare.get(6); + sidePiece[1] = vectorsOnOuterSquare.get(8); + sidePiece[2] = getVectorOnAlphaCircle(135); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(22)); + sidePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(22)); + sidePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + sidePieces[2] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = getVectorOnAlphaCircle(135); + sidePiece[1] = vectorsOnOuterSquare.get(10); + sidePiece[2] = vectorsOnOuterSquare.get(12); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1)); + sidePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20)); + sidePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(12)); + sidePieces[3] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = getVectorOnAlphaCircle(225); + sidePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + sidePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13)); + sidePiece[4] = vectorsOnOuterSquare.get(12); + sidePiece[5] = vectorsOnOuterSquare.get(14); + sidePieces[4] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = vectorsOnOuterSquare.get(18); + sidePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + sidePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16)); + sidePiece[4] = getVectorOnAlphaCircle(225); + sidePiece[5] = vectorsOnOuterSquare.get(16); + sidePieces[5] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = getVectorOnAlphaCircle(315); + sidePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10)); + sidePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10)); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + sidePiece[4] = vectorsOnOuterSquare.get(18); + sidePiece[5] = vectorsOnOuterSquare.get(20); + sidePieces[6] = sidePiece; + sidePiece = new PVector[6]; + sidePiece[0] = vectorsOnOuterSquare.get(22); + sidePiece[1] = vectorsOnOuterSquare.get(0); + sidePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13)); + sidePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13)); + sidePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + sidePiece[5] = getVectorOnAlphaCircle(315); + sidePieces[7] = sidePiece; + } + + void setMiddlePieces(){ + middlePieces = new PVector[8][6]; + PVector[] middlePiece = new PVector[6]; + middlePiece[0] = vectorsOnOuterSquare.get(0); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(4)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(6)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13)); + middlePieces[0] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = getVectorOnAlphaCircle(45); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16)); + middlePieces[1] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = vectorsOnOuterSquare.get(6); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + middlePieces[2] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = getVectorOnAlphaCircle(135); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(10)); + middlePieces[3] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = vectorsOnOuterSquare.get(12); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(12)); + middlePieces[4] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = getVectorOnAlphaCircle(225); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(16)); + middlePieces[5] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = getVectorOnAlphaCircle(270); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(18)); + middlePieces[6] = middlePiece; + middlePiece = new PVector[6]; + middlePiece[0] = getVectorOnAlphaCircle(315); + middlePiece[1] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + middlePiece[2] = getLineIntersection(vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + middlePiece[3] = getLineIntersection(vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + middlePiece[4] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + middlePiece[5] = getLineIntersection(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(22)); + middlePieces[7] = middlePiece; + } + + void setStarPieces(){ + starPieces = new PVector[8][4]; + PVector[] starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(6)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + starPieces[0] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11)); + starPieces[1] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(12)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4)); + starPieces[2] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(11), vectorsOnOuterSquare.get(1)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4)); + starPieces[3] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(4)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7)); + starPieces[4] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(17), vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + starPieces[5] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2)); + starPieces[6] = starPiece; + starPiece = new PVector[4]; + starPiece[0] = getLineIntersection(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + starPiece[1] = getLineIntersection(vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(22), vectorsOnOuterSquare.get(8)); + starPiece[2] = getLineIntersection(vectorsOnOuterSquare.get(16), vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + starPiece[3] = getLineIntersection(vectorsOnOuterSquare.get(23), vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(19), vectorsOnOuterSquare.get(5)); + starPieces[7] = starPiece; + } + + void createMiddleStar(){ + useStrokeColor(); + useFillColor(); + beginShape(); + for (PVector middleStarVector: middleStar) { + vertex(middleStarVector.x, middleStarVector.y); + } + endShape(); + } + + void createCornerPieces(){ + useStrokeColor(); + useFillColor(); + for(int i=0; i<cornerPieces.length; i++){ + if(cornerPieces[i].length>0){ + beginShape(); + for(int j=0; j<cornerPieces[i].length; j++){ + vertex(cornerPieces[i][j].x, cornerPieces[i][j].y); + } + endShape(); + } + } + } + + void createSidePieces(){ + useStrokeColor(); + useFillColor(); + for(int i=0; i<sidePieces.length; i++){ + if(sidePieces[i].length>0){ + beginShape(); + for(int j=0; j<sidePieces[i].length; j++){ + vertex(sidePieces[i][j].x, sidePieces[i][j].y); + } + endShape(); + } + } + } + + void createMiddlePieces(){ + useStrokeColor(); + useFillColor(); + for(int i=0; i<middlePieces.length; i++){ + if(middlePieces[i].length>0){ + beginShape(); + for(int j=0; j<middlePieces[i].length; j++){ + if (middlePieces[i][j] != null) { + vertex(middlePieces[i][j].x, middlePieces[i][j].y); + } + } + endShape(); + } + } + } + + void createStarPieces(){ + useStrokeColor(); + useFillColor(); + for(int i=0; i<starPieces.length; i++){ + if(starPieces[i].length>0){ + beginShape(); + for(int j=0; j<starPieces[i].length; j++){ + vertex(starPieces[i][j].x, starPieces[i][j].y); + } + endShape(); + } + } + } + + void createParallelLines(){ + createLine(vectorsOnOuterSquare.get(1), vectorsOnOuterSquare.get(11)); + createLine(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(16)); + createLine(vectorsOnOuterSquare.get(4), vectorsOnOuterSquare.get(14)); + createLine(vectorsOnOuterSquare.get(5), vectorsOnOuterSquare.get(19)); + createLine(vectorsOnOuterSquare.get(7), vectorsOnOuterSquare.get(17)); + createLine(vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(22)); + createLine(vectorsOnOuterSquare.get(10), vectorsOnOuterSquare.get(20)); + createLine(vectorsOnOuterSquare.get(13), vectorsOnOuterSquare.get(23)); + } + + void createOuterLines(){ + createLine(vectorsOnOuterSquare.get(0), vectorsOnOuterSquare.get(4)); + createLine(vectorsOnOuterSquare.get(2), vectorsOnOuterSquare.get(6)); + createLine(vectorsOnOuterSquare.get(6), vectorsOnOuterSquare.get(10)); + createLine(vectorsOnOuterSquare.get(8), vectorsOnOuterSquare.get(12)); + createLine(vectorsOnOuterSquare.get(12), vectorsOnOuterSquare.get(16)); + createLine(vectorsOnOuterSquare.get(14), vectorsOnOuterSquare.get(18)); + createLine(vectorsOnOuterSquare.get(18), vectorsOnOuterSquare.get(22)); + createLine(vectorsOnOuterSquare.get(20), vectorsOnOuterSquare.get(0)); + } + + void display(){ + setStrokeColor(new Float[] {0.66, 0.0, 0.0, 0.0}); + setFillColor(new Float[] {1.0, 1.0, 1.0, 1.0}); + createCornerPieces(); + setStrokeColor(new Float[] {0.66, 0.66, 0.8, 0.0}); + setFillColor(new Float[] {0.0, 1.0, 0.0, 1.0}); + createSidePieces(); + setStrokeColor(new Float[] {0.66, 0.0, 0.0, 0.0}); + setFillColor(new Float[] {0.5, 0.5, 1.0, 1.0}); + createMiddlePieces(); + setStrokeColor(new Float[] {0.0, 0.0, 0.0, 0.0}); + setFillColor(new Float[] {1.0, 0.0, 0.0, 1.0}); + createStarPieces(); + setStrokeColor(new Float[] {0.0, 0.0, 0.0, 0.0}); + setFillColor(new Float[] {0.0, 0.0, 1.0, 1.0}); + createMiddleStar(); + } + + void displayConstructionLines(){ + super.displayConstructionLines(); + setStrokeColor(new Float[] {0.4, 0.4, 0.8, 1.0}); + setFillColor(new Float[] {0.0, 0.0, 0.0, 0.0}); + createDiagonalConstructionLinesOnOuterSquare(); + createInnerSquare(); + createInnerSquareTilted(45); + createParallelLines(); + createOuterLines(); + setStrokeColor(new Float[] {0.8, 0.0, 0.0, 1.0}); + setFillColor(new Float[] {0.8, 0.8, 0.8, 1.0}); + createVectorIndicatorOnOuterSquare(4); + setStrokeColor(new Float[] {0.66, 0.0, 0.8, 1.0}); + setFillColor(new Float[] {0.8, 0.8, 0.8, 0.0}); + } +} |