Polyline class in C++

In my problem, a polyline is defined to contain straight lines, arcs (elliptical), bezier curves and other polylines.
Please give me a suggestion to represent polyline with C++, so that I can isolate its components, rotate and duplicate a polyline?

I use Visual C++ 6.0. Thank you!
dienbaquan2ndAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

maartennieberCommented:
The CGAL library can be used to handle different kinds of curves (check if it covers your needs)

http://www.cgal.org/

It requires buying a license for commercial applications, but not for open source.

I think CGAL does not handle polycurves (polylines of curves that may not be straight lines).
I don't know of a library that does handle this case. You may have to program your own class that holds a collection of curves (taken from CGAL for example) and ensures that the end-points of adjacent curves overlap.
0
dienbaquan2ndAuthor Commented:
Thank maartennieber, however I just need the conceptual of the design but not to dig into library like cgal.
0
itsmeandnobodyelseCommented:
You can do

class Segment
{
     Point p1;
     Point p2;
};

class Line : public Segment
{
};

class Arc : public Segment
{
     Point m;
};

class Bezier  : public Segment
{
    // some Bezier parameters
};

class PolyLine : public Segment
{
    std::vector<Segment*>  polyline;
};


Add some virtual functions to copy, rotate, or isolate segments of a polyline.

0
dienbaquan2ndAuthor Commented:
I've solved it myself, thank you all!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.