Class Face
java.lang.Object
eu.iv4xr.framework.spatial.meshes.Face
Represent a polygon, described by a set of vertices, stored in an array
 called vertices. Each vertex is represented by just an integer (think of it
 as the id of the vertex), so it does not describe the actual position of the
 vertex in the space (another information is needed to map the vertices to
 actual positions). Two vertices in the consecutive positions in the array
 "vertices" are assumed to be connected with a line. So, for all i,
 vertices[i] is connected to vertices[i+1], and the last one in the array,
 vertices[N-1] is connected to vertices[0]. In this way the array describes a
 polygon.
- Author:
- Naraenda
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfloatGiven a list that maps vertex-indices to their real positions, this method calculate the center/middle point of this Face.(package private) static floatclamp(float x)Clamping x between 0 and 1.booleancontainsEdge(Edge e)Check if the given edge is an edge of this Face.floatdistFromPoint(Vec3 w, ArrayList<Vec3> concreteVertices)Return an unsigned distance from a point w to this Face.static booleanisConnected(Face a, Face b)Check if two Faces are 'connected'.iterator()static voidtoString()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
verticespublic int[] vertices
 
- 
- 
Constructor Details- 
Facepublic Face(int[] vertices)
 
- 
- 
Method Details- 
iterator
- 
centerGiven a list that maps vertex-indices to their real positions, this method calculate the center/middle point of this Face.
- 
containsEdgeCheck if the given edge is an edge of this Face.
- 
area
- 
toString
- 
isConnectedCheck if two Faces are 'connected'. The method defines 'connected' to mean that the two Faces share at least one edge. This works well if the Facses are convex and have no overlapping edge (except if it is common).
- 
toString
- 
distFromPointReturn an unsigned distance from a point w to this Face. The distance is defined as follows. Imagine first the 3D shape obtained by extruding this Face along its normal vector. Let's call this shape the extruding prism of this Face. If the the point w is strictly inside this prism, its distance is defines as its distance to the Face along the normal vector. Otherwise, the point is either strictly outside the prism, or at the prism's border. Then its distance to this Face is defined as its distance to the closest edge of the Face. Taken from: https://www.iquilezles.org/www/articles/triangledistance/triangledistance.htm
- 
clampstatic float clamp(float x)Clamping x between 0 and 1. That is, if x≤0, we return 0, if x≥1 we return 1, and else the original x is returned.
- 
main
 
-