On 11/05/2013 at 08:57, xxxxxxxx wrote:
Take a look at the values you are giving "i" in your "for" loop.
You are not allowing the loop to use the end points in the points array. And that's what is creating that pinched shape.
If you want to make a mirrored copy of your spline.
Here's an example that shows how to mirror both the points and the tangents along the X-Axis:
BaseObject *spline = doc->SearchObject("Arc"); //Find the arc spline in the OM (Not a primitive!!)
SplineObject *sp = ToSpline(spline); //Cast it to a spline object type so we can work on it if desired
SplineObject *newSpline = (SplineObject* )spline->GetClone(COPYFLAGS_0,NULL); //Clone the arc spline object
doc->InsertObject(newSpline,NULL,NULL); //Add it to the OM
Vector *newPoints = newSpline->GetPointW(); //Get it's array of points
Tangent *tangents = newSpline->GetTangentW(); //Get it's array of tangents
LONG pointCount = newSpline->GetPointCount();
for(LONG i=0; i<pointCount; i++)
newPoints[i].x = newPoints[i].x * -1; //Mirror the points along the X-axis
tangents[i].vl.x = tangents[i].vl.x * -1; //Mirror the left tangents along the X-axis
tangents[i].vr.x = tangents[i].vr.x * -1; //Mirror the right tangents along the X-axis