# How to connect points with curveVertices?

**URL:** <https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719>\
**Category:** Coding Questions\
**Created:** [February 10, 2021, 10:59pm UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719 "2021-02-10T22:59:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tea\_tree](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Post date:** [February 10, 2021, 10:59pm UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719/1 "2021-02-10T22:59:14Z")

</div>

I’m working on a project where I’m trying to connect points with curveVertex. I’m struggling to do that because I don’t know how to tell processing how to group values.

I’m using the following raw data

```auto
item class date
1 1 2020-01-01
1 1 2020-01-20
1 1 2020-02-01
2 3 2020-01-05
2 2 2020-01-31
2 2 2020-02-24
...

```

I use the following code to map the values in 3-dimensions (I’m just showing the relevant parts):

```auto
void draw(){
  background(100);
  
  //Draw points
    for(int i=0; i<my_class.size(); i++){
    float dateaxis = map(dateParser(my_class.get(i).date), 0, 3650, -50, 50);
    float itemaxis = map(parseFloat(my_class.get(i).item), 70000, 7200000, -50, 50);
    float classaxis = map(parseFloat(my_class.get(i).class), 0, 999, -50, 50);
    color c = colorpicker(my_class.get(i).class); //colorpicker picks a color based on its value
    pushMatrix();
    translate(dateaxis, itemaxis, classaxis);
    strokeWeight(2);
    stroke(c);
    point(0,0,0);
    popMatrix();
    }
}

```

So now that these points are drawn, how could I connect them with a curvevertex? Specifically, how can I connect the items with a line across time and class? I’m looking for each item-date combination to be a dot whose location depends on item, date, and class and whose color depends on class (this much I’ve achieved already). Now for every item, I’m trying to connect each dot with each other.

I hope this makes sense. Thank you!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 10, 2021, 11:10pm UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719/2 "2021-02-10T23:10:05Z")

</div>

Did you read the reference for curvevertex?

---

<div class="post-metadata">

**Author:** ![tea\_tree](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Post date:** [February 10, 2021, 11:13pm UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719/3 "2021-02-10T23:13:42Z")

</div>

Yes, I think what I’m struggling with is how to feed the coordinates into it. I’m a bit confused because, at the end of the loop shown above, the local variables have disappeared. But I can’t make them into global variables because they have to be inside the loop.

---

<div class="post-metadata">

**Author:** ![tea\_tree](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Post date:** [February 11, 2021, 1:09am UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719/4 "2021-02-11T01:09:56Z")

</div>

I’m not sure why my question was moved from beginners to Coding Questions, since I’m clearly a beginner…

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [February 11, 2021, 6:52am UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719/5 "2021-02-11T06:52:15Z")

</div>

Just say beginShape(); before the for loop

In the for loop curvevertex with 3 parameters

after it endShape();

see [curveVertex() \ Language (API) \ Processing 3+](https://processing.org/reference/curveVertex_.html)
