Message Boards Message Boards

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

How do I get the signed area of a 3D triangle?

Posted 10 years ago

I'm using Mathematica 10 (but also have Mathematica 9) and I've tried entering triangle coordinates both in clockwise and counterclockwise directions but obtain only positive areas with the following:

tCounterClockwise = Triangle[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}]
tClockwise = Triangle[{{0, 0, 0}, {0, 1, 0}, {1, 0, 0}}]

Is there a way to obtain the signed area of a triangle?

My ultimate goal is to test for whether a point is in a 3D convex hull without having to use SignedRegionDistance (from Mathematica 10) and the TetGenLink package (from Mathematica 9) because neither is available for a CDF (which is the output format I need). My rationale is that if I can obtain the signed area and then arrange the triangle vertices on the surface of a convex hull all in a counterclockwise manner, then points outside the convex hull will all have the same sign of volume (which I can calculate) when the 3-simplex is formed with the triangle and that point. (The points to be tested are selected by the user in a CDF document and are not known ahead of time.)

If I'm all wet with that rationale for determining whether a point is in the convex hull or not, please comment on that, too. (This is also a plea for updating CDF to version 10 so I wouldn't have to figure this out.)


POSTED BY: Jim Baldwin
3 Replies
Posted 10 years ago

Frank and David, thank you!

Frank: I've gone over the wiki on Exterior Algebra and I've absorbed at least of little of that (maybe not much but a little). It helped me formulate what I think is a solution.

David: I pretty much followed your suggestion by using the cross product.

What I ended up doing is taking a point in (or on) the 3D convex hull. Then using that point with every triangle making up the surface of the convex hull, I reordered the vertices anytime the signed volume of the 3-simplex of the point and a convex hull triangle was negative.

For each point a user would select, I constructed the signed volume of the 3-simplex of that point and the convex hull triangles. If any volume was negative, then that point would be declared outside of the 3D convex hull. Otherwise with all positive volumes that point would be declared within the convex hull. For this application I didn't need to worry if a point was on the surface - neither in or out of the convex hull. (Strangely enough the other assistance I found was from the following link: point in or out of a convex hull.

I've attached a Mathematica 9.0 file and the associated CDF document where a cluster of points is generated along with the 3D convex hull of those points (with those points shown in green). Then using sliders one picks a point to test. The marker is red when the point is outside the convex hull and blue when inside. So visually it seems to work.

convex hull and exterior point

Thanks again!


POSTED BY: Jim Baldwin

Jim, I believe you can't obtain a signed area of a 2D triangle in 3D space without adding extra structure. From what vantage point are you looking at the triangle? What happens if you flip the triangle over? Would the sign change at some point?

What you are talking about is an orientation. An orientation only applies to an object that spans the entire space. You need to define an extra vector field that gives an orientation at each point of the 3D space. For example if the triangles were only allowed in a given plane then you could define an "outward" normal for the plane and use it to give an orientation (or sign) to all triangles in the plane. If you had a sphere and the triangles were in the tangent planes of the sphere you could use the outward normal vector from the center of the sphere to establish an orientation. If you had a convex polyhedron you could use outward normal vectors from some point within the polyhedron.

And, of course, not all surfaces can be oriented.

You can signed areas from wedge products. See the Wikipedia article on Exterior Algebra

In[8]:= SymmetrizedArrayRules @ TensorWedge[{1, 0, 0}, {0, 1, 0}]

Out[8]= {{1, 2} -> 1, {_, _} -> 0}

In[9]:= SymmetrizedArrayRules @ TensorWedge[{0, 1, 0}, {1, 0, 0}]

Out[9]= {{1, 2} -> -1, {_, _} -> 0}
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract