From b09631435bd5df7b202e03a8d596bd5943f1f69e Mon Sep 17 00:00:00 2001 From: Fisch Date: Mon, 10 Jun 2019 11:53:01 +0200 Subject: [PATCH] add graph --- hoverbrettvisualizer/Visualization.pde | 103 ++++++++++++++++++++++-- visualizationtest/Visualization.pde | 103 ++++++++++++++++++++++-- visualizationtest/visualizationtest.pde | 11 +-- 3 files changed, 202 insertions(+), 15 deletions(-) diff --git a/hoverbrettvisualizer/Visualization.pde b/hoverbrettvisualizer/Visualization.pde index 471c95b..1eb39a1 100644 --- a/hoverbrettvisualizer/Visualization.pde +++ b/hoverbrettvisualizer/Visualization.pde @@ -253,9 +253,9 @@ public class Tacho extends Visualization { public class Direction extends Visualization { int size; - + float angleoffset=0; - public Direction(int px, int py, int psize,float pvmin, float pvmax, float pvlmin, float pvlmax) { + public Direction(int px, int py, int psize,float pvmin, float pvmax, float pvlmin, float pvlmax, float pangleoffset) { super.valueMin=pvmin; super.valueMax=pvmax; super.posOrigin= new PVector(px,py); //center @@ -263,6 +263,8 @@ public class Direction extends Visualization { super.value2Min=pvlmin; super.value2Max=pvlmax; + + this.angleoffset=pangleoffset; } @@ -276,7 +278,7 @@ public class Direction extends Visualization { ellipse(super.posOrigin.x, super.posOrigin.y, this.size,this.size); stroke(super.cmain); - float angle=map(super.value,super.valueMin,super.valueMax,0,2*PI); + float angle=map(super.value,super.valueMin,super.valueMax,0,2*PI)+this.angleoffset; float _vecsize=this.size*( (super.value2-super.value2Min)/(super.value2Max-super.value2Min)); line(super.posOrigin.x,super.posOrigin.y,super.posOrigin.x+cos(angle)*_vecsize,super.posOrigin.y-sin(angle)*_vecsize); @@ -285,13 +287,104 @@ public class Direction extends Visualization { //text fill(super.ctext); - text("d="+super.getFormattedValue(super.value),super.posOrigin.x-super.getFormattedValue(super.value).length()*super.textWidthScale,super.posOrigin.y+super.textsize/2-this.size*0.3); + text(super.getFormattedValue(super.value),super.posOrigin.x-super.getFormattedValue(super.value).length()*super.textWidthScale,super.posOrigin.y+super.textsize/2-this.size*0.3); if (super.value2