Boost logo

Geometry :

Subject: [ggl] Clipping/Intersecting efficiency
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-05-31 05:02:31

Hi Chris,
> Thanks for this, it would already be half the problem gone. If you
> could commit this to the sandbox, it would be great.
OK, done.

> In this case, what should be defined as a point_2d? point*, right?
Not point* but probably just "point" in your case? It should not be
dynamic to avoid the same problems. If your "point" is not registered
you can register it in the same way (without *).

Just looked into the Merkaartor sources. I would advice to register
QPointF as being recognized by the GGL. You can then define a linestring
of QPointF's and no further conversions are necessary. So something like:
GEOMETRY_REGISTER_POINT_2D_GET_SET(QPointF, qreal, cs::cartesian, x, y,
setX, setY)

and then ggl::linestring<QPointF> can be used, so your clip should look
like (didn't test):

    typedef ggl::linestring<QPointF> q_line;
    std::vector<q_line> clipped;
    ggl::strategy::intersection::liang_barsky<ggl::box_2d, QPointF>
in, std::back_inserter(clipped), strategy);

You can, by the way, also register QRect as a box type.
However, I didn't see a point* in your source so maybe I looked at the
wrong place.

Regards, Barend

-------------- next part --------------
An HTML attachment was scrubbed...

Geometry list run by mateusz at