Intersection area polygon 3D

Hi!
I need to calculate the area of intersection of two polygons (rectangles) given by their 3D vertices (x, y, z).
- Polygon 1 has the vertices A (x1, y1, z1), B (x2, y2, z2), C (x3, y3, z3) and D (x4, y4, z4);
- Polygon 2 has the vertices P (x5, y5, z5), Q (x6, y6, z6), R (x7, y7, z7) and S (x8, y8, z8).
Is there a function that solves my problem?
Can someone help me?

7 Comments

It looks like the polygons are 2D surfaces in a 3D environment. Wouldn't that give us a line of intersection rather than an area? If the rectangles are laying flat on the same plane then their overlap would produce an area and that would relatively easier to solve since you could reduce the dimensionality to 2D.
Perhaps a more concrete example would be helpful. It shouldn't be difficult to put together some values that produces the two objects so we can reproduce their coordinates on our end.
An image would also be helpful.
This is the case:
We have 2 panels (Panel 1 in green and Panel 2 in red) with different slopes in the space. The black polygon is the shadow generated by Panel 1 in the plane of Panel 2. I need to find the shaded area of Panel 2, that is, the intersection area between Panel 2 (red) and the black polygon.
Note: Panel 2 and the black polygon are on the same plane, but this plane is not with z = 0.
Leandro Bem
Leandro Bem on 30 Mar 2021
Edited: Leandro Bem on 30 Mar 2021
I know all the coordinates (x, y, z) of the 4 vertices of Panel 1, Panel 2 and the Shadow.
The same graph with another point of view:
Matt J
Matt J on 30 Mar 2021
Edited: Matt J on 30 Mar 2021
What manner of "shadow" is it? Is the black rectangle the orthogonal projection of Panel 1 onto the plane of Panel 2, or is it a perspective projection?
It is not an orthogonal projection. Panel 1 (green) and its respective shadow (black polygon) have equal areas.
Matt J
Matt J on 31 Mar 2021
Edited: Matt J on 31 Mar 2021
Well, I think we need more elaboration on the projection process considered here. I don't see what kind of projection could be area preserving, unless Panel 1 is in fact rotated into the plane of Panel 2, but if that's the case, how is the axis of rotation chosen?
> I know all the coordinates (x, y, z) of the 4 vertices of Panel 1, Panel 2 and the Shadow.
So, you know the coordinates of the shadow and the shadow is on the same plane as one of the surfaces, is that correct? Isn't that a simple 2D problem of computing the overlap? What am I missing?

Sign in to comment.

Answers (1)

Matt J
Matt J on 30 Mar 2021
Edited: Matt J on 31 Mar 2021
b1=(Q-P)/norm(Q-P);
b2=(S-P)/norm(S-P);
pgon1=polyshape( ([A;B;C;D]-P)*[b1;b2].' )
pgon2=polyshape( ([P;Q;R;S]-P)*[b1,b2].' );
Area = area(intersect(pgon1,pgon2))

2 Comments

Thanks for your help, but with this suggestion I am not getting the correct answer.
Matt J
Matt J on 31 Mar 2021
Edited: Matt J on 31 Mar 2021
I know all the coordinates (x, y, z) of the 4 vertices of Panel 1, Panel 2 and the Shadow.
If you replace ABCD with the coordinates of the shadow vertices, it should work.

Sign in to comment.

Asked:

on 30 Mar 2021

Edited:

on 31 Mar 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!