summaryrefslogtreecommitdiffstats
path: root/AutoVisual
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-01-04 06:50:34 +0100
committerDavid Runge <dave@sleepmap.de>2016-01-04 06:50:34 +0100
commitf527b87d09d686f8e7cb355aaa5da0fa17136c67 (patch)
tree3fed538c0f3bb873d3c025fa09f83296fd1dc9f0 /AutoVisual
parent95ed9e19668ead31a40fcdf4e36732b5a6934c20 (diff)
downloadprocessing-sketchbook-f527b87d09d686f8e7cb355aaa5da0fa17136c67.tar.gz
processing-sketchbook-f527b87d09d686f8e7cb355aaa5da0fa17136c67.tar.bz2
processing-sketchbook-f527b87d09d686f8e7cb355aaa5da0fa17136c67.tar.xz
processing-sketchbook-f527b87d09d686f8e7cb355aaa5da0fa17136c67.zip
AutoVisual/IGP{Family,Hexagon,Pentagon,Square}.pde: Removing display() function in lower level classes, moving all calls to create* methods to displayConstructionLines(). Refactoring outerSquareVectors* ArrayLists to {twelve,sixteen}BaseVectorsOnOuterSquare, to separate their usage more obviously from creating vectorsOnOuterSquare ArrayLists holding all PVectors necessary to display geometric patterns with end points on the outer square.
Diffstat (limited to 'AutoVisual')
-rw-r--r--AutoVisual/IGPFamily.pde9
-rw-r--r--AutoVisual/IGPHexagon.pde46
-rw-r--r--AutoVisual/IGPPentagon.pde8
-rw-r--r--AutoVisual/IGPSquare.pde131
4 files changed, 89 insertions, 105 deletions
diff --git a/AutoVisual/IGPFamily.pde b/AutoVisual/IGPFamily.pde
index 0651ceb..78e3f2f 100644
--- a/AutoVisual/IGPFamily.pde
+++ b/AutoVisual/IGPFamily.pde
@@ -9,8 +9,8 @@ class IGPFamily {
ArrayList <PVector> alphaCircleVectors;
ArrayList <PVector> alphaCircleVectorsSixteen;
ArrayList <PVector> constructionCircleCenters;
- ArrayList <PVector> outerSquareVectors;
- ArrayList <PVector> outerSquareVectorsSixteen;
+ ArrayList <PVector> twelveBaseVectorsOnOuterSquare;
+ ArrayList <PVector> sixteenBaseVectorsOnOuterSquare;
IGPFamily(float x, float y, float d){
ellipseMode(CENTER);
@@ -250,11 +250,8 @@ class IGPFamily {
}
}
- void display() {
- createAlphaCircle();
- }
-
void displayConstructionLines() {
+ createAlphaCircle();
createConstructionCircles();
createVerticalHorizontalConstructionLines();
}
diff --git a/AutoVisual/IGPHexagon.pde b/AutoVisual/IGPHexagon.pde
index bf84c55..8c2c5ab 100644
--- a/AutoVisual/IGPHexagon.pde
+++ b/AutoVisual/IGPHexagon.pde
@@ -19,40 +19,40 @@ class IGPHexagon extends IGPFamily{
void setVectorsOnConstructionCircles(){
int amount = 12;
- outerSquareVectors = new ArrayList <PVector>(12);
+ twelveBaseVectorsOnOuterSquare = new ArrayList <PVector>(12);
// 0°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(0), 0));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(0), 0));
// 30°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(1), 0));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(1), 0));
// 60°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(1), 60));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(1), 60));
// 90°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(1), 120));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(1), 120));
// 120°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(2), 120));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(2), 120));
// 150°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(3), 120));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(3), 120));
// 180°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(3), 180));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(3), 180));
// 210°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(4), 180));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(4), 180));
// 240°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(4), 240));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(4), 240));
// 270°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(4), 300));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(4), 300));
// 300°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(5), 300));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(5), 300));
// 330°
- outerSquareVectors.add(getVectorOnCircle(constructionCircleCenters.get(5), 0));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnCircle(constructionCircleCenters.get(5), 0));
}
void createDividingConstructionLines(int amount){
- createLine(outerSquareVectors.get(0), outerSquareVectors.get(6));
- createLine(outerSquareVectors.get(1), outerSquareVectors.get(7));
- createLine(outerSquareVectors.get(2), outerSquareVectors.get(8));
- createLine(outerSquareVectors.get(3), outerSquareVectors.get(9));
- createLine(outerSquareVectors.get(4), outerSquareVectors.get(10));
- createLine(outerSquareVectors.get(5), outerSquareVectors.get(11));
+ createLine(twelveBaseVectorsOnOuterSquare.get(0), twelveBaseVectorsOnOuterSquare.get(6));
+ createLine(twelveBaseVectorsOnOuterSquare.get(1), twelveBaseVectorsOnOuterSquare.get(7));
+ createLine(twelveBaseVectorsOnOuterSquare.get(2), twelveBaseVectorsOnOuterSquare.get(8));
+ createLine(twelveBaseVectorsOnOuterSquare.get(3), twelveBaseVectorsOnOuterSquare.get(9));
+ createLine(twelveBaseVectorsOnOuterSquare.get(4), twelveBaseVectorsOnOuterSquare.get(10));
+ createLine(twelveBaseVectorsOnOuterSquare.get(5), twelveBaseVectorsOnOuterSquare.get(11));
}
void createDividingLines(int amount){
@@ -64,14 +64,10 @@ class IGPHexagon extends IGPFamily{
createLine(alphaCircleVectors.get(5), alphaCircleVectors.get(11));
}
- void display() {
- super.display();
- createDividingLines(12);
- createInnerHexagon();
- }
-
void displayConstructionLines(){
super.displayConstructionLines();
+ createDividingLines(12);
+ createInnerHexagon();
createDividingConstructionLines(12);
}
}
diff --git a/AutoVisual/IGPPentagon.pde b/AutoVisual/IGPPentagon.pde
index 3cfa4f0..02891ac 100644
--- a/AutoVisual/IGPPentagon.pde
+++ b/AutoVisual/IGPPentagon.pde
@@ -38,14 +38,10 @@ class IGPPentagon extends IGPFamily{
createLine(mid, constructionCircleCenters.get(4));
}
- void display() {
- super.display();
- createInnerPentagon();
- createDividingLines();
- }
-
void displayConstructionLines(){
super.displayConstructionLines();
+ createInnerPentagon();
createConstructionCircles();
+ createDividingLines();
}
}
diff --git a/AutoVisual/IGPSquare.pde b/AutoVisual/IGPSquare.pde
index e77368d..40185cb 100644
--- a/AutoVisual/IGPSquare.pde
+++ b/AutoVisual/IGPSquare.pde
@@ -5,7 +5,7 @@ class IGPSquare extends IGPFamily {
super(x, y, d);
parts = p;
setVectorsOnAlphaCircle();
- setVectorsOnOuterSquare();
+ setBaseVectorsOnOuterSquare();
setConstructionCircleCenters();
}
@@ -17,90 +17,85 @@ class IGPSquare extends IGPFamily {
constructionCircleCenters.add(alphaCircleVectors.get(9));
}
- void setVectorsOnOuterSquare(){
- int amount = 12;
- outerSquareVectors = new ArrayList <PVector>(12);
- outerSquareVectors.add(alphaCircleVectors.get(0));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(1), mid.x+radius, false));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(2), mid.y-radius, true));
- outerSquareVectors.add(alphaCircleVectors.get(3));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(4), mid.y-radius, true));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(5), mid.x-radius, false));
- outerSquareVectors.add(alphaCircleVectors.get(6));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(7), mid.x-radius, false));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(8), mid.y+radius, true));
- outerSquareVectors.add(alphaCircleVectors.get(9));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(10), mid.y+radius, true));
- outerSquareVectors.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(11), mid.x+radius, false));
-
- outerSquareVectorsSixteen = new ArrayList <PVector>(16);
- outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(0));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(1), mid.x+radius, false));
- outerSquareVectorsSixteen.add(new PVector(mid.x+radius, mid.y-radius));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(3), mid.y-radius, true));
- outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(4));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(5), mid.y-radius, true));
- outerSquareVectorsSixteen.add(new PVector(mid.x-radius, mid.y-radius));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(7), mid.x-radius, false));
- outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(8));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(9), mid.x-radius, false));
- outerSquareVectorsSixteen.add(new PVector(mid.x-radius, mid.y+radius));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(11), mid.y+radius, true));
- outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(12));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(13), mid.y+radius, true));
- outerSquareVectorsSixteen.add(new PVector(mid.x+radius, mid.y+radius));
- outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(15), mid.x+radius, false));
+ void setBaseVectorsOnOuterSquare(){
+ twelveBaseVectorsOnOuterSquare = new ArrayList <PVector>(12);
+ twelveBaseVectorsOnOuterSquare.add(alphaCircleVectors.get(0));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(1), mid.x+radius, false));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(2), mid.y-radius, true));
+ twelveBaseVectorsOnOuterSquare.add(alphaCircleVectors.get(3));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(4), mid.y-radius, true));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(5), mid.x-radius, false));
+ twelveBaseVectorsOnOuterSquare.add(alphaCircleVectors.get(6));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(7), mid.x-radius, false));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(8), mid.y+radius, true));
+ twelveBaseVectorsOnOuterSquare.add(alphaCircleVectors.get(9));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(10), mid.y+radius, true));
+ twelveBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectors.get(11), mid.x+radius, false));
+
+ sixteenBaseVectorsOnOuterSquare = new ArrayList <PVector>(16);
+ sixteenBaseVectorsOnOuterSquare.add(alphaCircleVectorsSixteen.get(0));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(1), mid.x+radius, false));
+ sixteenBaseVectorsOnOuterSquare.add(new PVector(mid.x+radius, mid.y-radius));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(3), mid.y-radius, true));
+ sixteenBaseVectorsOnOuterSquare.add(alphaCircleVectorsSixteen.get(4));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(5), mid.y-radius, true));
+ sixteenBaseVectorsOnOuterSquare.add(new PVector(mid.x-radius, mid.y-radius));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(7), mid.x-radius, false));
+ sixteenBaseVectorsOnOuterSquare.add(alphaCircleVectorsSixteen.get(8));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(9), mid.x-radius, false));
+ sixteenBaseVectorsOnOuterSquare.add(new PVector(mid.x-radius, mid.y+radius));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(11), mid.y+radius, true));
+ sixteenBaseVectorsOnOuterSquare.add(alphaCircleVectorsSixteen.get(12));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(13), mid.y+radius, true));
+ sixteenBaseVectorsOnOuterSquare.add(new PVector(mid.x+radius, mid.y+radius));
+ sixteenBaseVectorsOnOuterSquare.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(15), mid.x+radius, false));
}
void createDividingLines(){
if(parts == 12){
- createLine(outerSquareVectors.get(0), outerSquareVectors.get(6));
- createLine(outerSquareVectors.get(1), outerSquareVectors.get(7));
- createLine(outerSquareVectors.get(2), outerSquareVectors.get(8));
- createLine(outerSquareVectors.get(3), outerSquareVectors.get(9));
- createLine(outerSquareVectors.get(4), outerSquareVectors.get(10));
- createLine(outerSquareVectors.get(5), outerSquareVectors.get(11));
+ createLine(twelveBaseVectorsOnOuterSquare.get(0), twelveBaseVectorsOnOuterSquare.get(6));
+ createLine(twelveBaseVectorsOnOuterSquare.get(1), twelveBaseVectorsOnOuterSquare.get(7));
+ createLine(twelveBaseVectorsOnOuterSquare.get(2), twelveBaseVectorsOnOuterSquare.get(8));
+ createLine(twelveBaseVectorsOnOuterSquare.get(3), twelveBaseVectorsOnOuterSquare.get(9));
+ createLine(twelveBaseVectorsOnOuterSquare.get(4), twelveBaseVectorsOnOuterSquare.get(10));
+ createLine(twelveBaseVectorsOnOuterSquare.get(5), twelveBaseVectorsOnOuterSquare.get(11));
}else if (parts == 16){
- createLine(outerSquareVectorsSixteen.get(0), outerSquareVectorsSixteen.get(8));
- createLine(outerSquareVectorsSixteen.get(1), outerSquareVectorsSixteen.get(9));
- createLine(outerSquareVectorsSixteen.get(2), outerSquareVectorsSixteen.get(10));
- createLine(outerSquareVectorsSixteen.get(3), outerSquareVectorsSixteen.get(11));
- createLine(outerSquareVectorsSixteen.get(4), outerSquareVectorsSixteen.get(12));
- createLine(outerSquareVectorsSixteen.get(5), outerSquareVectorsSixteen.get(13));
- createLine(outerSquareVectorsSixteen.get(6), outerSquareVectorsSixteen.get(14));
- createLine(outerSquareVectorsSixteen.get(7), outerSquareVectorsSixteen.get(15));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(0), sixteenBaseVectorsOnOuterSquare.get(8));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(1), sixteenBaseVectorsOnOuterSquare.get(9));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(2), sixteenBaseVectorsOnOuterSquare.get(10));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(3), sixteenBaseVectorsOnOuterSquare.get(11));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(4), sixteenBaseVectorsOnOuterSquare.get(12));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(5), sixteenBaseVectorsOnOuterSquare.get(13));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(6), sixteenBaseVectorsOnOuterSquare.get(14));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(7), sixteenBaseVectorsOnOuterSquare.get(15));
}
}
void createDividingConstructionLines(){
if(parts == 12){
- createLine(outerSquareVectors.get(0), outerSquareVectors.get(6));
- createLine(outerSquareVectors.get(1), outerSquareVectors.get(7));
- createLine(outerSquareVectors.get(2), outerSquareVectors.get(8));
- createLine(outerSquareVectors.get(3), outerSquareVectors.get(9));
- createLine(outerSquareVectors.get(4), outerSquareVectors.get(10));
- createLine(outerSquareVectors.get(5), outerSquareVectors.get(11));
+ createLine(twelveBaseVectorsOnOuterSquare.get(0), twelveBaseVectorsOnOuterSquare.get(6));
+ createLine(twelveBaseVectorsOnOuterSquare.get(1), twelveBaseVectorsOnOuterSquare.get(7));
+ createLine(twelveBaseVectorsOnOuterSquare.get(2), twelveBaseVectorsOnOuterSquare.get(8));
+ createLine(twelveBaseVectorsOnOuterSquare.get(3), twelveBaseVectorsOnOuterSquare.get(9));
+ createLine(twelveBaseVectorsOnOuterSquare.get(4), twelveBaseVectorsOnOuterSquare.get(10));
+ createLine(twelveBaseVectorsOnOuterSquare.get(5), twelveBaseVectorsOnOuterSquare.get(11));
}else if (parts == 16){
- createLine(outerSquareVectorsSixteen.get(0), outerSquareVectorsSixteen.get(8));
- createLine(outerSquareVectorsSixteen.get(1), outerSquareVectorsSixteen.get(9));
- createLine(outerSquareVectorsSixteen.get(2), outerSquareVectorsSixteen.get(10));
- createLine(outerSquareVectorsSixteen.get(3), outerSquareVectorsSixteen.get(11));
- createLine(outerSquareVectorsSixteen.get(4), outerSquareVectorsSixteen.get(12));
- createLine(outerSquareVectorsSixteen.get(5), outerSquareVectorsSixteen.get(13));
- createLine(outerSquareVectorsSixteen.get(6), outerSquareVectorsSixteen.get(14));
- createLine(outerSquareVectorsSixteen.get(7), outerSquareVectorsSixteen.get(15));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(0), sixteenBaseVectorsOnOuterSquare.get(8));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(1), sixteenBaseVectorsOnOuterSquare.get(9));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(2), sixteenBaseVectorsOnOuterSquare.get(10));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(3), sixteenBaseVectorsOnOuterSquare.get(11));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(4), sixteenBaseVectorsOnOuterSquare.get(12));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(5), sixteenBaseVectorsOnOuterSquare.get(13));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(6), sixteenBaseVectorsOnOuterSquare.get(14));
+ createLine(sixteenBaseVectorsOnOuterSquare.get(7), sixteenBaseVectorsOnOuterSquare.get(15));
}
}
- void display() {
- super.display();
- createOuterSquare();
- createDividingLines();
- }
-
void displayConstructionLines(){
super.displayConstructionLines();
+ createOuterSquare();
createDiagonalConstructionLinesOnOuterSquare();
+ createDividingLines();
if (parts == 16){
createInnerSquare();
createInnerSquareTilted(45);