From 39aa624cb42e916f96c785b1a44a6e5fcc7ec590 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sat, 2 Jan 2016 20:42:12 +0100 Subject: AutoVisual/IGP{Family,Square}.pde: Changing to more reasonable get-methods (getLineIntersection(), getAngleBetweenTwoVectors(), getVectorsOnExtendedLine()). --- AutoVisual/IGPFamily.pde | 6 +++--- 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 (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 (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(){ -- cgit v1.2.3-70-g09d2