- All Implemented Interfaces:
Shape3D
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor given a center point and a vector.Constructor given a center point.BezierCap
(PathIterator3D pit, Point3D center, double[] vector, double height, boolean cmode) Constructor given a path iterator for the boundary. -
Method Summary
Modifier and TypeMethodDescriptionstatic Point3D
findCenter
(Path3D boundary) Find a center point given a boundary.static double[]
findVector
(Path3D boundary, Point3D center) Find a vector roughly perpendicular to a boundary, given a center point.Get the boundary for this Shape3D.Get a bounding rectangular cuboid for a 3D shape.getColor()
Get the default color for this shape.getColor
(int i) Get the color for this shape given an index.getComponent
(int i) Get a component of this shape.int
Get the radial tessellation levelgetSurfaceIterator
(Transform3D tform) Get a surface iterator for this Shape3D.final SurfaceIterator
getSurfaceIterator
(Transform3D tform, int level) Get a surface iterator for this Shape3D, subdividing the surface.boolean
Determine if this Shape3D is a closed two-dimensional manifold.boolean
Determine if a surface is oriented.boolean
Determine if the orientation for this grid is reversed.boolean
Determine if this BezierCap is well formed.boolean
isWellFormed
(Appendable out) Determine if this BezierCap is well formed, logging error messages to an Appendable.int
Get the number of components for this shape.void
print()
Print this object's control points.void
print
(Appendable out) Print this object's control points, specifying an output.void
Print this object's control points, specifying a prefix.void
print
(String prefix, Appendable out) Print this object's control points, specifying a prefix and output.void
reverseOrientation
(boolean reverse) Change the orientation of the Bézier triangles associated with this object.void
Set the color for a Bézier triangle specified by an indexvoid
Set the default color for this shape.void
setCP111
(int i, double[] coords) Set the inner control point of a Bézier triangle.void
setRadialTessellation
(int level) Set the radial tessellation level.void
setSpoke
(int i, double[] coords) Set the intermediate control points for a spoke.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.geom.Shape3D
getBoundary
-
Constructor Details
-
BezierCap
Constructor. When cmode is false, the spokes will set the tangent at the center point to be perpendicular to this shape's vector and the tangent at the boundary to be parallel to this shape's vector. At both of these end points, the second derivative vanishes. The center point is computed by usingfindCenter(Path3D)
with the boundary as its argument. The vector is computed usingfindVector(Path3D,Point3D)
with the boundary and the center point as its arguments.- Parameters:
boundary
- the boundaryheight
- the height above the boundary for the central point of this shape.cmode
- true if the spokes should be circular; false if they should be a Bezier curve that is as 'flat' as possible except at a bend
-
BezierCap
Constructor given a center point. When cmode is false, the spokes will set the tangent at the center point to be perpendicular to this shape's vector and the tangent at the boundary to be parallel to this shape's vector. At both of these end points, the second derivative vanishes. The vector is computed usingfindVector(Path3D,Point3D)
with the boundary and the center point as its arguments.- Parameters:
boundary
- the boundarycenter
- the center pointheight
- the height above the boundary for the central point of this shape.cmode
- true if the spokes should be circular; false if they should be a Bezier curve that is as 'flat' as possible except at a bend
-
BezierCap
Constructor given a center point and a vector. When cmode is false, the spokes will set the tangent at the center point to be perpendicular to this shape's vector and the tangent at the boundary to be parallel to this shape's vector. At both of these end points, the second derivative vanishes.- Parameters:
boundary
- the boundarycenter
- the center pointvector
- a vector assumed to be perpendicular to the plane containing the boundary (or an approximation to such a plane, particularly if one does not exist)height
- the height above the boundary for the central point of this shape.cmode
- true if the spokes should be circular; false if they should be a Bezier curve that is as 'flat' as possible except at a bend
-
BezierCap
Constructor given a path iterator for the boundary. When cmode is false, the spokes will set the tangent at the center point to be perpendicular to this shape's vector and the tangent at the boundary to be parallel to this shape's vector. At both of these end points, the second derivative vanishes.- Parameters:
pit
- the path iterator for the boundarycenter
- the center pointvector
- a vector assumed to be perpendicular to the plane containing the boundary (or an approximation to such a plane, particularly if one does not exist)height
- the height above the boundary for the central point of this shape.cmode
- true if the spokes should be circular; false if they should be a Bezier curve that is as 'flat' as possible except at a bend
-
-
Method Details
-
findCenter
Find a center point given a boundary. The value returned is that for the center of mass of a line with a uniform density.- Parameters:
boundary
- the boundary- Returns:
- the center point; null if the path length of the boundary is zero (e.g., the boundary is empty)
-
findVector
Find a vector roughly perpendicular to a boundary, given a center point. The value returned is the average over the boundary of the cross product of a tangent vector to the boundary and a vector from the center point to the boundary, where the tangent vector is of unit length. When the boundary is a 'hole' in a surface, the vector will point in the direction of surface's orientation (boundaries when viewed from the 'outside' of the surface are represented by clockwise curves in this case).- Parameters:
boundary
- the boundarycenter
- the center point- Returns:
- the vector
-
reverseOrientation
public void reverseOrientation(boolean reverse) Change the orientation of the Bézier triangles associated with this object. This method affects the orientation of triangles provided by iterators. It does not change the values returned by calling methods such as .- Parameters:
reverse
- true if the orientation is the reverse of the one that was initially defined; false if the orientation is the same as the one that was initially defined.
-
isReversed
public boolean isReversed()Determine if the orientation for this grid is reversed.- Returns:
- true if the orientation is reversed; false if not
-
setColor
Set the default color for this shape.- Parameters:
c
- the color
-
setColor
Set the color for a Bézier triangle specified by an index- Parameters:
i
- the indexc
- the color
-
getColor
Get the default color for this shape. This is the color for the shape, excluding Bézier triangles for which an explicit color has been specified.- Returns:
- the color
-
getColor
Get the color for this shape given an index. This is the color for the shape, excluding Bézier triangles for which an explicit color has been specified. When a color for a specific index has been provided, that color is returned; otherwise the default color (if any) is returned.- Parameters:
i
- the index of a Bézier triangle.- Returns:
- the color
-
setCP111
Set the inner control point of a Bézier triangle.- Parameters:
i
- the index of a Bézier triangle.coords
- a vector of length 3 giving the control point that is not on the Bézier triangle's edge, with coords[0] containing the X value, coords[1] containing the Y value, and coords[2] containing the Z value.- Throws:
IllegalArgumentException
-
setSpoke
Set the intermediate control points for a spoke. Each spoke is a cubic Bézier curve starting at the center point, followed by two control points, and ending on a point on the boundary. The first intermediate control point is specified by coords[0], coords[1], and coords[2]. The second intermediate control point is specified by coords[3], coords[4], and coords[5].- Parameters:
i
- the index of a Bézier triangle.coords
- an array of length 6 (or more) containing the control points.- Throws:
IllegalArgumentException
-
print
Print this object's control points.- Throws:
IOException
- an IO error occurred
-
print
Print this object's control points, specifying an output.- Parameters:
out
- the output- Throws:
IOException
- an IO error occurred
-
print
Print this object's control points, specifying a prefix. Each line will start with the prefix (typically some number of spaces).- Parameters:
prefix
- the prefix- Throws:
IOException
- an IO error occurred
-
print
Print this object's control points, specifying a prefix and output. Each line will start with the prefix (typically some number of spaces).- Parameters:
prefix
- the prefixout
- the output- Throws:
IOException
- an IO error occurred
-
setRadialTessellation
public void setRadialTessellation(int level) Set the radial tessellation level. Increasing the level by 1 doubles the number of segments in the radial direction.- Parameters:
level
- the tessellation level
-
getRadialTessellation
public int getRadialTessellation()Get the radial tessellation level- Returns:
- the radial tesselation level;
-
getSurfaceIterator
Description copied from interface:Shape3D
Get a surface iterator for this Shape3D. The surface iterator will represent the shape as a sequence of Bézier patches and Bézier triangles, with the order of the sequence arbitrary.Unless the transform is an affine transform, the transformation is not exact. In this case, the patches and triangles that constitute the surface should be small enough that the transform can be approximated by an affine transform over the region containing the control points.
- Specified by:
getSurfaceIterator
in interfaceShape3D
- Parameters:
tform
- a transform to apply to each control point; null for the identity transform- Returns:
- a surface iterator
-
getSurfaceIterator
Description copied from interface:Shape3D
Get a surface iterator for this Shape3D, subdividing the surface. The surface iterator will represent the shape as a sequence of Bézier patches and Bézier triangles, with the order of the sequence arbitrary.Unless the transform is an affine transform, the transformation is not exact. In this case, the patches and triangles that constitute the surface after each is subdivided should be small enough that the transform can be approximated by an affine transform over the region containing the control points.
- Specified by:
getSurfaceIterator
in interfaceShape3D
- Parameters:
tform
- a transform to apply to each control point; null for the identity transformlevel
- the number of levels of partitioning (each additional level splits the previous level into quarters)- Returns:
- a surface iterator
-
getBoundary
Description copied from interface:Shape3D
Get the boundary for this Shape3D. For a closed surface, the boundary will be an empty path.Typically, a boundary will consist of a series of distinct closed subpaths. Subpaths are separated by segments whose type is {link PathIterator3D#SEG_MOVETO}. For a closed manifold, the boundary will be an empty path.
- Specified by:
getBoundary
in interfaceShape3D
- Returns:
- the boundary of this surface; null if a boundary cannot be computed
- See Also:
-
isWellFormed
public boolean isWellFormed()Determine if this BezierCap is well formed.- Returns:
- true if the grid is well formed; false otherwise
-
isWellFormed
Determine if this BezierCap is well formed, logging error messages to an Appendable.- Parameters:
out
- an Appendable for logging error messages- Returns:
- true if the grid is well formed; false otherwise
-
getComponent
Description copied from interface:Shape3D
Get a component of this shape. Components are connected shapes - surfaces for which every point can connect to any other point. The components are referenced by an index, specified as an integer in the range [0,n), where n is the number of manifold components. If n is zero, no index is valid.- Specified by:
getComponent
in interfaceShape3D
- Parameters:
i
- the component's index- Returns:
- a model containing the specified component
- Throws:
IllegalArgumentException
- the argument is out of range- See Also:
-
getBounds
Description copied from interface:Shape3D
Get a bounding rectangular cuboid for a 3D shape. The edges will be aligned with the X, Y and Z axes. The cuboid created may not be the smallest one possible (for example, shapes defined by Bézier surfaces may just use the control points to determine the cuboid as the convex hull for the control points includes all of the surface for parameters in the normal range [0,1]). -
isClosedManifold
public boolean isClosedManifold()Description copied from interface:Shape3D
Determine if this Shape3D is a closed two-dimensional manifold.- Specified by:
isClosedManifold
in interfaceShape3D
- Returns:
- true if the surface is a closed two-dimensional manifold; false otherwise
-
isOriented
public boolean isOriented()Description copied from interface:Shape3D
Determine if a surface is oriented.- Specified by:
isOriented
in interfaceShape3D
- Returns:
- true if the surface has an orientation; false if it does not
-
numberOfComponents
public int numberOfComponents()Description copied from interface:Shape3D
Get the number of components for this shape. Components are connected shapes - surfaces for which every point can connect to any other point.- Specified by:
numberOfComponents
in interfaceShape3D
- Returns:
- the number of components for this shape
-