[boost-users] [geometry] segment concept
Hello, I play with new boost geometry library. There is thing that I don't understand, possible it is bug. I'm trying to register segment concept. It is struct with fields named "point1" and "point2", that represents endpoints of this segment. I've specified tag, point_type, indexed_access for this struct. And length works fine. But intersection requires that this struct contains fields named "first" and "second". I'm new to this library, so I don't know whether it is bug in library or my code. I've attached minimal c++ file that reproduces the problem. If I uncomment //#define point1 first //#define point2 second all compiles and works fine. Best Regards, Sergey
Hi Sergey,
I play with new boost geometry library. There is thing that I don't understand, possible it is bug.
It is. It did not use the concept at that point. After inspecting I remembered why, and it is fixed now (in Boost.Trunk).
I'm trying to register segment concept. It is struct with fields named "point1" and "point2", that represents endpoints of this segment. I've specified tag, point_type, indexed_access for this struct. And length works fine. But intersection requires that this struct contains fields named "first" and "second". I'm new to this library, so I don't know whether it is bug in library or my code. I've attached minimal c++ file that reproduces the problem.
Thanks for the minimal file, it is helpful. So fixed in Trunk, sorry for the error. If you don't use Trunk, I can send you the modified file as an attachment, which you can replace. Thanks for the catch. Barend
Hi Barend,
It is. It did not use the concept at that point. After inspecting I remembered why, and it is fixed now (in Boost.Trunk).
Thanks for a quick fix.
Some more questions. Am I correctly understand that intersection of segment and ring is not implemented yet? There is distance algorithm between point and segment (or ring), is it possible to get closest point of segment to that point? Best regards, Sergey
Hi Sergey, On 22-7-2011 16:07, Sergei Politov wrote:
Hi Barend,
It is. It did not use the concept at that point. After inspecting I remembered why, and it is fixed now (in Boost.Trunk).
Thanks for a quick fix.
You are welcome.
Some more questions.
Am I correctly understand that intersection of segment and ring is not implemented yet?
That is correct. If you mean "cutting a ring with a segment": it can be used/implemented, discussed and described on the GGL-mailing list. That might be useful for you as well. It is described here: http://boost-geometry.203548.n3.nabble.com/Understanding-get-turns-for-lines...
There is distance algorithm between point and segment (or ring), is it possible to get closest point of segment to that point?
No, or not yet. I once needed that and created a strategy for that, but it is not in the Trunk or Release (not even in the extensions). I will see if it can be added, because there has been a question about this earlier. Regards, Barend
Hi Barend,
That is correct. If you mean "cutting a ring with a segment": it can be used/implemented, discussed and described on the GGL-mailing list. That might be useful for you as well. It is described here: < http://boost-geometry.203548.n3.nabble.com/Understanding-get-turns-for-lines...
I meant intersection of ring border and segment. For example.
ring: (0, 0), (2, 0), (2, 2), (0, 2) segment: (-1, 1), (3, 1) output two points: (0,1) and (2,1)
There is distance algorithm between point and segment (or ring), is it possible to get closest point of segment to that point?
No, or not yet. I once needed that and created a strategy for that, but it is not in the Trunk or Release (not even in the extensions). I will see if it can be added, because there has been a question about this earlier.
It would be nice to see such usage of strategy in the documentation.
Best Regards, Sergey
Hi Sergey,
I meant intersection of ring border and segment. For example. ring: (0, 0), (2, 0), (2, 2), (0, 2) segment: (-1, 1), (3, 1) output two points: (0,1) and (2,1)
This currently is only possible if you use the detail: interface (subject to change), using a linestring and a polygon or ring. Like that, it is almost literally described in one of the examples: 05_b_overlay_linestring_polygon_example.cpp , in the release. They are called "turns" and the function is "get_turns" because they contain, besides intersection information, also turn information. But the intersection points are there. In the end the generic intersection function will also be able to output points (actually that is quite easy but still has to be done). Regards, Barend
participants (2)
-
Barend Gehrels
-
Sergei Politov