summaryrefslogtreecommitdiffstats
path: root/AutoVisual
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-03-15 02:10:50 +0100
committerDavid Runge <dave@sleepmap.de>2016-03-15 02:10:50 +0100
commitd2028e2f143e4f8b6cb023e8fd7f65ba107af394 (patch)
treecd6c9b49b22b077f00106433751e6ff3d332c6db /AutoVisual
parentea1a1b34921f3a19c61e8f953e28b17eaa0cd4ec (diff)
downloadprocessing-sketchbook-d2028e2f143e4f8b6cb023e8fd7f65ba107af394.tar.gz
processing-sketchbook-d2028e2f143e4f8b6cb023e8fd7f65ba107af394.tar.bz2
processing-sketchbook-d2028e2f143e4f8b6cb023e8fd7f65ba107af394.tar.xz
processing-sketchbook-d2028e2f143e4f8b6cb023e8fd7f65ba107af394.zip
Autovisual/IGPEsrefogluMosque.pde: Adding Esrefoglu Mosque as another IGPHexagon based class.
Diffstat (limited to 'AutoVisual')
-rw-r--r--AutoVisual/IGPEsrefogluMosque.pde231
1 files changed, 231 insertions, 0 deletions
diff --git a/AutoVisual/IGPEsrefogluMosque.pde b/AutoVisual/IGPEsrefogluMosque.pde
new file mode 100644
index 0000000..20ee77e
--- /dev/null
+++ b/AutoVisual/IGPEsrefogluMosque.pde
@@ -0,0 +1,231 @@
+class IGPEsrefogluMosque extends IGPHexagon{
+
+ PVector[][] cornerPieces;
+ PVector[][] sidePieces;
+ PVector[] centerStar;
+ ArrayList <PVector> vectorsOnInterlockingTriangles;
+ IGPEsrefogluMosque(float x, float y, float d){
+ super(x, y, d);
+ setVectorsOnInterlockingTriangles();
+ setVectorsOnInnerHexagon();
+ setCornerPieces(6,6);
+ setSidePieces(6,3);
+ setCenterStar(12);
+ }
+
+ void setVectorsOnInnerHexagon(){
+ vectorsOnInnerHexagon = new ArrayList <PVector> (18);
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(4), vectorsOnInterlockingTriangles.get(0), baseVectorsOnInnerHexagon.get(0).x, false));
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(1));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(1), vectorsOnInterlockingTriangles.get(3), vectorsOnInterlockingTriangles.get(0).x, false));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(5), vectorsOnInterlockingTriangles.get(1), mid.y+(radius*5/6), true));
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(3));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(4), vectorsOnInterlockingTriangles.get(2), mid.y+(radius*5/6), true));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(0), vectorsOnInterlockingTriangles.get(2), vectorsOnInterlockingTriangles.get(3).x, false));
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(5));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(5), vectorsOnInterlockingTriangles.get(3), baseVectorsOnInnerHexagon.get(6).x, false));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(1), vectorsOnInterlockingTriangles.get(3), baseVectorsOnInnerHexagon.get(6).x, false));
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(7));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(0), vectorsOnInterlockingTriangles.get(4), vectorsOnInterlockingTriangles.get(3).x, false));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(2), vectorsOnInterlockingTriangles.get(4), mid.y-(radius*5/6), true));
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(9));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(1), vectorsOnInterlockingTriangles.get(5), mid.y-(radius*5/6), true));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(3), vectorsOnInterlockingTriangles.get(5), vectorsOnInterlockingTriangles.get(0).x, false));
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(11));
+ vectorsOnInnerHexagon.add(getVectorOnExtendedLine(vectorsOnInterlockingTriangles.get(0), vectorsOnInterlockingTriangles.get(2), baseVectorsOnInnerHexagon.get(0).x, false));
+ }
+
+ void setVectorsOnInterlockingTriangles(){
+ vectorsOnInterlockingTriangles = new ArrayList <PVector> (6);
+ vectorsOnInterlockingTriangles.add(getLineIntersection(baseVectorsOnInnerHexagon.get(1), baseVectorsOnInnerHexagon.get(9), baseVectorsOnInnerHexagon.get(11), baseVectorsOnInnerHexagon.get(3)));
+ vectorsOnInterlockingTriangles.add(getLineIntersection(baseVectorsOnInnerHexagon.get(1), baseVectorsOnInnerHexagon.get(5), baseVectorsOnInnerHexagon.get(11), baseVectorsOnInnerHexagon.get(3)));
+ vectorsOnInterlockingTriangles.add(getLineIntersection(baseVectorsOnInnerHexagon.get(1), baseVectorsOnInnerHexagon.get(5), baseVectorsOnInnerHexagon.get(3), baseVectorsOnInnerHexagon.get(7)));
+ vectorsOnInterlockingTriangles.add(getLineIntersection(baseVectorsOnInnerHexagon.get(0), baseVectorsOnInnerHexagon.get(6), baseVectorsOnInnerHexagon.get(3), baseVectorsOnInnerHexagon.get(7)));
+ vectorsOnInterlockingTriangles.add(getLineIntersection(baseVectorsOnInnerHexagon.get(2), baseVectorsOnInnerHexagon.get(8), baseVectorsOnInnerHexagon.get(11), baseVectorsOnInnerHexagon.get(7)));
+ vectorsOnInterlockingTriangles.add(getLineIntersection(baseVectorsOnInnerHexagon.get(1), baseVectorsOnInnerHexagon.get(9), baseVectorsOnInnerHexagon.get(11), baseVectorsOnInnerHexagon.get(7)));
+ }
+
+ void setCornerPieces(int amount, int numberOfVectors){
+ cornerPieces = new PVector[amount][numberOfVectors];
+ PVector[] cornerPiece = new PVector[numberOfVectors];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(0);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(1);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(2);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ cornerPiece[4] = getLineIntersection(vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ cornerPiece[5] = getLineIntersection(vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ cornerPieces[0] = cornerPiece;
+ cornerPiece = new PVector[numberOfVectors];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(3);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(4);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(5);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17));
+ cornerPiece[4] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17));
+ cornerPiece[5] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ cornerPieces[1] = cornerPiece;
+ cornerPiece = new PVector[numberOfVectors];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(6);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(7);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(8);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15));
+ cornerPiece[4] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ cornerPiece[5] = getLineIntersection(vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ cornerPieces[2] = cornerPiece;
+ cornerPiece = new PVector[numberOfVectors];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(9);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(10);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(11);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ cornerPiece[4] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ cornerPiece[5] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9));
+ cornerPieces[3] = cornerPiece;
+ cornerPiece = new PVector[numberOfVectors];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(12);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(13);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(14);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ cornerPiece[4] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ cornerPiece[5] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ cornerPieces[4] = cornerPiece;
+ cornerPiece = new PVector[numberOfVectors];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(15);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(16);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(17);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ cornerPiece[4] = getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ cornerPiece[5] = getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(8));
+ cornerPieces[5] = cornerPiece;
+ }
+
+ void setSidePieces(int amount, int numberOfVectors){
+ sidePieces = new PVector[amount][numberOfVectors];
+ PVector[] sidePiece = new PVector[numberOfVectors];
+ sidePiece[0] = vectorsOnInnerHexagon.get(17);
+ sidePiece[1] = vectorsOnInnerHexagon.get(0);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(6));
+ sidePieces[0] = sidePiece;
+ sidePiece = new PVector[numberOfVectors];
+ sidePiece[0] = vectorsOnInnerHexagon.get(2);
+ sidePiece[1] = vectorsOnInnerHexagon.get(3);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ sidePieces[1] = sidePiece;
+ sidePiece = new PVector[numberOfVectors];
+ sidePiece[0] = vectorsOnInnerHexagon.get(5);
+ sidePiece[1] = vectorsOnInnerHexagon.get(6);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17));
+ sidePieces[2] = sidePiece;
+ sidePiece = new PVector[numberOfVectors];
+ sidePiece[0] = vectorsOnInnerHexagon.get(8);
+ sidePiece[1] = vectorsOnInnerHexagon.get(9);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15));
+ sidePieces[3] = sidePiece;
+ sidePiece = new PVector[numberOfVectors];
+ sidePiece[0] = vectorsOnInnerHexagon.get(11);
+ sidePiece[1] = vectorsOnInnerHexagon.get(12);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ sidePieces[4] = sidePiece;
+ sidePiece = new PVector[numberOfVectors];
+ sidePiece[0] = vectorsOnInnerHexagon.get(14);
+ sidePiece[1] = vectorsOnInnerHexagon.get(15);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(14), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15));
+ sidePieces[5] = sidePiece;
+ }
+
+ void setCenterStar(int numberOfVectors){
+ centerStar = new PVector[numberOfVectors];
+ centerStar[0] = getLineIntersection(vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ centerStar[1] = getLineIntersection(vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ centerStar[2] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ centerStar[3] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17));
+ centerStar[4] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12), vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17));
+ centerStar[5] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ centerStar[6] = getLineIntersection(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15));
+ centerStar[7] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ centerStar[8] = getLineIntersection(vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ centerStar[9] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ centerStar[10] = getLineIntersection(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ centerStar[11] = getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14), vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ }
+
+ void createInterlockingTriangles(){
+ useStrokeColor();
+ useFillColor();
+ createInnerTriangle();
+ createInnerTriangleTilted(60);
+ }
+
+ void createParallelBorderLines(){
+ useStrokeColor();
+ useFillColor();
+ createLine(vectorsOnInnerHexagon.get(0), vectorsOnInnerHexagon.get(11));
+ createLine(vectorsOnInnerHexagon.get(2), vectorsOnInnerHexagon.get(9));
+ createLine(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(14));
+ createLine(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(12));
+ createLine(vectorsOnInnerHexagon.get(6), vectorsOnInnerHexagon.get(17));
+ createLine(vectorsOnInnerHexagon.get(8), vectorsOnInnerHexagon.get(15));
+ }
+
+ 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 createCenterStar(){
+ useStrokeColor();
+ useFillColor();
+ beginShape();
+ for(int i=0; i<centerStar.length; i++){
+ vertex(centerStar[i].x, centerStar[i].y);
+ }
+ endShape();
+ }
+
+ void display(){
+ setStrokeColor(new Float[] {0.0, 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.0, 0.0, 0.0, 0.0});
+ setFillColor(new Float[] {0.0, 0.0, 1.0, 1.0});
+ createCenterStar();
+ }
+
+ void displayConstructionLines(){
+ super.displayConstructionLines();
+ setStrokeColor(new Float[] {0.4, 0.4, 0.8, 1.0});
+ createInterlockingTriangles();
+ createParallelBorderLines();
+ setStrokeColor(new Float[] {0.8, 0.0, 0.0, 1.0});
+ setFillColor(new Float[] {0.8, 0.8, 0.8, 1.0});
+ createVectorIndicatorOnInnerHexagon(4);
+ setStrokeColor(new Float[] {0.4, 0.4, 0.8, 1.0});
+ setFillColor(new Float[] {0.0, 0.0, 0.0, 0.0});
+ }
+
+}
+