Boost logo

Geometry :

Subject: [ggl] Segment Transformation
From: Bernhard (Bernhard.Schmitz)
Date: 2011-09-15 16:34:10

Hi & thanks again for answering my last question.

I'm trying to transform segments, but it doesn't work. Is this a bug, or am
I doing something wrong?
Slightly changed transformation example:

#include <boost/geometry.hpp>
int main()
    namespace trans = boost::geometry::strategy::transform;
    using boost::geometry::dsv;
    typedef boost::geometry::model::point<double, 2,
boost::geometry::cs::cartesian> point_type;
    typedef boost::geometry::model::segment<point_type> segment_type;

    point_type p1(1.0, 1.0);
    point_type p2(2.0, 2.0);
    segment_type s1(p1, p2);
    segment_type s2;

    // Translate over (1.5, 1.5)
    trans::translate_transformer&lt;segment_type, segment_type&gt;
translate(1.5, 1.5);
    //trans::rotate_transformer&lt;segment_type, segment_type,
boost::geometry::degree&gt; rot(90);
    boost::geometry::transform(s1, s2, translate);

    return 0;

The error happens for both rotation and translation:
1>c:\libs\boost_1_47_0\boost/geometry/algorithms/transform.hpp(108): error
: cannot convert parameter 1 from 'point_type1' to 'const segment_type &'

Now if I understand that correct (not an experienced template programmer),
transform_box_or_segment tries to apply the strategy I defined (for
segments) to the points of the segment, and that doesn't work.

Thanks in Advance,

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

Geometry list run by mateusz at