Thank you, hopefully they will fix that function, but on the up side you may also have some more control this way by building it from the ground up.
Your recursive function was going in the same direction to the version I have now. I think that your recursion idea would be very good for when you need a flexible amount of points for the guide points. The bit where you divided up the edges was correct, and in line with what I did. So I thought I would share some process.
I was getting a little bit lost in bits of code I found from different places. So I went back to understanding the concepts and found a good example of how the Casteljau's algorithm works as soon as I worked out the motion of the middle point it started to all make sense.
A quick illustration I did to visualize the concept


If you treat the points as rails that slide up and down the right and left edges and the middle point that slides left to right, it creates the motion needed.
So going from 01 left to right with the mid points that are offset this drives the position of the middle point on the middle segment and its position left to right along the "rail", that's the best way to think of it.
The direction of the vectors is really important so that all of the points move correctly at the same time(not easy to visually check) so I had to brute force a line to each one of the vector positions of the points to make sure it was all working correctly.
In a nut shell the steps would be
1) Define vectors for the reference points
2) Create the middle points on the rails you can use as many as you need to but I used just a few, as this gets complicated really quickly
3) You need an offset value to move all of the points along the "rails", this then becomes the length of each line segment(do the resampling once you have it working)
4) Work out all of the vectors driving the points
5) Re sample the segments 1.0 is the total length / number of sides
6) Do some of this

Code: Select all

 P1[1] is left bottom point X P1[2] is left bottom point Y
 P2[1] is Right bottom point X P2[2] is Right bottom point Y
 V3[1] is offset middle point X V3[2] is offset middle point Y
local line2 = Shape()
step = 0  Number off segments
step = 1/sides  1 is the total length / sides resamples the curve
slide = 0
line2:MoveTo(P1[1], P1[2], img)  Start Position
for i = 1,sides,1  Loop to slide middle point around
do
slide = slide+step  Length of each segment
LM = {((V3[1]P1[1])*slide)+P1[1],((V3[2]P1[2])*slide)+P1[2]}  Vector left middle
RM = {((P2[1]V3[1])*slide)+V3[1],((P2[2]V3[2])*slide)+V3[2]}  Vector right middle
MM = {((RM[1]LM[1])*slide)+LM[1],((RM[2]LM[2])*slide)+LM[2]}  Vector Middle middle
line2:LineTo(MM[1],convertY(MM[2],img))  draw line to End of segement
print("side: "..i)  debug
print("slide: "..slide)  debug
end
print("step: "..step)  debug
print("")  debug
line1:AddShape( line2:OutlineOfShape(thickness, outlinetypes[linetype], "OJT_Round", (req:IsQuick() and 8 or 16)) )
