# Incorrect points positions

**URL:** <https://discourse.processing.org/t/incorrect-points-positions/6754>\
**Category:** Coding Questions\
**Created:** [December 19, 2018, 10:29am UTC](https://discourse.processing.org/t/incorrect-points-positions/6754 "2018-12-19T10:29:01Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [December 19, 2018, 10:29am UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/1 "2018-12-19T10:29:02Z")

</div>

i am trying to make Graph,its almost done…last thing i need to fix,is points positions…i completely dont know why they placing like that…any ideas?

 ![Screenshot_489](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/34acce135131cd3ad4f85d19256542d8217bd7ee.png)  
Graph.pde:

```auto
ArrayList<Float> arr = new ArrayList<Float>();
GraphView graph = new GraphView(0,0,450,300,arr);

void setup() {
  size(600,600);
  graph.add(20);
  graph.add(10);
  graph.add(40);
  graph.add(10);
  graph.add(20);
  graph.add(10);
  graph.add(4);
  graph.add(1);
  graph.add(40);
  graph.add(32);
  graph.draw();
  image(graph.rendered,0,0);
}

void draw() {
  graph.onHoverCycle();
}

```

GraphView.pde:

```auto
import java.util.*;

class GraphView {
  public PGraphics rendered;
  public float width;
  public float height;
  public float x;
  public float y;
  public ArrayList<Float> arr = new ArrayList<Float>();
  private ArrayList<PVector> value_coords = new ArrayList<PVector>();
  private ArrayList<PVector> value_data = new ArrayList<PVector>();
  private ArrayList<Integer> vertical = new ArrayList<Integer>();
  private ArrayList<PVector> vert_coords = new ArrayList<PVector>();
  private ArrayList<Integer> horizontal = new ArrayList<Integer>();
  private ArrayList<PVector> horiz_coords = new ArrayList<PVector>();
  private int textsize = 0;
  private int textoffset = 5;
  protected boolean cycleready = false;
  public GraphView(float x,float y,float width,float height,ArrayList<Float> arr) {
    this.width = width;
    this.height = height;
    this.x = x;
    this.y = y;
    this.arr = arr;
    vertical.add(0);
    vertical.add(1);
  }
  public void add(float value) {
    arr.add(value);
    if(!isNull(horizontal,horizontal.size()-1)) {
      if(horizontal.size()<width/((textsize+textoffset)*horizontal.size())) {
        horizontal.add(horizontal.get(horizontal.size()-1)+1);
      } else {
        throw new IndexOutOfBoundsException("This version of code does not support that much values!size up your Graph Width or add less values!Seems like this Graph support only "+horizontal.size()+" values!"); 
      }
    } else {
      horizontal.add(1);
    }
    if(vertical.get(0)<value) {
      int size;
      if(value>=5) {
        size = 5;
      } else {
        size = (int)value;
      }
      vertical = split(size,(int)value);
    }
    value_data.add(new PVector(value,horizontal.get(horizontal.size()-1)));
    vert_coords = new ArrayList<PVector>();
    horiz_coords = new ArrayList<PVector>();
    value_coords = new ArrayList<PVector>();
    for(int i = 1;i < vertical.size()+1;i++) {
      vert_coords.add(new PVector(0,i*((this.height-textoffset)/vertical.size())-textsize/2));
    }
    for(int i = 1;i < horizontal.size();i++) {
      if(!isNull(horizontal,i-1)) {
        horiz_coords.add(new PVector(i*((this.width-textsize/textoffset)/horizontal.size()),this.height+textsize-textoffset));
      }
    }
    for(int i = 1;i<arr.size();i++) {
      if(horiz_coords.size()>0) {
        value_coords.add(new PVector(horiz_coords.get(i-1).x,compare(vertical,vert_coords,arr.get(i-1))));
      }
      if(i >= horiz_coords.size()) {
        value_coords.add(new PVector(horiz_coords.get(horiz_coords.size()-1).x,compare(vertical,vert_coords,value)));
      }
    }
  }
  public void print() {
    println("---DEBUG INFO---");
    println("Graph Name:"+this);
    println("Graph Coordinates:"+this.x+" "+this.y);
    println("Graph Dimensions:"+this.width+" "+this.height);
    println("Values Coordinates:"+PVectorArrayToString(value_coords));
    println("Values Data:"+PVectorArrayToString(value_data));
    println("Lines Coordinates:"+PVectorArrayToString(vert_coords));
    println("Collumns Coordinates:"+PVectorArrayToString(horiz_coords));
    println("Values:"+arr.toString());
    println("Lines:"+vertical.toString());
    println("Collumns:"+horizontal.toString());
    println("---DEBUG INFO---");
  }
  public void draw() {
    textsize = (int)(this.height/vertical.size()-textoffset*2);
    rendered = createGraphics((int)(this.width+textsize+textoffset),(int)(this.height+textsize+textoffset));
    rendered.beginDraw();
    rendered.rect(x+textsize+textoffset*2,y,x+this.width,y+this.height);
    for(int i = 1;i < vertical.size()+1;i++) {
      rendered.textSize(textsize);
      rendered.fill(0);
      rendered.text(vertical.get(i-1).toString(),0,i*((this.height-textoffset)/vertical.size()));
      rendered.stroke(200);
      rendered.line(x+textsize+textoffset*2,i*((this.height-textoffset)/vertical.size())-textsize/2,x+textsize+textoffset*2+this.width,i*((this.height-PI)/vertical.size())-textsize/2);
      vert_coords.add(new PVector(0,i*((this.height-textoffset)/vertical.size())-textsize/2));
    }
    for(int i = 1;i < horizontal.size()+1;i++) {
      rendered.textSize(textsize);
      rendered.fill(0);
      if(!isNull(horizontal,i-1)) {
        rendered.text(horizontal.get(i-1).toString(),i*((this.width-textsize/textoffset)/horizontal.size()),this.height+textsize-textoffset);
      }
    }
    for(int i = 1;i < value_coords.size()+1;i++) {
      if(!isNull(value_coords,i)) {
        rendered.stroke(0,255,0);
        rendered.strokeWeight(3);
        rendered.line(value_coords.get(i).x+10,value_coords.get(i).y+10,value_coords.get(i-1).x+10,value_coords.get(i-1).y+10);
      }
    }
    for(int i = 1;i < value_coords.size()+1;i++) {
      rendered.fill(0,255,0);
      rendered.strokeWeight(1);
      rendered.stroke(0);
      rendered.rect(value_coords.get(i-1).x+5,value_coords.get(i-1).y+5,10,10,25,25,25,25);
    }
    rendered.endDraw();
    cycleready = true;
    this.print();
  }
  public void onHoverCycle() {
    if(cycleready) {
      PGraphics graphic = createGraphics((int)this.width,(int)this.height);
      graphic.beginDraw();
      //graphic.rect(mouseX-25,mouseY-25,50,50);
      for(int i = 0;i < value_coords.size();i++) {
        PVector vec = (PVector)value_coords.get(i);
        if(mouseX<vec.x+15&&mouseX>vec.x+5&&mouseY<vec.y+15&&mouseY>vec.y+5) {
          image(rendered,x,y);
          String str = "Line:"+(int)value_data.get(i).x+" Collumn:"+(int)value_data.get(i).y;
          graphic.fill(0,0,0,127);
          float val = ((textsize/3.5)*str.length()+width/10)/1.75;
          float val2 = textsize+textoffset;
          if(vec.x+val-width/(width/val*PI)<width) {
            graphic.rect(vec.x-3-val2,vec.y,val,height/15,25,25,25,25);
            graphic.textSize(textsize/3.5);
            graphic.fill(255);
            graphic.text(str,vec.x+27-val2-(str.length()/textsize+textoffset),vec.y+15);
          } else {
            graphic.rect(vec.x+25-val2,vec.y,-val,height/15,25,25,25,25);
            graphic.textSize(textsize/3.5);
            graphic.fill(255);
            graphic.text(str,vec.x+5-(5*str.length()+width/10)-val2-(str.length()/textsize+textoffset),vec.y+15);
          }
          graphic.fill(0,255,255);
          graphic.rect(vec.x+5-val2,vec.y+5,10,10,25,25,25,25);
        } else {
          image(rendered,x,y);
        }
      }
      graphic.endDraw();
      image(graphic,x+textsize+textoffset,y);
    }
  }
  private ArrayList<Integer> split(int size,int val) {
    ArrayList<Integer> ret = new ArrayList<Integer>();
      for(int i = 1;i < size+1;i++) {
        ret.add(val*i/size);
      }
      Collections.reverse(ret);
      return ret;
  }
  private boolean isNull(ArrayList arr,int index) {
    boolean ret = false;
    try {
      Object obj = (Object)arr.get(index);
    } catch(NullPointerException e){
      ret = true;
    } catch(IndexOutOfBoundsException e2) {
      ret = true;
    }
    return ret;
  }
  public String PVectorArrayToString(ArrayList<PVector> arr) {
    final StringBuilder str = new StringBuilder();
    str.append("[");
    for(int i = 0;i < arr.size();i++) {
      str.append("(");
      str.append(String.valueOf(arr.get(i).x));
      str.append(",");
      str.append(String.valueOf(arr.get(i).y));
      str.append(")");
      if(!(i>=arr.size()-1)) {
        str.append(", ");
      }
    }
    str.append("]");
    return str.toString();
  }
  private float compareTo(float to,float from, float max) {
    return from/max*to;
  }
  private float compare(ArrayList<Integer> arr,ArrayList<PVector> arr1,float value) {
    float comp = 0;
    for(int j = 1;j<arr.size();j++) {
      if(value>arr.get(j)&&value<=arr.get(j-1)) {
          comp = compareTo(arr.get(j-1),arr1.get(j).y,arr1.get(j-1).y);
      }
    }
    return comp;
  }
}

```

UPD:coordinates for points are setting up in method add()

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 19, 2018, 12:46pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/2 "2018-12-19T12:46:26Z")

</div>

i play with

```auto
void setup() {
  size(700,600);
  graph.add(1);
  graph.add(2);
  graph.add(3);
  graph.add(4);
  graph.add(5);
  graph.add(6);
  graph.add(7);
  graph.add(8);
  graph.add(9);
  graph.add(10.0);
  graph.draw();
  image(graph.rendered,0,0);
}

```

get a graph

 ![2018-12-19_19-36-22_snap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1ae1f1898424f11f273ad7bafad5a57f85fc9bef.png)

```auto
        value_coords.add(new PVector(horiz_coords.get(i-1).x,compare(vertical,vert_coords,arr.get(i-1))));
        println("i "+i+" horiz_coords.get(i-1).x "+horiz_coords.get(i-1).x+" arr.get(i-1) "+arr.get(i-1)+" compare(vertical,vert_coords,arr.get(i-1)) "+compare(vertical,vert_coords,arr.get(i-1)));

```

and see

```auto
i 1 horiz_coords.get(i-1).x 60.0 arr.get(i-1) 1.0 compare(vertical,vert_coords,arr.get(i-1)) 0.0
i 2 horiz_coords.get(i-1).x 120.0 arr.get(i-1) 2.0 compare(vertical,vert_coords,arr.get(i-1)) 0.0
i 3 horiz_coords.get(i-1).x 180.0 arr.get(i-1) 3.0 compare(vertical,vert_coords,arr.get(i-1)) 5.0
i 4 horiz_coords.get(i-1).x 240.0 arr.get(i-1) 4.0 compare(vertical,vert_coords,arr.get(i-1)) 5.0
i 5 horiz_coords.get(i-1).x 300.0 arr.get(i-1) 5.0 compare(vertical,vert_coords,arr.get(i-1)) 8.0
i 6 horiz_coords.get(i-1).x 360.0 arr.get(i-1) 6.0 compare(vertical,vert_coords,arr.get(i-1)) 8.0
i 7 horiz_coords.get(i-1).x 420.0 arr.get(i-1) 7.0 compare(vertical,vert_coords,arr.get(i-1)) 12.0
i 8 horiz_coords.get(i-1).x 480.0 arr.get(i-1) 8.0 compare(vertical,vert_coords,arr.get(i-1)) 12.0
i 9 horiz_coords.get(i-1).x 540.0 arr.get(i-1) 9.0 compare(vertical,vert_coords,arr.get(i-1)) 20.0

```

so that compare() statement should map the values to  
360 - value(i)\*?range?

where you find that function? compare(a,b,c) ?  
java knows a “compare(a, b)”  
possibly change to

> map(value[i],0,valuemax,360,0)

---

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [December 19, 2018, 3:39pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/3 "2018-12-19T15:39:44Z")

</div>

@kll  
why 360 -…?  
why value[i]?value is float,not array…if you mean value from array so im using arr.get(i)…  
how to use map?i tried,but result the same as i tried to fix(flat line on x axis)…

---

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [December 19, 2018, 3:50pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/4 "2018-12-19T15:50:39Z")

</div>

@kll i found that compareTo(int a,int b,int c) in…uhh…my friend said that would work…and that worked,but a bit strange…pattern of points is right…but inverted…less value = point goes up,higher value = point goes down…but Y coordinates in fact are not right…

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 19, 2018, 11:06pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/5 "2018-12-19T23:06:24Z")

</div>

yes, i must admit that that compare does something,  
but the point position is very wrong.  
and add there are loop errors. like play with one point only.

looks like that is not your code anyhow,  
ask the one who made that code for help,  
if you not want to program a graph from scratch yourself  
i could recommend using a library, like  
install / import

**\> graphica**  
[https://jagracar.com/grafica.php](https://jagracar.com/grafica.php)  
example already using your data:

```auto

import grafica.*;

void setup() {
  size(500, 350);
  background(200,200,0);

  int nPoints = 10;
  GPointsArray points = new GPointsArray(nPoints);

// for (int i = 0; i < nPoints; i++) {
// points.add(i, 10*noise(0.1*i));
// }
  points.add(0, 20);
  points.add(1, 10);
  points.add(2, 40);
  points.add(3, 10);
  points.add(4, 20);
  points.add(5, 10);
  points.add(6, 4);
  points.add(7, 1);
  points.add(8, 40);
  points.add(9, 32);
  // Create a new plot and set its position on the screen
  GPlot plot = new GPlot(this);
  plot.setPos(25, 25);
  // or all in one go
  // GPlot plot = new GPlot(this, 25, 25);

  // Set the plot title and the axis labels
  plot.setTitleText("A very simple example");
  plot.getXAxis().setAxisLabelText("x axis");
  plot.getYAxis().setAxisLabelText("y axis");

  // Add the points
  plot.setPoints(points);

  // Draw it!
  plot.defaultDraw();
}

```

![2018-12-20_06-14-29_snap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/908ed679eec655fc889b8223428dacae450ff3ef.png)

---

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [December 20, 2018, 7:25am UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/6 "2018-12-20T07:25:30Z")

</div>

Wha…not my code?why did you think that?i making that thing 4 days without watching open sources of any libs…

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 20, 2018, 8:22am UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/7 "2018-12-20T08:22:44Z")

</div>

ok, so back to your compare function:

you send in 3 parameter, the “value” is the third  
and you use it in

> if(value\>arr.get(j)&&value\<=arr.get(j-1)) {

but not send it into

> comp = compareTo(arr.get(j-1),arr1.get(j).y,arr1.get(j-1).y);

so the resulting y position has not much to do with the “value”

pls note, the “arr” what you use inside the compare function  
is a local “arr”, NOT the “arr” from main what contains your list of “values”  
it is actually

> vertical

array what you are handing down into this function

possibly change that naming so you not get confused.

and to show you what i ref to at the first post,  
i try like this, i know range is not correct… just first step.

```auto
  private float compare(ArrayList<Integer> arr0,ArrayList<PVector> arr1,float value) {
    float comp = 0;
// for(int j = 1;j<arr0.size();j++) {
// if(value>arr0.get(j)&&value<=arr0.get(j-1)) {
// comp = compareTo(arr0.get(j-1),arr1.get(j).y,arr1.get(j-1).y);
// }
// }
    float span = (height-vert_coords.get(0).y)/vertical.get(0);
    comp = height-value*span;
    //println("compare_value "+value+" compare_comp "+comp);
    return comp;
  }

```

---

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [December 21, 2018, 1:00pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/8 "2018-12-21T13:00:44Z")

</div>

i think im dping something wrong…but thats resunlting me a perfect straight line…

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 21, 2018, 1:07pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/9 "2018-12-21T13:07:49Z")

</div>

![2018-12-21_20-05-28_snap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9589ff758d143bbdce7fce5cd383adfccad786d6.png)

that is how it looks here, but we both might have very different versions of you original code by now,  
so why you not just post it again.

but anyhow, could you follow my argumentation that your original function  
compare(a,b,value)  
//does  
comp = compareTo(arr.get(j-1),arr1.get(j).y,arr1.get(j-1).y);  
so not use value to calculate the result **comp**

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [December 21, 2018, 1:10pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/10 "2018-12-21T13:10:29Z")

</div>

In your Original Code, the values are displayed correctly, but upside down. You just Need to Display it by subtracting the values from the Target yOffset. You can Check that by adding values until one is at what your Graph shows as 0. So that-value will Display ist correctly.

(Edit : and that last point doesn‘t get the right xOffset… i don‘t know why though…)

Additional Note : your really should make your Code more readable. It is also way too complicated for what it does (at least for what i think it should do).

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 21, 2018, 1:53pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/11 "2018-12-21T13:53:17Z")

</div>

> [@Lexyth](#):
>
> the values are displayed correctly, but upside down

play little bit, only for a view seconds, like use other numbers

 ![2018-12-21_20-49-00_snap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b5e8e8e05024a1b52060ad5f59a2837b783f574d.png)  
that is what i am talking about for days.  
the value is only used to be mapped ( by a if(value…) ) to some array of gridlines  
and then, as you say, wrongly drawn top down.

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 25, 2018, 7:20pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/12 "2018-12-25T19:20:09Z")

</div>

i did an easier version of it, just make some changes to get it like urs

 ![GrapthPic](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/072be343f1ef43391103cb8581eb639ba43bd947.png)  
code:

```auto
float points[] = {10,20,30,40,50,60,70,80,90,0}; //values
int pl = points.length;
int min = 0,max = 100,valueCount = 10; //min and max value of points[], how many vertical values u want
float w,h; //just some stuff to keep things away from edges
void setup() {
  size(600,600);
  w = width * 0.1;
  h = height* 0.1;
}
void draw() {
  background(0);
  stroke(255);
  noFill();
  rect(w,h,w*8,h*8);
  for(int i = 0; i < pl; i++) { //drawing points and lines
    stroke(0,255,0);
    strokeWeight(10);
    point(map(i,0,pl,w,width-w),map(points[i],max,min,h,h*9));
    strokeWeight(2);
    line(map(i,0,pl,w,width-w),map(points[i],max,min,h,h*9),map((i+1 < pl)? i+1:i,0,pl,w,width-w),map(points[(i+1 < pl)? i+1 : i],max,min,h,h*9));
  }
  textAlign(3,3); //text stuff
  textSize(15);
  stroke(255);
  strokeWeight(1);
  for(int i = 0; i < valueCount+1; i++) { //verical text
    text(floor(map(i,0,valueCount,min,max)) + "",w*0.6,map(i,0,valueCount,height - h,h));
    line(w*0.8,map(i,0,valueCount,height - h,h),w*0.9,map(i,0,valueCount,height - h,h));
  }
  for(int i = 0; i < pl; i++) { //horizontal text
    text((i+1) + "",map(i,0,pl,w,width-w),height-h*0.9);
  }
  noLoop();
}

```

i know its not the best, but i hope that does the trick

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 25, 2018, 7:21pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/13 "2018-12-25T19:21:07Z")

</div>

oh and if u can change it by setting few values diffrently. (i hope u can get it by code)

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 25, 2018, 7:26pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/14 "2018-12-25T19:26:15Z")

</div>

and it does map all the values  
(and i hope its compatible with all widths and heights, i tested 600,600 and 600,900, but i dont know if others work)  
and u dont need to change how many points u have, just change: float points[] = {…};

---

<div class="post-metadata">

**Author:** ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)\
**Post date:** [December 25, 2018, 8:19pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/15 "2018-12-25T20:19:48Z")

</div>

Quick tip: Put `surface.setResizable(true);` in `void setup()` to make the window resizable, to be able to check the compatibility easily.

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 25, 2018, 9:27pm UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/16 "2018-12-25T21:27:50Z")

</div>

I know, but I was in a sort of rush(idk why) so I didnt remember to do that. Or I could just di surface.setsize so I could do it inside of program with like 1 fps

---

<div class="post-metadata">

**Author:** ![Darkar25](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Darkar25](https://discourse.processing.org/u/Darkar25)\
**Post date:** [December 28, 2018, 4:15am UTC](https://discourse.processing.org/t/incorrect-points-positions/6754/17 "2018-12-28T04:15:17Z")

</div>

thanks,that helped me figure out the problem
