Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.9K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

RegionIntersection fails for some values with polygons

I want to find the intersection (region) of 2 polygons. I use RegionInstersection but it only works for some sizes, for example, when c=.5 it gives the correct result, but with c=.4 it only finds a line as intersection.

Area[r3[.5]] works fine...

Area[r3[.4]] does not work...

What is wrong?

b = 15.0; d = 4.0; lbp = 40.0; d1E = 2.; l1E = 7.0; d1D = d1E; l1D = 5.0;

r1 = Polygon[{{0, 0}, {lbp/2 - l1D, 0}, {lbp/2, d1D}, {lbp/2, d}, {-(lbp/2), d}, {-(lbp/2), d1E}, {-(lbp/2) + l1E, 0}}]; r2[c_] := Rectangle[{-1.1 lbp/2, -1.5}, {1.1 lbp/2, c}]; r3[c_] := RegionIntersection[r1, r2[c]];

2 Replies
Posted 11 years ago
POSTED BY: Erik Mahieu

This looks like it was also asked on Stack-Exchange (http://mathematica.stackexchange.com/questions/87746/regionintersection-fails-for-some-values-with-polygons). Try using rational numbers instead of floating point numbers:

b = 15; d = 4; lbp = 40; d1E = 2; l1E = 7; d1D = d1E; l1D = 5;

r1 = Polygon[{{0, 0}, {lbp/2 - l1D, 0}, {lbp/2, d1D}, {lbp/2, d}, {-(lbp/2), d}, {-(lbp/2), d1E}, {-(lbp/2) + l1E, 0}}]; r2[c] := Rectangle[{-11/10 lbp/2, -15/10}, {11/10 lbp/2, c}]; r3[c] := RegionIntersection[r1, r2[c]];

Area[r3[4/10]]

292/25

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