summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-01-08 03:31:40 +0100
committerDavid Runge <dave@sleepmap.de>2016-01-08 03:31:40 +0100
commit04b955f1b3592c8d5b3f0b4dd8fda48a0512531f (patch)
treed5d9aef41a082bb391cd53fadcf0377264444863
parent933c44e6592d15647c417866da46896cfe8f0cf9 (diff)
downloadprocessing-sketchbook-04b955f1b3592c8d5b3f0b4dd8fda48a0512531f.tar.gz
processing-sketchbook-04b955f1b3592c8d5b3f0b4dd8fda48a0512531f.tar.bz2
processing-sketchbook-04b955f1b3592c8d5b3f0b4dd8fda48a0512531f.tar.xz
processing-sketchbook-04b955f1b3592c8d5b3f0b4dd8fda48a0512531f.zip
AutoVisual/IGPMustansiriyaMadrasa.pde: Adding first version of Mstansiriya Madrasa class, based upon a hexagon setting.
-rw-r--r--AutoVisual/IGPMustansiriyaMadrasa.pde236
1 files changed, 236 insertions, 0 deletions
diff --git a/AutoVisual/IGPMustansiriyaMadrasa.pde b/AutoVisual/IGPMustansiriyaMadrasa.pde
new file mode 100644
index 0000000..cd15e88
--- /dev/null
+++ b/AutoVisual/IGPMustansiriyaMadrasa.pde
@@ -0,0 +1,236 @@
+class IGPMustansiriyaMadrasa extends IGPHexagon{
+
+ ArrayList <PVector> vectorsOnInterlockingTriangles;
+ PVector[][] cornerPieces;
+ PVector[][] sidePieces;
+ ArrayList <PVector> middleHexagon;
+ IGPMustansiriyaMadrasa(float x, float y, float d){
+ super(x, y, d);
+ setVectorsOnInterlockingTriangles();
+ setVectorsOnInnerHexagon();
+ setCornerPieces();
+ setSidePieces();
+ setMiddleHexagon();
+ }
+
+ void setVectorsOnInnerHexagon(){
+ vectorsOnInnerHexagon = new ArrayList <PVector> (24);
+ vectorsOnInnerHexagon.add(baseVectorsOnInnerHexagon.get(0));
+ 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(baseVectorsOnInnerHexagon.get(2));
+ 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(baseVectorsOnInnerHexagon.get(4));
+ 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(baseVectorsOnInnerHexagon.get(6));
+ 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(baseVectorsOnInnerHexagon.get(8));
+ 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(baseVectorsOnInnerHexagon.get(10));
+ 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(){
+ cornerPieces = new PVector[6][4];
+ PVector[] cornerPiece = new PVector[4];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(1);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(2);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(3);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21));
+ cornerPieces[0] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(5);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(6);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(7);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7));
+ cornerPieces[1] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(9);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(10);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(11);
+ cornerPiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ cornerPieces[2] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ cornerPiece[1] = vectorsOnInnerHexagon.get(13);
+ cornerPiece[2] = vectorsOnInnerHexagon.get(14);
+ cornerPiece[3] = vectorsOnInnerHexagon.get(15);
+ cornerPieces[3] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(19);
+ cornerPiece[1] = getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ cornerPiece[2] = vectorsOnInnerHexagon.get(17);
+ cornerPiece[3] = vectorsOnInnerHexagon.get(18);
+ cornerPieces[4] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = vectorsOnInnerHexagon.get(22);
+ cornerPiece[1] = vectorsOnInnerHexagon.get(23);
+ cornerPiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ cornerPiece[3] = vectorsOnInnerHexagon.get(21);
+ cornerPieces[5] = cornerPiece;
+ }
+
+ void setSidePieces(){
+ sidePieces = new PVector[6][4];
+ PVector[] sidePiece = new PVector[4];
+ sidePiece[0] = vectorsOnInnerHexagon.get(3);
+ sidePiece[1] = vectorsOnInnerHexagon.get(5);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7));
+ sidePiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21));
+ sidePieces[0] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7));
+ sidePiece[1] = vectorsOnInnerHexagon.get(7);
+ sidePiece[2] = vectorsOnInnerHexagon.get(9);
+ sidePiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ sidePieces[1] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ sidePiece[1] = vectorsOnInnerHexagon.get(11);
+ sidePiece[2] = vectorsOnInnerHexagon.get(13);
+ sidePiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ sidePieces[2] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ sidePiece[1] = getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ sidePiece[2] = vectorsOnInnerHexagon.get(15);
+ sidePiece[3] = vectorsOnInnerHexagon.get(17);
+ sidePieces[3] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = vectorsOnInnerHexagon.get(21);
+ sidePiece[1] = getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ sidePiece[3] = vectorsOnInnerHexagon.get(19);
+ sidePieces[4] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = vectorsOnInnerHexagon.get(23);
+ sidePiece[1] = vectorsOnInnerHexagon.get(1);
+ sidePiece[2] = getLineIntersection(vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21));
+ sidePiece[3] = getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ sidePieces[5] = sidePiece;
+ }
+
+ void setMiddleHexagon(){
+ middleHexagon = new ArrayList <PVector> (6);
+ middleHexagon.add(getLineIntersection(vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7), vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21)));
+ middleHexagon.add(getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7)));
+ middleHexagon.add(getLineIntersection(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15)));
+ middleHexagon.add(getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15)));
+ middleHexagon.add(getLineIntersection(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23)));
+ middleHexagon.add(getLineIntersection(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21), vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23)));
+ }
+
+ void createInnerInterlockingTriangles(){
+ useStrokeColor();
+ useFillColor();
+ createLine(vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(15));
+ createLine(vectorsOnInnerHexagon.get(7), vectorsOnInnerHexagon.get(17));
+ createLine(vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(23));
+ createLine(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(13));
+ createLine(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(19));
+ createLine(vectorsOnInnerHexagon.get(11), vectorsOnInnerHexagon.get(21));
+ }
+
+ void createParallelBorderLines(){
+ useStrokeColor();
+ useFillColor();
+ createLine(vectorsOnInnerHexagon.get(1), vectorsOnInnerHexagon.get(7));
+ createLine(vectorsOnInnerHexagon.get(3), vectorsOnInnerHexagon.get(21));
+ createLine(vectorsOnInnerHexagon.get(5), vectorsOnInnerHexagon.get(11));
+ createLine(vectorsOnInnerHexagon.get(9), vectorsOnInnerHexagon.get(15));
+ createLine(vectorsOnInnerHexagon.get(13), vectorsOnInnerHexagon.get(19));
+ createLine(vectorsOnInnerHexagon.get(17), vectorsOnInnerHexagon.get(23));
+ }
+
+ void createInterlockingTriangles(){
+ useStrokeColor();
+ useFillColor();
+ createInnerTriangle();
+ createInnerTriangleTilted(60);
+ }
+
+ 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 createMiddleHexagon(){
+ useStrokeColor();
+ useFillColor();
+ beginShape();
+ for (PVector vector: middleHexagon) {
+ vertex(vector.x, vector.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});
+ createMiddleHexagon();
+ }
+
+ void displayConstructionLines(){
+ super.displayConstructionLines();
+ setStrokeColor(new Float[] {0.4, 0.4, 0.8, 1.0});
+ createInterlockingTriangles();
+ createInnerInterlockingTriangles();
+ 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});
+ }
+
+}