Creating buffer around Line\Polygon

71 views
Skip to first unread message

michael...@gmail.com

unread,
Oct 5, 2020, 7:15:01 AM10/5/20
to s2geometry-io
Hi guys,

I have 2 objectives:
1. Given a Line and Radius, calculate polygon by adding a buffer of Radius from every point on line
2. Given Polygon and Radius, calculate polygon that was enlarged by Radius from every point on perimeter of original polygon.


What tools\classes\objects in S2 do I have in order to achieve this?
- S2ShapeIndexBufferedRegion calculates cells but I want the exact shape (points\coordinate)

Thanks a lot !

Jesse Rosenstock

unread,
Oct 5, 2020, 9:39:02 AM10/5/20
to michael...@gmail.com, s2geometry-io
On Mon, Oct 5, 2020 at 1:15 PM michael...@gmail.com <michael...@gmail.com> wrote:
Hi guys,

I have 2 objectives:
1. Given a Line and Radius, calculate polygon by adding a buffer of Radius from every point on line

I'm not sure there's a great way.

Walk along the line and create points on either side, and for the circles on the end. Make a polygon from these.
 
2. Given Polygon and Radius, calculate polygon that was enlarged by Radius from every point on perimeter of original polygon.

Union the above polygons.
 


What tools\classes\objects in S2 do I have in order to achieve this?
- S2ShapeIndexBufferedRegion calculates cells but I want the exact shape (points\coordinate)

Thanks a lot !

--
You received this message because you are subscribed to the Google Groups "s2geometry-io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to s2geometry-i...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/s2geometry-io/a2bcc782-b301-49b9-b29c-3ae057d2d939n%40googlegroups.com.

michael...@gmail.com

unread,
Oct 5, 2020, 9:58:24 AM10/5/20
to s2geometry-io
Thanks !

How do you suggest to unify polygon with circle? How do you suggest to unify polygon with polygon ? The output that I'm seeking should be a valid shape. One thought that I have in mind, which I don't like, is unification by intersection coordinates...

Jesse Rosenstock

unread,
Oct 5, 2020, 10:10:59 AM10/5/20
to michael...@gmail.com, s2geometry-io
There are no circles; just approximate with segments.

Use S2Polygon::DestructiveUnion or InitToUnion.

michael...@gmail.com

unread,
Oct 5, 2020, 2:45:45 PM10/5/20
to s2geometry-io
Thanks !!!

michael...@gmail.com

unread,
Nov 2, 2020, 8:01:30 AM11/2/20
to s2geometry-io
Hi,

I have a follow up question please, regarding approximation of S2Cap with S2Loop\S2Polygon

Given a center point and radius of a cap, how can I find points on cap border ? I want the points to have equal distance between them, for example if I want to approximate the cap with 4 points then the 4 points must be on cap border with 90 degrees angle between them (from cap center), 8 points with 45 degrees angle between them. Increasing the amount of points will give me a better and better cap approximation.

I'm sure that this must be possible but I'm unable to find the needed functions, please assist.

Thanks a lot in advance !!
Reply all
Reply to author
Forward
0 new messages