I need a mathematical approach to check if a 3D polygonal object is convex.
In other words, how can one determine mathematically if a 3D polygonal object is convex by knowing the vertexes of the polygon.
Thanks!
You can check that a polygon is concave by taking each face and then replacing all the vertices in the plane equation of the face:
if they have the same sign it means that the face delimits the polygon in a certain direction => the test succeeds; proceed to next face
if they have different signs => this face cuts another face => the polygon is concave.
A 2D polygon is convex if the angles of all vertices have same direction (ie all angling to the left or all angling to the right). However, I'm not sure about 3D polygons.
Related
I have a group of tessellations forming a 3D shape and I need to find the section(s) with least cross section radius in it
Following is the visual aid for understanding this problem:
Assume that each rectangle in the A,B and C is a tessellation and this diagram is 3D
Now, Assume that each rectangle in the A,B and C is a tessellation and this diagram is 3D.
I wish to find 'C' ie.. set of tessellations with least cross section radii or thinnest part of the given shape.
How do I find it? I was thinking of finding the faces closest to each other but that will fetch the tessellations inside the shape as well.
I have tried:
1. Finding convex hull (Doesnt give points in thinnest area)
2. Alpha shape (No way to find the faces on the surface)
I would appreciate any advise on this matter.
Thanks
I'm starting with a single 2D triangle that I want to clip with a (potentially) convex 2D polygon. It's not self-intersecting, but may 'keep' or 'discard' the intersecting area based on the winding order.
I want to end up with a triangulation, i.e. a list of n vertices and m triangles, defined by 3 vertices each, of the clipped region in 2D space.
What would be the easiest (for me as a developer), and what the fastest (in terms of computation) way to achieve this?
If I a right, you want to clip inside the polygon, i.e. get the intersection between the triangle and the polygon.
As the triangle is a convex shape, the Sutherland-Hodgman algorithm is appropriate and no too difficult to implement (https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm).
Notice that if the intersection is not simply connected, the resulting polygon will be connected, with double edges joining the would-be parts. Some cleanup might be required.
After finding the intersection, you re-triangulate using the ear-clipping method or a more efficient one (https://en.wikipedia.org/wiki/Polygon_triangulation).
Alternatively, you can triangulate the polygon and perform the clipping of every triangle with the original one.
The triangle-triangle clipping problem is again solved with Sutherland-Hodgman, somewhat simplified as the input polygons have a constant size, and their intersection is convex and at worse an hexagon. Trigulation of a convex polygon is immediate.
i'm working on a project where i have a cloud of points in space as input data, my goal is to create a surface.
I started by computing a regression plan for the cloud, then i projected my points on the plane using dot products :
My plane is represented by a point and a normal , i construct the axis of the plane's space using cross products then project each point on these axis.
then i triangulate in 2D (that's the point of the whole operation).
My problem is that my points now are in the plane space and i want to get them back to their inital position (inverse the transformation) to have my surface ON my points.
thank you :)
the best way is to keep the original positions and make the triangulation give you the indices rather than the positions , i hope it will help !
In my game I have characters walking around a 3d terrain. The characters treat the terrain however as a 2d game map, so each character has a direction and a rotation on a 2d plane.
I want to rotate the characters as they're walking on the terrain, so that they are oriented to stand in relation to the terrain, rather then always be oriented as if they're walking on flat ground. This with keeping the original direction of the characters.
Basically I want
For each arbitrary x\z (width\depth) point on the game map I have
the (x,y,z) vector of the point on the terrain
The normal of the the specific terrain face related to the point
Using this, how do I set the rotation of the characters to achieve this?
Depending on which axis you would like to rotate the object the dot product of the faces normal with that axis will return you the cosine of the angle between the two vectors. By that angle you would have to rotate your object.
I am trying to implement in C++ a function that determines the cut of any given polygon and pyramid.
This has actually turned out to be far simpler than I had first imagined.
Firstly for each edge of the pyramid, test line-plane intersection (the given polygon is a plane, made up of 3 points). This will result in the new vertices at the cutting plane.
Secondly, since the polygon is not an infinite plane one needs to test for line-line intersection between the polygon edges (three) and each of the edges.
Indeed, this is not a simple problem. For simplicity, let's assume that there are no parallel line segments.
First determine the plane where your convex polygon is in. Then detemerine the intersection of that plane with the pyramid. This results in a second convex polygon.
Now you should find the intersection of the two convex polygons. How this can be done, you can find here.