From 434f041585cc1bacac3c90a4c5099d1ea9434ed6 Mon Sep 17 00:00:00 2001 From: David Runge Date: Thu, 31 Dec 2015 03:28:53 +0100 Subject: Separating createDividingLines() creatingDividingConstructionLines() functionality. Differentiating between amount of parts of square geometric. --- AutoVisual/IGPSquare.pde | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'AutoVisual') diff --git a/AutoVisual/IGPSquare.pde b/AutoVisual/IGPSquare.pde index 93f0973..b1e8669 100644 --- a/AutoVisual/IGPSquare.pde +++ b/AutoVisual/IGPSquare.pde @@ -3,7 +3,7 @@ class IGPSquare extends IGPFamily { IGPSquare(float x, float y, float d, int p){ super(x, y, d); -// parts = p; + parts = p; setVectorsOnAlphaCircle(); setConstructionCircleCenters(); setVectorsOnOuterSquare(); @@ -32,7 +32,7 @@ class IGPSquare extends IGPFamily { constructionPartsTwelve.add(constructionCircleCenters.get(3)); constructionPartsTwelve.add(new PVector(mid.x-radius, constructionCircleCenters.get(2).y-radius/2-radius/amount)); constructionPartsTwelve.add(new PVector(constructionCircleCenters.get(1).x-radius/2-radius/amount, mid.y-radius)); - constructionPartsSixteen = new ArrayList (16); + constructionPartsSixteen = new ArrayList (16); constructionPartsSixteen.add(constructionCircleCenters.get(0)); constructionPartsSixteen.add(new PVector(constructionCircleCenters.get(1).x+radius/2-radius/amount, mid.y-radius)); constructionPartsSixteen.add(new PVector(constructionCircleCenters.get(1).x-radius, constructionCircleCenters.get(2).y-radius)); @@ -51,18 +51,36 @@ class IGPSquare extends IGPFamily { constructionPartsSixteen.add(new PVector(constructionCircleCenters.get(1).x-radius/2+radius/amount, mid.y-radius)); } - void createDividingConstructionLines(int amount){ - if(amount == 12){ + 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 (amount == 16){ - amount = 12; - stroke(0.0, 0.0, 0.66, 0.4); + }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)); @@ -77,18 +95,16 @@ class IGPSquare extends IGPFamily { void display() { super.display(); createOuterSquare(); - if (parts == 16){ - createInnerSquare(); - createInnerSquareTilted(45); - } + createDividingLines(); } void displayConstructionLines(){ super.displayConstructionLines(); createDiagonalConstructionLines(); - createDividingConstructionLines(12); if (parts == 16){ - createDividingConstructionLines(16); + createInnerSquare(); + createInnerSquareTilted(45); } + createDividingConstructionLines(); } } -- cgit v1.2.3