If I'm reading this correctly, the following code...BezierCurve:insertControlPoint
Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc.
Code: Select all
-- a simple curve with four points in a counter-clockwise motion
-- default index is -1 (last), but was included for clarity
curve:insertControlPoint(0, 0, -1) -- bottom left
curve:insertControlPoint(100, 0, -1) -- bottom right
curve:insertControlPoint(100, -100, -1) -- top right
curve:insertControlPoint(0, -100, -1) -- top left
print(curve:getControlPoint(1))
print(curve:getControlPoint(2))
print(curve:getControlPoint(3))
print(curve:getControlPoint(4))
Code: Select all
0 0
100 0
100 100
0 100
Here's what happens instead...
Code: Select all
100 0 -- (2nd)
100 100 -- (3rd)
0 100 -- (4th)
0 0 -- (1st)
Okay, so we think to try inserting at index 0 maybe?
Unfortunately that doesn't work....
Code: Select all
0 100 -- (4th)
100 100 -- (3rd)
100 0 -- (2nd)
0 0 -- (1st)
Additionally: the wiki's description, "points from i onwards are pushed back by 1" should actually say that the points are pushed forward, at least that's the intended result, right?