Boost logo

Geometry :

Subject: [geometry] Adaption of legcay hierarchy to Boost.Geometry model
From: Mihis (mihis.sakh_at_[hidden])
Date: 2013-02-01 05:11:16


I am trying to adapt my legacy hierarchy of geometry objects to
Boost.Geometry model. However, I can't understand next thing. For example,
my class dmCurve doesn't contain objects of dmPoint class directly.
Instead of this it contains objects of abstract class dmCurveSegment. Its
inheritors are responsible for
the concrete algorithm of point interpolation of curve's segment between its
reference points. So, I have three classes dmLinearCurveSegment,
dmArcCurveSegment and dmBezierCurveSegment. Each of these classes have
pointers to the necessary number of reference points, implements operator[]
to access reference and interpolated points and function PointCount() to get
the total number of points (reference + interpolated). Now I can declare
class dmCurveSegmentIterator and iterate through points of dmCurveSegment,
without wondering about its concrete type. The next step is to adapt class
dmCurve to lift Boost.Geometry Linestring Concept. OK, I declare and
implement custom class dmCurveIterator, deriving from
boost::iterator_facade, which will use inner segment structure of dmCurve
and dmCurveSegmentIterator objects to iterate through all point of concrete
curve. Next, I define appropriate specializations of traits::tag defining
linestring_tag for dmCurve class. So, as I understand, my dmCurve class
lifts Boost.Geometry Linestring Concept and I can use it in algorithms
implemented in Boost.Geometry. But, as I see many algorithms of
Boost.Geometry should construct new geometries (for example simplify and
buffer). Assume that, I have implemented dmRing and dmPolygon using dmCurve
and adapted them to Boost.Geometry. I can't understand how Boost.Geometry
will work to construct objects of dmCurve because as I understand I don't
provide any code to support this process. For example, dmCurve has function
AddPoint() which adds in the inner container dmLinearCurveSegment object,
which will contain pointers to the last point of previous curve segment and
the pointer to point provided by AddPoint() function. Can anybody explain me
this issue of adapting custom code to Boost.Geometry model?

I apologize, but I have no time to write code. Maybe later I will do this.
Now I have only an idea, represented in words.


View this message in context:
Sent from the Boost Geometry mailing list archive at

Geometry list run by mateusz at