Message Boards Message Boards

1
|
3109 Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:

RegionUnion of 4 polygons not working in NSolve?

Posted 3 years ago
POSTED BY: Erik Mahieu
6 Replies
Posted 3 years ago

I discovered a book. "Interactive Computational Geometry, A Taxonomic Approach" by Jim Arlow on this WRI site. Maybe in Chapter 5 there are some details about intersections of geometric objects?

Chapter 5 - intersections: The relationship of points to convex polygons, Point inside convex polygon, Intersection of lines with lines,edges and polygons, Proper intersection, Improper intersection, Intersection, Polygon intersection, Summary of types of intersection, Polygon extreme points, Monotone polygons, Tangent to a convex polygon from a point, Splitting a convex polygon into polygonal chains

Book seems out of print though. An up-to-date book or course on computational geometry with Mathematica would be very useful.

POSTED BY: Erik Mahieu

I am baffled too. Last week I had two polyhedra with rational coordinates, whose RegionIntersection was floating-point. One would be led to think that geometric computing is done with floats. Now we see an example that goes in the opposite direction. My personal guess is that computational geometry is a part of Mathematica that has been left unfinished.

POSTED BY: Gianluca Gorni
Posted 3 years ago

Thanks for the advice Gianluca. I also try out all sorts of things, especially to get geometric code to work. I tried DiscretizeGraphics, DiscretizeRegion, etc.. However, the relation between (of all things) Rationalize and RegionUnion or Polygon is completely baffling for me. But it works!

Somebody at Wolfram should be able to explain this??

POSTED BY: Erik Mahieu

My experience with computational geometry in Mathematica is that I cannot predict in advance which approach will work for a given problem, and I must be prepared to try something else. I don't ask "why" any more.

POSTED BY: Gianluca Gorni
Posted 3 years ago

Thank you Gianluca! This works really well but hard to understand "why" for me. Where did you get this, in the docs?

POSTED BY: Erik Mahieu

It works if you Rationalize the coordinates:

polys = Rationalize@{Polygon[{{0, -2, -2.9}, {0, -1.5, -2.65}, {10, \
-1.5, -2.65}, {10, -2, -2.9}}], 
    Polygon[{{0, -1.5, -2.65}, {0, 0, -2.95}, {10, 
       0, -2.95}, {10, -1.5, -2.65}}], 
    Polygon[{{0, 0, -2.95}, {0, 1.5, -2.5}, {10, 1.5, -2.5}, {10, 
       0, -2.95}}], 
    Polygon[{{0, 1.5, -2.5}, {0, 2, -3.5}, {10, 2, -3.5}, {10, 
       1.5, -2.5}}]};
line = Rationalize@HalfLine[{0, 1, 0}, {1, 0, -.52}];
surface = RegionUnion[polys];
Solve[And[Element[{x, y, z}, line], Element[{x, y, z}, surface]], {x, 
  y, z}]
POSTED BY: Gianluca Gorni
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