diff options
author | David Runge <dave@sleepmap.de> | 2016-01-02 20:42:12 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2016-01-02 20:42:12 +0100 |
commit | 39aa624cb42e916f96c785b1a44a6e5fcc7ec590 (patch) | |
tree | 89cb7fc929f45f9018b3fb71fc0af96f6ec74094 | |
parent | d03513b9b223864c89916dd5edff3c97e571472e (diff) | |
download | processing-sketchbook-39aa624cb42e916f96c785b1a44a6e5fcc7ec590.tar.gz processing-sketchbook-39aa624cb42e916f96c785b1a44a6e5fcc7ec590.tar.bz2 processing-sketchbook-39aa624cb42e916f96c785b1a44a6e5fcc7ec590.tar.xz processing-sketchbook-39aa624cb42e916f96c785b1a44a6e5fcc7ec590.zip |
AutoVisual/IGP{Family,Square}.pde: Changing to more reasonable
get-methods (getLineIntersection(), getAngleBetweenTwoVectors(),
getVectorsOnExtendedLine()).
-rw-r--r-- | AutoVisual/IGPFamily.pde | 6 | ||||
-rw-r--r-- | AutoVisual/IGPSquare.pde | 32 |
2 files changed, 19 insertions, 19 deletions
diff --git a/AutoVisual/IGPFamily.pde b/AutoVisual/IGPFamily.pde index ac7d4cc..0651ceb 100644 --- a/AutoVisual/IGPFamily.pde +++ b/AutoVisual/IGPFamily.pde @@ -213,7 +213,7 @@ class IGPFamily { translate(mid.x*(-1), mid.y*(-1)); } - PVector lineIntersection(PVector p1, PVector p2, PVector p3, PVector p4) { + PVector getLineIntersection(PVector p1, PVector p2, PVector p3, PVector p4) { PVector b = PVector.sub(p2, p1); PVector d = PVector.sub(p4, p3); @@ -231,7 +231,7 @@ class IGPFamily { return new PVector(p1.x+t*b.x, p1.y+t*b.y); } - float angleBetweenTwoVectors (PVector p1, PVector p2) { + float getAngleBetweenTwoVectors (PVector p1, PVector p2) { float angle = atan2(p1.y-p2.y, p1.x-p2.x); if (angle < 0) { angle+=TWO_PI; @@ -239,7 +239,7 @@ class IGPFamily { return degrees(angle); } - PVector extendLine(PVector startPoint, PVector endPoint, float boundary, boolean vertical){ + PVector getVectorOnExtendedLine(PVector startPoint, PVector endPoint, float boundary, boolean vertical){ float m,n; m = (endPoint.y-startPoint.y)/(endPoint.x-startPoint.x); n = endPoint.y-m*endPoint.x; diff --git a/AutoVisual/IGPSquare.pde b/AutoVisual/IGPSquare.pde index 5ad0823..e77368d 100644 --- a/AutoVisual/IGPSquare.pde +++ b/AutoVisual/IGPSquare.pde @@ -21,35 +21,35 @@ class IGPSquare extends IGPFamily { int amount = 12; outerSquareVectors = new ArrayList <PVector>(12); outerSquareVectors.add(alphaCircleVectors.get(0)); - outerSquareVectors.add(extendLine(mid, alphaCircleVectors.get(1), mid.x+radius, false)); - outerSquareVectors.add(extendLine(mid, alphaCircleVectors.get(2), mid.y-radius, true)); + 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(extendLine(mid, alphaCircleVectors.get(4), mid.y-radius, true)); - outerSquareVectors.add(extendLine(mid, alphaCircleVectors.get(5), mid.x-radius, false)); + 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(extendLine(mid, alphaCircleVectors.get(7), mid.x-radius, false)); - outerSquareVectors.add(extendLine(mid, alphaCircleVectors.get(8), mid.y+radius, true)); + 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(extendLine(mid, alphaCircleVectors.get(10), mid.y+radius, true)); - outerSquareVectors.add(extendLine(mid, alphaCircleVectors.get(11), mid.x+radius, false)); + 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(extendLine(mid, alphaCircleVectorsSixteen.get(1), mid.x+radius, false)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(1), mid.x+radius, false)); outerSquareVectorsSixteen.add(new PVector(mid.x+radius, mid.y-radius)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(3), mid.y-radius, true)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(3), mid.y-radius, true)); outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(4)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(5), mid.y-radius, true)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(5), mid.y-radius, true)); outerSquareVectorsSixteen.add(new PVector(mid.x-radius, mid.y-radius)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(7), mid.x-radius, false)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(7), mid.x-radius, false)); outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(8)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(9), mid.x-radius, false)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(9), mid.x-radius, false)); outerSquareVectorsSixteen.add(new PVector(mid.x-radius, mid.y+radius)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(11), mid.y+radius, true)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(11), mid.y+radius, true)); outerSquareVectorsSixteen.add(alphaCircleVectorsSixteen.get(12)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(13), mid.y+radius, true)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(13), mid.y+radius, true)); outerSquareVectorsSixteen.add(new PVector(mid.x+radius, mid.y+radius)); - outerSquareVectorsSixteen.add(extendLine(mid, alphaCircleVectorsSixteen.get(15), mid.x+radius, false)); + outerSquareVectorsSixteen.add(getVectorOnExtendedLine(mid, alphaCircleVectorsSixteen.get(15), mid.x+radius, false)); } void createDividingLines(){ |