- java.lang.Object
-
- org.scijava.ops.image.geom.geom3d.TriangularFacet
-
-
Constructor Summary
Constructors Constructor Description TriangularFacet()Creates a new empty facet.TriangularFacet(Vertex v0, Vertex v1, Vertex v2)Creates a new facet of three vertices.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsAll(List<Vertex> vertexList)Returns true if all vertices are part of this polygondoubledistanceToPlane(Vector3D p)Computes the distance from a point to this facetbooleanequals(Object obj)doublegetArea()Get the area of this facet.Vector3DgetCentroid()Get the centroid of this facet.VertexgetLastVertex()Get the last vertex.VertexgetMaximumDistanceVertex()The vertex which is in front and farthest apart of the planeTgetNeighbor(int position)Get the neighbor at position.List<T>getNeighbors()Get all neighbors.Vector3DgetNormal()Get the normal of this facet.VertexgetP0()VertexgetP1()VertexgetP2()doublegetPlaneOffset()Computes the offset of this facetVertexgetVertex(int i)Get the vertex at index i.List<Vertex>getVertices()The list of vertices.List<Vertex>getVerticesInFront()All points which are in front of this plane.booleanhasEdge(Vertex tail, Vertex head)Returns true if this facet has the edge from tail to head.inthashCode()intindexOfNeighbor(T facet)Get index of a neighbor.intindexOfVertex(Vertex vertex)Returns the index of the first occurrence of vertex.voidreplaceNeighbor(int i, T f)Replaces a neighbor.voidsetNeighbor(int position, T n)Sets the n-th neighbor of this facet.voidsetVertexInFront(Vertex v, double distanceToPlane)Adds a vertex to the points in front of this facet.intsize()Get the number of vertices.
-
-
-
Field Detail
-
vertices
protected List<Vertex> vertices
The vertices of this facet in counter clock wise orientation.
-
neighbors
protected List<T> neighbors
The neighboring facets of this facet.Neighbor 0 is the neighbor which is adjacent to this facet at the edge from
UpdateablePointSet.getLastVertex()toTriangularFacet#getVertex(0).
-
-
Method Detail
-
getArea
public double getArea()
Get the area of this facet.- Returns:
- the area
-
getCentroid
public Vector3D getCentroid()
Get the centroid of this facet.- Returns:
- the centroid
-
getNormal
public Vector3D getNormal()
Get the normal of this facet.- Returns:
- the normal
-
getPlaneOffset
public double getPlaneOffset()
Computes the offset of this facet- Returns:
- the offset
-
distanceToPlane
public double distanceToPlane(Vector3D p)
Computes the distance from a point to this facet- Parameters:
p- the point- Returns:
- the distance
-
setVertexInFront
public void setVertexInFront(Vertex v, double distanceToPlane)
Adds a vertex to the points in front of this facet.- Parameters:
v- the vertexdistanceToPlane- of this vertex
-
getVerticesInFront
public List<Vertex> getVerticesInFront()
All points which are in front of this plane.- Returns:
- points which are in front
-
getMaximumDistanceVertex
public Vertex getMaximumDistanceVertex()
The vertex which is in front and farthest apart of the plane- Returns:
- vertex with maximum distance to the plane
-
getP0
public Vertex getP0()
-
getP1
public Vertex getP1()
-
getP2
public Vertex getP2()
-
indexOfVertex
public int indexOfVertex(Vertex vertex)
Returns the index of the first occurrence of vertex.- Parameters:
vertex- the vertex- Returns:
- index of vertex or -1 if this vertex is not contained
-
getVertex
public Vertex getVertex(int i)
Get the vertex at index i.- Parameters:
i- the position- Returns:
- the vertex
-
size
public int size()
Get the number of vertices.- Returns:
- number of vertices
-
getLastVertex
public Vertex getLastVertex()
Get the last vertex.- Returns:
- the last vertex
-
containsAll
public boolean containsAll(List<Vertex> vertexList)
Returns true if all vertices are part of this polygon- Parameters:
vertexList- to check- Returns:
- true if all vertices are contained
-
hasEdge
public boolean hasEdge(Vertex tail, Vertex head)
Returns true if this facet has the edge from tail to head.- Parameters:
tail- vertex of the edgehead- vertex of the edge- Returns:
- has edge tail to head
-
setNeighbor
public void setNeighbor(int position, T n)Sets the n-th neighbor of this facet.- Parameters:
position- of the neighborn- the neighbor
-
getNeighbor
public T getNeighbor(int position)
Get the neighbor at position.- Parameters:
position- the position- Returns:
- the neighbor
-
getNeighbors
public List<T> getNeighbors()
Get all neighbors.- Returns:
- all neighbors
-
replaceNeighbor
public void replaceNeighbor(int i, T f)Replaces a neighbor.- Parameters:
i- index of the neighbor to replacef- the new neighbor
-
indexOfNeighbor
public int indexOfNeighbor(T facet)
Get index of a neighbor.- Parameters:
facet- the neighboring facet- Returns:
- the index or -1 if facet is not a neighbor
-
-