summaryrefslogtreecommitdiffstats
path: root/AutoVisual
diff options
context:
space:
mode:
Diffstat (limited to 'AutoVisual')
-rw-r--r--AutoVisual/IGPTheGreatMosqueOfCordoba.pde290
1 files changed, 290 insertions, 0 deletions
diff --git a/AutoVisual/IGPTheGreatMosqueOfCordoba.pde b/AutoVisual/IGPTheGreatMosqueOfCordoba.pde
new file mode 100644
index 0000000..df4e8ed
--- /dev/null
+++ b/AutoVisual/IGPTheGreatMosqueOfCordoba.pde
@@ -0,0 +1,290 @@
+class IGPTheGreatMosqueOfCordoba extends IGPSquare{
+
+ PVector[][] cornerPieces;
+ PVector[][] sidePieces;
+ PVector[][] starPieces;
+ PVector[][] verticalVs;
+ PVector[][] horizontalVs;
+ ArrayList <PVector> middleStar;
+ IGPTheGreatMosqueOfCordoba(float x, float y, float d){
+ super(x, y, d, 12);
+ setInterlacingVs();
+ setSidePieces();
+ setCornerPieces();
+ setStarPieces();
+ setMiddleStar();
+ }
+
+ void setInterlacingVs(){
+ PVector[] vectors = new PVector[2];
+ verticalVs = new PVector[4][2];
+ horizontalVs = new PVector[4][2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(315), mid.y-radius, true);
+ vectors[1] = getVectorOnAlphaCircle(90);
+ verticalVs[0] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(225), mid.y-radius, true);
+ vectors[1] = getVectorOnAlphaCircle(90);
+ verticalVs[1] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), mid.y+radius, true);
+ vectors[1] = getVectorOnAlphaCircle(270);
+ verticalVs[2] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135), mid.y+radius, true);
+ vectors[1] = getVectorOnAlphaCircle(270);
+ verticalVs[3] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), mid.x+radius, false);
+ vectors[1] = getVectorOnAlphaCircle(180);
+ horizontalVs[0] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), mid.x+radius, false);
+ vectors[1] = getVectorOnAlphaCircle(180);
+ horizontalVs[1] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(225), mid.x-radius, false);
+ vectors[1] = getVectorOnAlphaCircle(0);
+ horizontalVs[2] = vectors;
+ vectors = new PVector[2];
+ vectors[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(135), mid.x-radius, false);
+ vectors[1] = getVectorOnAlphaCircle(0);
+ horizontalVs[3] = vectors;
+ }
+
+ void setMiddleStar(){
+ middleStar = new ArrayList <PVector>(16);
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45)));
+ middleStar.add(getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90)));
+ }
+
+ void setCornerPieces(){
+ cornerPieces = new PVector[4][4];
+ PVector[] cornerPiece = new PVector[4];
+ cornerPiece[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), mid.x+radius, false);
+ cornerPiece[1] = new PVector(mid.x+radius, mid.y+radius);
+ cornerPiece[2] = getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), mid.y+radius, true);
+ cornerPiece[3] = getVectorOnAlphaCircle(45);
+ cornerPieces[0] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = getVectorOnAlphaCircle(135);
+ cornerPiece[1] = getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135), mid.y+radius, true);
+ cornerPiece[2] = new PVector(mid.x-radius, mid.y+radius);
+ cornerPiece[3] = getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(135), mid.x-radius, false);
+ cornerPieces[1] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = getVectorOnAlphaCircle(225);
+ cornerPiece[1] = getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(225), mid.y-radius, true);
+ cornerPiece[2] = new PVector(mid.x-radius, mid.y-radius);
+ cornerPiece[3] = getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(225), mid.x-radius, false);
+ cornerPieces[2] = cornerPiece;
+ cornerPiece = new PVector[4];
+ cornerPiece[0] = new PVector(mid.x+radius, mid.y-radius);
+ cornerPiece[1] = getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), mid.x+radius, false);
+ cornerPiece[2] = getVectorOnAlphaCircle(315);
+ cornerPiece[3] = getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(315), mid.y-radius, true);
+ cornerPieces[3] = cornerPiece;
+ }
+
+ void setSidePieces(){
+ sidePieces = new PVector[8][4];
+ PVector[] sidePiece = new PVector[4];
+ sidePiece[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), mid.x+radius, false);
+ sidePiece[1] = getVectorOnAlphaCircle(0);
+ sidePiece[2] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ sidePiece[3] = getVectorOnAlphaCircle(315);
+ sidePieces[0] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getVectorOnAlphaCircle(0);
+ sidePiece[1] = getVectorOnExtendedLine(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), mid.x+radius, false);
+ sidePiece[2] = getVectorOnAlphaCircle(45);
+ sidePiece[3] = getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0));
+ sidePieces[1] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), mid.y+radius, true);
+ sidePiece[1] = getVectorOnAlphaCircle(90);
+ sidePiece[2] = getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0));
+ sidePiece[3] = getVectorOnAlphaCircle(45);
+ sidePieces[2] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getVectorOnAlphaCircle(90);
+ sidePiece[1] = getVectorOnExtendedLine(getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(135), mid.y+radius, true);
+ sidePiece[2] = getVectorOnAlphaCircle(135);
+ sidePiece[3] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0));
+ sidePieces[3] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ sidePiece[1] = getVectorOnAlphaCircle(135);
+ sidePiece[2] = getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(135), mid.x-radius, false);
+ sidePiece[3] = getVectorOnAlphaCircle(180);
+ sidePieces[4] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90));
+ sidePiece[1] = getVectorOnAlphaCircle(180);
+ sidePiece[2] = getVectorOnExtendedLine(getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(225), mid.x-radius, false);
+ sidePiece[3] = getVectorOnAlphaCircle(225);
+ sidePieces[5] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getVectorOnAlphaCircle(270);
+ sidePiece[1] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ sidePiece[2] = getVectorOnAlphaCircle(225);
+ sidePiece[3] = getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(225), mid.y-radius, true);
+ sidePieces[6] = sidePiece;
+ sidePiece = new PVector[4];
+ sidePiece[0] = getVectorOnExtendedLine(getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(315), mid.y-radius, true);
+ sidePiece[1] = getVectorOnAlphaCircle(315);
+ sidePiece[2] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45));
+ sidePiece[3] = getVectorOnAlphaCircle(270);
+ sidePieces[7] = sidePiece;
+ }
+
+ void setStarPieces(){
+ starPieces = new PVector[8][4];
+ PVector[] starPiece = new PVector[4];
+ starPiece[0] = getVectorOnAlphaCircle(315);
+ starPiece[1] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45));
+ starPiece[3] = getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315));
+ starPieces[0] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getVectorOnAlphaCircle(0);
+ starPiece[1] = getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0));
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ starPiece[3] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ starPieces[1] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getLineIntersection(getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0));
+ starPiece[1] = getVectorOnAlphaCircle(45);
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ starPiece[3] = getLineIntersection(getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ starPieces[2] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(90));
+ starPiece[1] = getVectorOnAlphaCircle(90);
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0));
+ starPiece[3] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0));
+ starPieces[3] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(0));
+ starPiece[1] = getVectorOnAlphaCircle(135);
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ starPiece[3] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45));
+ starPieces[4] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ starPiece[1] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ starPiece[2] = getVectorOnAlphaCircle(180);
+ starPiece[3] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90));
+ starPieces[5] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ starPiece[1] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(90));
+ starPiece[3] = getVectorOnAlphaCircle(225);
+ starPieces[6] = starPiece;
+ starPiece = new PVector[4];
+ starPiece[0] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(45));
+ starPiece[1] = getLineIntersection(getVectorOnAlphaCircle(180), getVectorOnAlphaCircle(315), getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0));
+ starPiece[2] = getLineIntersection(getVectorOnAlphaCircle(225), getVectorOnAlphaCircle(0), getVectorOnAlphaCircle(270), getVectorOnAlphaCircle(135));
+ starPiece[3] = getVectorOnAlphaCircle(270);
+ 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 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 createInterlacingVs(){
+ useStrokeColor();
+ useFillColor();
+ for(int i=0; i<verticalVs.length; i++){
+ createLine(verticalVs[i][0], verticalVs[i][1]);
+ }
+ for(int i=0; i<horizontalVs.length; i++){
+ createLine(horizontalVs[i][0], horizontalVs[i][1]);
+ }
+ }
+
+ void display(){
+ setStrokeColor(new Float[] {0.66, 0.66, 0.8, 1.0});
+ setFillColor(new Float[] {0.0, 1.0, 0.0, 1.0});
+ createSidePieces();
+ setStrokeColor(new Float[] {0.66, 0.0, 0.0, 1.0});
+ setFillColor(new Float[] {1.0, 1.0, 1.0, 1.0});
+ createCornerPieces();
+ setStrokeColor(new Float[] {0.66, 0.0, 0.0, 1.0});
+ setFillColor(new Float[] {1.0, 0.0, 0.0, 1.0});
+ createStarPieces();
+ setStrokeColor(new Float[] {0.66, 0.66, 0.8, 1.0});
+ setFillColor(new Float[] {0.0, 0.0, 1.0, 1.0});
+ createMiddleStar();
+ }
+
+ void displayConstructionLines(){
+ super.displayConstructionLines();
+ setStrokeColor(new Float[] {0.66, 0.0, 0.8, 1.0});
+ createInterlacingVs();
+ }
+}