diff options
author | David Runge <dave@sleepmap.de> | 2015-12-30 19:52:45 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2015-12-30 19:52:45 +0100 |
commit | 40f70be0b2a2656cfb80ae7c6c060d2aec7ceb68 (patch) | |
tree | cb64fe6dc79e175a38c6a78745d8a34055435ccd /AutoVisual | |
parent | 33a44587ecf9c6b2287b460743207f856f811067 (diff) | |
download | processing-sketchbook-40f70be0b2a2656cfb80ae7c6c060d2aec7ceb68.tar.gz processing-sketchbook-40f70be0b2a2656cfb80ae7c6c060d2aec7ceb68.tar.bz2 processing-sketchbook-40f70be0b2a2656cfb80ae7c6c060d2aec7ceb68.tar.xz processing-sketchbook-40f70be0b2a2656cfb80ae7c6c060d2aec7ceb68.zip |
AutoVisual/IGPFamily.pde: Separating PVectors on alpha circle and mid points of construction circles.
Diffstat (limited to 'AutoVisual')
-rw-r--r-- | AutoVisual/IGPFamily.pde | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/AutoVisual/IGPFamily.pde b/AutoVisual/IGPFamily.pde index 3451d88..a130c64 100644 --- a/AutoVisual/IGPFamily.pde +++ b/AutoVisual/IGPFamily.pde @@ -1,37 +1,37 @@ class IGPFamily { - PVector mid; + PVector mid; float diameter; float radius; - ArrayList <PVector> alphaCircleVectors; - ArrayList <PVector> constructionCircleCenters; - ArrayList <PVector> constructionPartsTwelve; - ArrayList <PVector> constructionPartsSixteen; + ArrayList <PVector> alphaCircleVectors; + ArrayList <PVector> constructionCircleCenters; + ArrayList <PVector> constructionPartsTwelve; + ArrayList <PVector> constructionPartsSixteen; IGPFamily(float x, float y, float d){ ellipseMode(CENTER); colorMode(RGB, 1.0, 1.0, 1.0, 1.0); - mid = new PVector(x, y); + mid = new PVector(x, y); diameter = d; radius = d/2; - setVectorsOnAlphaCircle(); +// setVectorsOnAlphaCircle(); println("New IGP object: x="+mid.x+"/ y="+mid.y+"/ diameter="+diameter); } - - void setVectorsOnAlphaCircle(){ - constructionCircleCenters = new ArrayList <PVector> (6); - constructionCircleCenters.add(getVectorOnAlphaCircle(0)); - constructionCircleCenters.add(getVectorOnAlphaCircle(30)); - constructionCircleCenters.add(getVectorOnAlphaCircle(60)); - constructionCircleCenters.add(getVectorOnAlphaCircle(90)); - constructionCircleCenters.add(getVectorOnAlphaCircle(120)); - constructionCircleCenters.add(getVectorOnAlphaCircle(150)); - constructionCircleCenters.add(getVectorOnAlphaCircle(180)); - constructionCircleCenters.add(getVectorOnAlphaCircle(210)); - constructionCircleCenters.add(getVectorOnAlphaCircle(240)); - constructionCircleCenters.add(getVectorOnAlphaCircle(270)); - constructionCircleCenters.add(getVectorOnAlphaCircle(300)); - constructionCircleCenters.add(getVectorOnAlphaCircle(330)); - } + + void setVectorsOnAlphaCircle(){ + alphaCircleVectors = new ArrayList <PVector> (12); + alphaCircleVectors.add(getVectorOnAlphaCircle(0)); + alphaCircleVectors.add(getVectorOnAlphaCircle(30)); + alphaCircleVectors.add(getVectorOnAlphaCircle(60)); + alphaCircleVectors.add(getVectorOnAlphaCircle(90)); + alphaCircleVectors.add(getVectorOnAlphaCircle(120)); + alphaCircleVectors.add(getVectorOnAlphaCircle(150)); + alphaCircleVectors.add(getVectorOnAlphaCircle(180)); + alphaCircleVectors.add(getVectorOnAlphaCircle(210)); + alphaCircleVectors.add(getVectorOnAlphaCircle(240)); + alphaCircleVectors.add(getVectorOnAlphaCircle(270)); + alphaCircleVectors.add(getVectorOnAlphaCircle(300)); + alphaCircleVectors.add(getVectorOnAlphaCircle(330)); + } PVector getVectorOnCircle(PVector mid, float degree){ PVector point = new PVector(mid.x + radius*cos(radians(degree)), mid.y + radius * sin(radians(degree))); @@ -42,32 +42,32 @@ class IGPFamily { return getVectorOnCircle(mid, degree); } - void createSquare(PVector mid, float diameter){ + void createSquare(PVector mid, float diameter){ rect(mid.x, mid.y, diameter, diameter); - } + } - void createOuterSquare() { - stroke(0.66, 0.66, 0.66, 0.4); + void createOuterSquare() { + stroke(0.0, 0.0, 0.66, 0.4); rectMode(CENTER); - createSquare(mid, diameter); + createSquare(mid, diameter); } - void createInnerSquare() { + void createInnerSquare() { stroke(0.66, 0.66, 0.66, 0.4); rectMode(CENTER); - createSquare(mid, sqrt(sq(diameter)/2)); + createSquare(mid, sqrt(sq(diameter)/2)); } - void createInnerSquareTilted(float angle){ + void createInnerSquareTilted(float angle){ rectMode(CENTER); stroke(0.66, 0.66, 0.66, 0.4); - translate(mid.x, mid.y); - pushMatrix(); - rotate(radians(angle)); - createSquare(new PVector(0, 0), sqrt(sq(diameter)/2)); - popMatrix(); - translate(mid.x*(-1), mid.y*(-1)); - } + translate(mid.x, mid.y); + pushMatrix(); + rotate(radians(angle)); + createSquare(new PVector(0, 0), sqrt(sq(diameter)/2)); + popMatrix(); + translate(mid.x*(-1), mid.y*(-1)); + } void createCircle(PVector v) { ellipse(v.x, v.y, diameter, diameter); @@ -75,32 +75,34 @@ class IGPFamily { void createAlphaCircle() { stroke(1.0, 0.0, 0.0, 1.0); - createCircle(mid); + createCircle(mid); } - void createConstructionCircles(){ + void createConstructionCircles(){ stroke(0.66, 0.66, 0.66, 0.4); for (PVector constructionCircle : constructionCircleCenters) { createCircle(constructionCircle); } - } + } - void createLine(PVector from, PVector to){ - beginShape(LINES); - vertex(from.x, from.y); - vertex(to.x, to.y); - endShape(); - } + void createLine(PVector from, PVector to){ + beginShape(LINES); + vertex(from.x, from.y); + vertex(to.x, to.y); + endShape(); + } - void createVerticalHorizontalConstructionLines(){ - createLine(constructionCircleCenters.get(0), constructionCircleCenters.get(2)); - createLine(constructionCircleCenters.get(1), constructionCircleCenters.get(3)); - } + void createVerticalHorizontalConstructionLines(){ + //TODO: add for 16 parts + createLine(alphaCircleVectors.get(0), alphaCircleVectors.get(6)); + createLine(alphaCircleVectors.get(3), alphaCircleVectors.get(9)); + } - void createDiagonalConstructionLines(){ - createLine(new PVector(constructionCircleCenters.get(1).x-radius, constructionCircleCenters.get(2).y-radius), new PVector(constructionCircleCenters.get(3).x+radius, constructionCircleCenters.get(0).y+radius)); - createLine(new PVector(constructionCircleCenters.get(1).x+radius, constructionCircleCenters.get(0).y-radius), new PVector(constructionCircleCenters.get(3).x-radius, constructionCircleCenters.get(2).y+radius)); - } + void createDiagonalConstructionLines(){ + //TODO: add for 16 parts + createLine(new PVector(constructionCircleCenters.get(1).x-radius, constructionCircleCenters.get(2).y-radius), new PVector(constructionCircleCenters.get(3).x+radius, constructionCircleCenters.get(0).y+radius)); + createLine(new PVector(constructionCircleCenters.get(1).x+radius, constructionCircleCenters.get(0).y-radius), new PVector(constructionCircleCenters.get(3).x-radius, constructionCircleCenters.get(2).y+radius)); + } void display() { createAlphaCircle(); @@ -108,7 +110,7 @@ class IGPFamily { void displayConstructionLines() { stroke(0.66, 0.66, 0.66, 0.4); - createConstructionCircles(); + createConstructionCircles(); createVerticalHorizontalConstructionLines(); } |