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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
Given a list that maps vertex-indices to their real positions, this method calculate the center/middle point of this Face.(package private) static float
clamp(float x)
Clamping x between 0 and 1.boolean
containsEdge(Edge e)
Check if the given edge is an edge of this Face.float
distFromPoint(Vec3 w, ArrayList<Vec3> concreteVertices)
Return an unsigned distance from a point w to this Face.static boolean
isConnected(Face a, Face b)
Check if two Faces are 'connected'.iterator()
static void
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
vertices
public int[] vertices
-
-
Constructor Details
-
Face
public Face(int[] vertices)
-
-
Method Details
-
iterator
-
center
Given a list that maps vertex-indices to their real positions, this method calculate the center/middle point of this Face. -
containsEdge
Check if the given edge is an edge of this Face. -
area
-
toString
-
isConnected
Check 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
-
distFromPoint
Return 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 -
clamp
static 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
-