class IGPSquare extends IGPFamily { int parts; IGPSquare(float x, float y, float d, int p){ super(x, y, d); parts = p; setVectorsOnAlphaCircle(); setConstructionCircleCenters(); setVectorsOnOuterSquare(); } void setConstructionCircleCenters(){ constructionCircleCenters = new ArrayList (4); constructionCircleCenters.add(alphaCircleVectors.get(0)); constructionCircleCenters.add(alphaCircleVectors.get(3)); constructionCircleCenters.add(alphaCircleVectors.get(6)); constructionCircleCenters.add(alphaCircleVectors.get(9)); } void setVectorsOnOuterSquare(){ int amount = 12; constructionPartsTwelve = new ArrayList (12); constructionPartsTwelve.add(alphaCircleVectors.get(0)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(1), mid.x+radius, false)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(2), mid.y-radius, true)); constructionPartsTwelve.add(alphaCircleVectors.get(3)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(4), mid.y-radius, true)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(5), mid.x-radius, false)); constructionPartsTwelve.add(alphaCircleVectors.get(6)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(7), mid.x-radius, false)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(8), mid.y+radius, true)); constructionPartsTwelve.add(alphaCircleVectors.get(9)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(10), mid.y+radius, true)); constructionPartsTwelve.add(extendLine(mid, alphaCircleVectors.get(11), mid.x+radius, false)); constructionPartsSixteen = new ArrayList (16); constructionPartsSixteen.add(alphaCircleVectorsSixteen.get(0)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(1), mid.x+radius, false)); constructionPartsSixteen.add(new PVector(mid.x+radius, mid.y-radius)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(3), mid.y-radius, true)); constructionPartsSixteen.add(alphaCircleVectorsSixteen.get(4)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(5), mid.y-radius, true)); constructionPartsSixteen.add(new PVector(mid.x-radius, mid.y-radius)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(7), mid.x-radius, false)); constructionPartsSixteen.add(alphaCircleVectorsSixteen.get(8)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(9), mid.x-radius, false)); constructionPartsSixteen.add(new PVector(mid.x-radius, mid.y+radius)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(11), mid.y+radius, true)); constructionPartsSixteen.add(alphaCircleVectorsSixteen.get(12)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(13), mid.y+radius, true)); constructionPartsSixteen.add(new PVector(mid.x+radius, mid.y+radius)); constructionPartsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(15), mid.x+radius, false)); } void createDividingLines(){ stroke(0.0, 0.66, 0.0, 0.4); if(parts == 12){ createLine(constructionPartsTwelve.get(0), constructionPartsTwelve.get(6)); createLine(constructionPartsTwelve.get(1), constructionPartsTwelve.get(7)); createLine(constructionPartsTwelve.get(2), constructionPartsTwelve.get(8)); createLine(constructionPartsTwelve.get(3), constructionPartsTwelve.get(9)); createLine(constructionPartsTwelve.get(4), constructionPartsTwelve.get(10)); createLine(constructionPartsTwelve.get(5), constructionPartsTwelve.get(11)); }else if (parts == 16){ createLine(constructionPartsSixteen.get(0), constructionPartsSixteen.get(8)); createLine(constructionPartsSixteen.get(1), constructionPartsSixteen.get(9)); createLine(constructionPartsSixteen.get(2), constructionPartsSixteen.get(10)); createLine(constructionPartsSixteen.get(3), constructionPartsSixteen.get(11)); createLine(constructionPartsSixteen.get(4), constructionPartsSixteen.get(12)); createLine(constructionPartsSixteen.get(5), constructionPartsSixteen.get(13)); createLine(constructionPartsSixteen.get(6), constructionPartsSixteen.get(14)); createLine(constructionPartsSixteen.get(7), constructionPartsSixteen.get(15)); } } void createDividingConstructionLines(){ if(parts == 12){ createLine(constructionPartsTwelve.get(0), constructionPartsTwelve.get(6)); createLine(constructionPartsTwelve.get(1), constructionPartsTwelve.get(7)); createLine(constructionPartsTwelve.get(2), constructionPartsTwelve.get(8)); createLine(constructionPartsTwelve.get(3), constructionPartsTwelve.get(9)); createLine(constructionPartsTwelve.get(4), constructionPartsTwelve.get(10)); createLine(constructionPartsTwelve.get(5), constructionPartsTwelve.get(11)); }else if (parts == 16){ createLine(constructionPartsSixteen.get(0), constructionPartsSixteen.get(8)); createLine(constructionPartsSixteen.get(1), constructionPartsSixteen.get(9)); createLine(constructionPartsSixteen.get(2), constructionPartsSixteen.get(10)); createLine(constructionPartsSixteen.get(3), constructionPartsSixteen.get(11)); createLine(constructionPartsSixteen.get(4), constructionPartsSixteen.get(12)); createLine(constructionPartsSixteen.get(5), constructionPartsSixteen.get(13)); createLine(constructionPartsSixteen.get(6), constructionPartsSixteen.get(14)); createLine(constructionPartsSixteen.get(7), constructionPartsSixteen.get(15)); } } void display() { super.display(); createOuterSquare(); createDividingLines(); } void displayConstructionLines(){ super.displayConstructionLines(); createDiagonalConstructionLinesOnOuterSquare(); if (parts == 16){ createInnerSquare(); createInnerSquareTilted(45); } createDividingConstructionLines(); } }