# Problem when using curveVertex on a PShape

**URL:** <https://discourse.processing.org/t/problem-when-using-curvevertex-on-a-pshape/39319>\
**Category:** Processing\
**Created:** [October 17, 2022, 12:21pm UTC](https://discourse.processing.org/t/problem-when-using-curvevertex-on-a-pshape/39319 "2022-10-17T12:21:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrHooDoo](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@DrHooDoo](https://discourse.processing.org/u/DrHooDoo)\
**Post date:** [October 17, 2022, 12:21pm UTC](https://discourse.processing.org/t/problem-when-using-curvevertex-on-a-pshape/39319/1 "2022-10-17T12:21:57Z")

</div>

Hello processing community !

I’m trying to code a function to make a PShape that has the form of a blob.

My problem is that it doesn’t work with JAVA2D (default renderer) but it ok with P2D.

It seems to be bound to curveVertex because if I change it with vertex everything is OK (with both renders).

Has anyone an idea to solve this ? Thank you for reading me 😉

```auto
void setup() ;
  size(800, 800);
  noLoop();
  PShape blob;
  blob = createBlob( width/2,height/2,300,5);
  shape(blob,0,0);
}

PShape createBlob(int x0, int y0, int radius, int N) {
  PVector[] points = new PVector[N];
  PShape ps = createShape();

  for (int i=0; i<N; i++) {
    float tempRadius = random(radius/2, radius*3/2);
    float x =x0 + tempRadius*cos(i*TAU/N);
    float y =y0 + tempRadius*sin(i*TAU/N);
    points[i] = new PVector(x, y);
  }
  ps.beginShape();
  ps.fill(0);
  for (int i = 0; i < N; i++)
  {
    ps.curveVertex(points[i].x, points[i].y);
  }
  for (int i=0; i<3; i++)
    ps.curveVertex(points[i].x, points[i].y);

  ps.endShape(CLOSE);
  return ps;
}

```

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [October 17, 2022, 3:22pm UTC](https://discourse.processing.org/t/problem-when-using-curvevertex-on-a-pshape/39319/2 "2022-10-17T15:22:48Z")

</div>

Hi @DrHooDoo 🙂

You are right. It looks like `curveVertex()` doesn’t work properly with PShape in Java2D.

Here’s a previous thread on this topic that might be helpful:

> [@Why doesn't curveVertex work in this PShape](https://discourse.processing.org/t/why-doesnt-curvevertex-work-in-this-pshape/6263):
>
> I was looking at an example of creating a spiral on the old Processing forum, [drawing a spiral](https://processing.org/discourse/beta/num_1223582667.html) size(800,800); smooth(); translate(width/2,height/2); strokeWeight(2); beginShape(); for(int i=0;i\<350;i++) { curveVertex((i\*2)\*sin(i/5.0),(i\*2)\*cos(i/5.0)); } endShape(); I tried to recreate this in a PShape but curveVertex seems not to work when used this way, and I would like to know why. Is it just because PShape doesn’t like it for some reason? So in this example, the “green” one at the end …

Note: This is a known issue (with a “help wanted” tag by the way if someone feels like looking into it 😉)

> <https://github.com/processing/processing/issues/5173>
>
> Processing 3.3.5
> 
> The PDFs I'm saving consist of a squiggle shape made of curv…eVertex spline points. Something in this process does not carry over to the PDF export, which consists of straight lines as if I had only used the vertex function. 
> 
> Is this a pdf vector limitation or a problem on our end?
> 
> Thanks for any help on this.

---

<div class="post-metadata">

**Author:** ![DrHooDoo](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@DrHooDoo](https://discourse.processing.org/u/DrHooDoo)\
**Post date:** [October 17, 2022, 4:19pm UTC](https://discourse.processing.org/t/problem-when-using-curvevertex-on-a-pshape/39319/3 "2022-10-17T16:19:50Z")

</div>

Merci beaucoup ! 😉
