@Yaroslav said in Get Spline Data from document->GetActiveObject();:
Forgive me the lack of my expertise.
Hey, we were all beginners at some point. I still ask stupid questions
Now the question. Suppose the curve is the combination of bezier and linear elements (they are joint).
Not sure what you mean here. A spline can only be of one type.
SPLINETYPE::BEZIER or one of the other types.
I guess you mean that some of the spline's points have tangents, and other's don't (meaning they also have tangents, but with zero length)?
How do we retrieve
- all the start and end points of the constituent elements?
const Vector* padr = splineObject->GetPointR(); // Read-only
Vector* padr = splineObject->GetPointW(); // Writeable
- the control points of Bezier curved elements?
const Tangent* tangents = splineObject->GetTangentR(); // Read-only
Tangent* tangents = splineObject->GetTangentW(); // Writeable
The only methods that I found are:
const Vector* vec = (*spline).GetPointR();
This is correct. There are as many points as
splineObject->GetPointCount() tells you.
To get the position of a spline point, use:
// Get const array of points
const Vector *points = splineObject->GetPointR();
// Get a specific point from the array
const Vector pointPos = points;
Same applies to the tangents.
// Get writeable array of tangents
Tangents* tangents = splineObject->GetTangentW();
// Change a tangent
tangents.vl = Vector(some, nice, direction);
tangents.vr = Vector(another, nice, direction);
tangents = myTangent;
You might want to take a look into
circle.cpp from the