barakugav / FDML

FDML is a CPP software for robot localization processing and queries using few (one or two) distance measurements
2 stars 1 forks source link

Trapezoid: Intersect half plane with cell result polygon instead of bounding polygon #17

Closed barakugav closed 1 year ago

barakugav commented 1 year ago

In each trapezoid we calculate a result of a single measurement, and we intersect itwith the half plane created by the bottom edge of the trapezoid. Currently this is implemented by intersecting the raw result polygon P with a bounding polygon Q, where one of the edges of Q is the bottom edge of the trapezoid. This implementation is the bottleneck of the query performance. CGAL must have a more efficiant way to intersect a polygon with half plane.

efifogel commented 1 year ago

Hi Barak,

The "Regularized" Boolean operations on polygons in CGAL are based on the arrangement package. If, for example, you want to perform a sequence of operations, for example: (P1 intersect P2) join P3 it is better to use an object of type Polygon_set_2<> (rather than applying free functions on the polygons), simply because the Polygon_set_2 maintains the underlying arrangement, while the free functions (re)construct the underlying arrangements.

With (the underlying) arrangements you can do much more than with the polygons themselves. Construct a Polygon_set_2<> object (say ps) and alter it. Assume it consists of the polygon that you want to intersect with a half-plane. Obtain the underlying arrangement (auto arr = ps.arrangement_2()). Insert the directed line that defines the half-plane into the arrangement and mark all the faces that are not in the intersection.

I can tell you that the arrangement uses a face record that is extended with a Boolean flag that indicates whether the face is in the polygon or not, so you can use it. Come by and I'll show you how.

Efi


//) o /__ // (__ ( ( ( (/ (/-(-'(/ /

On Mon, 21 Nov 2022 at 11:23, Barak Ugav @.***> wrote:

In each trapezoid we calculate a result of a single measurement, and we intersect itwith the half plane created by the bottom edge of the trapezoid. Currently this is implemented by intersecting the raw result polygon P with a bounding polygon Q, where one of the edges of Q is the bottom edge of the trapezoid. This implementation is the bottleneck of the query performance. CGAL must have a more efficiant way to intersect a polygon with half plane.

— Reply to this email directly, view it on GitHub https://github.com/barakugav/FDML/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBNOFUXDIDW3PBDK5BOXLWJM5RZANCNFSM6AAAAAASGNOJCY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

barakugav commented 1 year ago

effe84e22868bcbf5ae4107d5a7e4f3f2460f3e2