P5.js: curveVertex() with endshape(CLOSE) does not close with a curve

Created on 1 Dec 2018  路  8Comments  路  Source: processing/p5.js

Nature of issue?

  • [x] Found a bug
  • [ ] Existing feature enhancement
  • [x] New feature request

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [x] Core/Environment/Rendering
  • [ ] Data
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [ ] Other (specify if possible)

Which platform were you using when you encountered this?

  • [ ] Mobile/Tablet (touch devices)
  • [x] Desktop/Laptop
  • [ ] Others (specify if possible)

Details about the bug:

  • p5.js version: 0.7.2
  • Web browser and version: Firefox: Version 62.0
  • Operating System: MacOSX
  • Steps to reproduce this:
function draw() {
  curvyPolygon(6, 100,100, 50)
}


function curvyPolygon( n, xPOS, yPOS, r) {
  let angle = 360.0 / n;

  beginShape();
  for (let i = 0; i < n; i++) {
    curveVertex(xPOS + r  * cos(radians(angle * i)),
      yPOS + r   * sin(radians(angle * i)));
  }

  endShape(CLOSE);

}

When utilizing curveVertex() with endshape(CLOSE), the behavior is to draw a straight line to the close the shape. My expected behavior would be to have a curve complete the shape. Does anyone else feel this way? is this something that should be addressed? This has also been mentioned in #408

Most helpful comment

I don't think this issue can be closed yet. While the issue of shapes constructed with curved vertexes is not being closed when using endShape(CLOSE) is resolved, it closes it using a straight line as if the shape begun and ended with a normal vertex. This issue should be reopened until this is resolved. I for one would really like to see this working.

All 8 comments

screen shot 2018-12-01 at 5 17 49 pm

My expectation would be to close the shape with a curved vertex similar to all the others.

here's a better one with a fill for reference:
screen shot 2018-12-01 at 8 38 20 pm

oh, and the code used to generate these images, is slightly different from the example. That is a much more simplified version for testing. The idea is the same.

I don't think this issue can be closed yet. While the issue of shapes constructed with curved vertexes is not being closed when using endShape(CLOSE) is resolved, it closes it using a straight line as if the shape begun and ended with a normal vertex. This issue should be reopened until this is resolved. I for one would really like to see this working.

I think this bug doesn't only exist in P5.js but also in the normal Processing. For me it happened when trying to create a circle shaped audio visualizer and the first and last point were connected with a straight line instead of a curve.

Processing Version: 3.5.3

I have the same problem and the closing of the curved vertices close with a straight line. This is not optimal I think. Is there maybe any progress already made on a solution for this or can you give a pointer to how this could be implemented?

I'm experience the same problem as @alsino

In this sketch where I'm using CurvedVertex, the expected outcome (if the shape is closed) is that all spikes would have the same shape.

https://editor.p5js.org/yanngraf/sketches/Zbp6C8XBp

It is not the case, the start/end point is spiky.

@yanngraf as a workaround you can repeat the starting vertices to achieve the expected behavior: https://editor.p5js.org/brianelete/sketches/-ujBjhRU3

Was this page helpful?
0 / 5 - 0 ratings