Message Boards Message Boards

0
|
3646 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Discretization of area bound by WindingPolygon

Posted 3 years ago

I have an array of points in two dimensional plane. The closed-loop formed by these points (by joining each point with two neighboring points, and first point to the last point, always lies on both sides of the Y-axis (x>0 and x<0). I am trying to find the area of a section of this domain lying on the x > 0 side of the Y axis. Use of WindingPolygon function to determine the domain is giving "disconnected polygon with holes". Due to this, discretization of this domain is giving an area completely different from the original area. Attached is the file having the data.

Will be thankful for any help

Attachments:
POSTED BY: S G
3 Replies
Posted 3 years ago

How about just using positive x values to construct the WindingPolygon?

points // Select[First@# >= 0 &] // WindingPolygon // DiscretizeRegion // Area
(* 24865.2 *)
POSTED BY: Rohit Namjoshi
Posted 3 years ago

Thanks.

It worked for most of the cases, but the problem of "disconnected polygon with holes" persisted. When I try to determine the area of the bound region, a new error message "BoundaryMeshRegion::holm: Unable to find points not in the region for all of the inner boundaries." pops up in the message window. I tried to search, but could not find any reference for this error message. Not sure if the two messages "disconnected polygon with holes" and "BoundaryMeshRegion::holm: Unable to find points not in the region for all of the inner boundaries." are connected to each other. Attached file has an example. Will be thankful for any further suggestion. PS- If I run a large number of sets of "points" to determine the bound areas, this error message coincides with the hanging of the Mathematica...

Attachments:
POSTED BY: S G
Posted 3 years ago

A Polygon or a WindingPolygon constructed from the points have holes.

points // Select[First@# <= 0 &] // Polygon

enter image description here

points // Select[First@# <= 0 &] // WindingPolygon

enter image description here

Try generating a BSplineFunction or BezierFunction from the points to smooth them out and eliminate holes. There may be a better way to identify and remove holes, try asking on MSE.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract