Ok, here is a slightly refined Path API, as exposed
through IDL:
typedef sequence<Vertex> Polyline;
struct Quadric {/*...*/};
struct Bezier
{
unsigned short order;
sequence<Vertex> controls;
};
struct Nurbs
{
unsigned short order;
sequence<Vertex> controls;
sequence<double> weights;
sequence<double> knots;
};
enum PathSegmentType { polylinetype, arctype, beziertype, nurbstype};
union PathSegmentContent switch (PathSegmentType)
{
case polylinetype: Polyline lines;
case arctype: Quadric arc;
case beziertype: Bezier bezier;
case nurbstype: Nurbs nurbs;
};
//. moveto: the next segment's CS is the same as this,
//. end points are not connected
//.
//. lineto: the next segment's CS is the same as this,
//. end points are connected by a line
//.
//. align: the next segment's CS is this plus a translation
//. that aligns the last point of this segment with
//. the first point of the next segment
enum PathSegmentConnection { moveto, lineto, align};
struct PathSegment
{
PathSegmentContent segment;
//. connection defines the connection to the next
//. segment. If this is the last one, moveto implies
//. an open path, lineto a closed path. Align is
//. undefined...
PathSegmentConnection connection;
};
typedef sequence<PathSegment> Path;
|