Determining the correct detailX & detailY value for p5.Geometry

I’m generating geometry using p5.Geometry, but having trouble determining what the correct detailX and detailY values to use are. According to the comments in the source code, detailX is the “number of vertices on horizontal surface”. (detailY says the same thing, but I’m guessing it should say ‘vertical’ not ‘horizontal’). I’m not so sure what this actually means though: I have what I think is a minimal viable example here. With the values I’ve set things look good. If the values are too small the shape will either look incorrect or if it’s too big then an error is shown. For example, instantiating the p5.Geometry() with the default values of (1,1) show nonsense. I chose the values (99,3) because there are 4 points at each layer, and 20/0.2 = 100 layers, and the source code adds 1 to these values: this avoids an error because (detailX + 1) * (detailY + 1) <= vertices.length. (Though, I’m not sure why it’s (99,3) and not (3,99) - these swapped values result in a nonsense shape).

However, if we try changing the sideLength variable to 50, I would expect that the corresponding detail value should change to 50/0.2 = 250, minus 1 is 249. The resulting shape, however, doesn’t come out right.

Any insight into this would be really helpful! I would switch to simply using beginShape()/endShape(), but with the number of vertices being shown the frame rate is unmanageable. This is also a follow up from my other questions so those may be relevant, thanks for the help on those too :slight_smile: Line Drawings with p5.Geometry - #3 by hardwhere
Line Drawings with p5.Geometry - #3 by hardwhere