java.lang.Object
org.bzdev.geom.Surface3D.Boundary
- Enclosing class:
- Surface3D
Class for computing the boundaries of a surface from a shape iterator.
The iterator will be modified when one of this class' constructors is
called.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an oriented surface.Boundary
(SurfaceIterator it, boolean oriented) Constructor specifying if the surface is oriented.Boundary
(SurfaceIterator it, boolean oriented, Appendable out) Constructor specifying if the surface is oriented, and with an Appendable for recording messages describing conditions that imply that a surface is not well formed.Boundary
(SurfaceIterator it, Appendable out) Constructor for an oriented surface with an Appendable for recording messages describing conditions that imply that a surface is not well formed. -
Method Summary
Modifier and TypeMethodDescriptionObject[]
Get the colors for each segment along the boundary.int[]
Get the edge numbers of the surface segments corresponding to each path segment along the boundary.getPath()
Get the path containing a surface's boundary.int[]
Get the indices for the segments bordering on this object's boundary.Object[]
getTags()
Get the tags for each segment along the boundary.boolean
Determine if the surface corresponding to this boundary is well formed.
-
Constructor Details
-
Boundary
Constructor for an oriented surface. A surface is oriented if it has two sides. By convention, for each of the patches and triangles that constitute a surface, the normal vector points in the direction implied by the right hand rule when traversing a patch's or triangle's vertices. By convention, for closed surfaces the normal vector points towards the outside of the surface.- Parameters:
it
- a surface iterator describing a surface whose boundary is to be computed
-
Boundary
Constructor specifying if the surface is oriented. A surface is oriented if it has two sides. By convention, for each of the patches and triangles that constitute a surface, the normal vector points in the direction implied by the right hand rule when traversing a patch's or triangle's vertices. By convention, for closed surfaces the normal vector points towards the outside of the surface.- Parameters:
it
- a surface iterator describing a surface whose boundary is to be computedoriented
- true if the surface is oriented; false if it is not oriented
-
Boundary
Constructor for an oriented surface with an Appendable for recording messages describing conditions that imply that a surface is not well formed. A surface is oriented if it has two sides. By convention, for each of the patches and triangles that constitute a surface, the normal vector points in the direction implied by the right hand rule when traversing a patch's or triangle's vertices. By convention, for closed surfaces the normal vector points towards the outside of the surface.- Parameters:
it
- a surface iterator describing a surface whose boundary is to be computedout
- an object used to record messages describing conditions that imply that a surface is not well formed.
-
Boundary
Constructor specifying if the surface is oriented, and with an Appendable for recording messages describing conditions that imply that a surface is not well formed. A surface is oriented if it has two sides. By convention, for each of the patches and triangles that constitute a surface, the normal vector points in the direction implied by the right hand rule when traversing a patch's or triangle's vertices. By convention, for closed surfaces the normal vector points towards the outside of the surface.- Parameters:
it
- a surface iterator describing a surface whose boundary is to be computedoriented
- true if the surface is oriented; false if it is not orientedout
- an object used to record messages describing conditions that imply that a surface is not well formed.
-
-
Method Details
-
isWellFormed
public boolean isWellFormed()Determine if the surface corresponding to this boundary is well formed.Two edges match if they attach the same vertices. For an oriented surface, the direction of an edge is the direction in which a segment would be traversed counterclockwise when viewed from the outside of the surface, thus determining which vertex is the start of and edge and which is its end. An oriented surface is well formed if zero or two edges connect each pair of vertices, and if the directions are opposite for the two-vertex case, and if no edge has zero length. A non-oriented surface is well formed if either zero or two edges connect each pair of vertices and if no edge has zero length.
Well-formed surfaces are essentially surfaces that do not have a boundary.
- Returns:
- true if it is well formed; false otherwise
-
getPath
Get the path containing a surface's boundary.- Returns:
- the path representing a surface's boundary
-
getTags
Get the tags for each segment along the boundary. When using a path iterator for the boundary, counting the lineTo and moveTo operations will generate the index for the corresponding segment.- Returns:
- the tags in the same order as the boundary's path segments; null if the surface is not well formed
-
getColors
Get the colors for each segment along the boundary. When using a path iterator for the boundary, counting the lineTo and moveTo operations will generate the index for the corresponding segment.- Returns:
- the colors in the same order as the boundary's path segments; null if the surface is not well formed
-
getSegmentIndices
public int[] getSegmentIndices()Get the indices for the segments bordering on this object's boundary. When using a path iterator for the boundary, counting the lineTo and moveTo operations will generate the index, into the array returned, for the corresponding segment's index. The index for a segment is a count of the number of calls toSurfaceIterator.next()
used to obtain the specific segment from the surface iterator used in this object's constructor.- Returns:
- an array containing the segment indices; null if the surface is not well formed
-
getEdgeNumbers
public int[] getEdgeNumbers()Get the edge numbers of the surface segments corresponding to each path segment along the boundary. When using a path iterator for the boundary, counting the lineTo and moveTo operations will generate the index, into the array returned, for the corresponding segment.The edge segments are defined as follows:
- For a planar triangle,
- edge 0 is the edge from vertex 1 to vertex 2
- edge 1 is the edge from vertex 2 to vertex 3
- edge 2 is the edge from vertex 3 to vertex 1
- For a cubic triangle, described in (u,v) coordinates
where the barycentric coordinates are (u, v, w) with
w = 1 - u - v,
- edge 0 is the edge from (0, 0) to (1, 0)
- edge 1 is the edge from (1, 0) to (0, 1)
- edge 2 is the edge from (0, 1) to (0,0)
- For a cubic patch, described in (u,v) coordinates
- edge 0 is the edge from (0, 0) to (1, 0)
- edge 1 is the edge from (1, 0) to (1, 1)
- edge 2 is the edge from (1, 1) to (0, 1)
- edge 3 is the edge from (0, 1) to (0, 0)
- Returns:
- the edge numbers for the surface segments adjacent to the path segments along the boundary; null if the 3D shape is not well formed
- For a planar triangle,
-