From 7c668a004375978213fa843bd78d26d48e0ed5b1 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sat, 2 Jan 2016 19:11:59 +0100 Subject: AutoVisual/IGPFamily.pde: Adding functions for setting stroke and fill colors. Updating createDiagonalConstructionLinesOnAlphaCircle() to use alphaCircleVectorsSixteen ArrayList. --- AutoVisual/IGPFamily.pde | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/AutoVisual/IGPFamily.pde b/AutoVisual/IGPFamily.pde index 9ee62cc..ff8d480 100644 --- a/AutoVisual/IGPFamily.pde +++ b/AutoVisual/IGPFamily.pde @@ -2,6 +2,10 @@ class IGPFamily { PVector mid; float diameter; float radius; + Float[] defaultFillColor = {0.0, 0.0, 0.0, 0.0}; + Float[] defaultStrokeColor = {0.66, 0.66, 0.66, 0.4}; + Float[] fillColor; + Float[] strokeColor; ArrayList alphaCircleVectors; ArrayList alphaCircleVectorsSixteen; ArrayList constructionCircleCenters; @@ -50,6 +54,32 @@ class IGPFamily { alphaCircleVectorsSixteen.add(getVectorOnAlphaCircle(337.5)); } + void setFillColor(Float[] fillColor){ + if (fillColor.length==4){ + this.fillColor = fillColor; + } + } + + void setStrokeColor(Float[] strokeColor){ + if (strokeColor.length==4){ + this.strokeColor = strokeColor; + } + } + + void useStrokeColor(){ + if(strokeColor.length!=4 || strokeColor == null){ + strokeColor = defaultStrokeColor; + } + stroke(strokeColor[0], strokeColor[1], strokeColor[2], strokeColor[3]); + } + + void useFillColor(){ + if(fillColor.length!=4 || fillColor == null){ + fillColor = defaultFillColor; + } + fill(fillColor[0], fillColor[1], fillColor[2], fillColor[3]); + } + PVector getVectorOnCircle(PVector mid, float degree){ PVector point = new PVector(mid.x + radius*cos(radians(degree)), mid.y + radius * sin(radians(degree))); return point; @@ -121,9 +151,8 @@ class IGPFamily { } void createDiagonalConstructionLinesOnAlphaCircle(){ - //TODO: use PVectors from ArrayList - createLine(getVectorOnAlphaCircle(45), getVectorOnAlphaCircle(225)); - createLine(getVectorOnAlphaCircle(135), getVectorOnAlphaCircle(315)); + createLine(alphaCircleVectorsSixteen.get(2), alphaCircleVectorsSixteen.get(10)); + createLine(alphaCircleVectorsSixteen.get(6), alphaCircleVectorsSixteen.get(14)); } void createInnerHexagon(){ -- cgit v1.2.3-70-g09d2