java.lang.Object
org.bzdev.geom.BezierVertex
- All Implemented Interfaces:
Shape3D
A 3D shape consisting of a 'center' point connecting to a path
using a sequence of Bezier vertices. The path will typically
be a boundary of some other shape. The shape of this object is
determined by the center point, a vector defining a direction more
or less perpendicular to the boundary, and a height relative to the
center point and the direction of the vector.
This class can be used to create cones and similar shapes.
-
Constructor Summary
ConstructorsConstructorDescriptionBezierVertex(Path3D path, double height) Constructor given a vertex height.BezierVertex(Path3D path, double vx, double vy, double vz) Constructor given explicit vertex coordinates.BezierVertex(Path3D path, Point3D vertex) Constructor.BezierVertex(Path3D path, Point3D center, double height) Constructor given a vertex height and path center point. -
Method Summary
Modifier and TypeMethodDescriptionvoidflip()Reverse the orientation of this object.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.getSurfaceIterator(Transform3D tform) Get a surface iterator for this Shape3D.getTag()Get this object's tag.booleanDetermine if this Shape3D is a closed two-dimensional manifold.booleanDetermine if a surface is oriented.booleanDetermine if the orientation for this grid is reversed.booleanDetermine if this BezierVertex is well formed.booleanisWellFormed(Appendable out) Determine if this BezierVertex is well formed, logging error messages to an Appendable.intGet the number of components for this shape.voidprint()Print this object's control points.voidprint(Appendable out) Print this object's control points, specifying an output.voidPrint this object's control points, specifying a prefix.voidprint(String prefix, Appendable out) Print this object's control points, specifying a prefix and output.voidreverseOrientation(boolean reverse) Change the orientation of the Bézier triangles associated with this object.voidSet the color for a Bézier triangle specified by an indexvoidSet the default color for this shape.voidSet this object's tag.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bzdev.geom.Shape3D
getBoundary, getSurfaceIterator
-
Constructor Details
-
BezierVertex
Constructor.- Parameters:
path- a pathvertex- the vertex
-
BezierVertex
Constructor given a vertex height.- Parameters:
path- a pathheight- the height of the vertex
-
BezierVertex
Constructor given a vertex height and path center point.- Parameters:
path- a pathcenter- the center pointheight- the height of the vertex
-
BezierVertex
Constructor given explicit vertex coordinates.- Parameters:
path- a pathvx- the X coordinate of the vertexvy- the Y coordinate of the vertexvz- the Z coordinate of the vertex
-
-
Method Details
-
setTag
Set this object's tag.- Parameters:
tag- the tag
-
getTag
Get this object's tag.- Returns:
- the tag
-
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.
-
flip
public void flip()Reverse the orientation of this object. -
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 contained in this Bézier vertex- Returns:
- the color
-
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
-
getSurfaceIterator
Description copied from interface:Shape3DGet a surface iterator for this Shape3D. The surface iterator will represent the shape as a sequence of Bézier patches, Bézier triangles, and/or planar 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:
getSurfaceIteratorin interfaceShape3D- Parameters:
tform- a transform to apply to each control point; null for the identity transform- Returns:
- a surface iterator
-
getBoundary
Description copied from interface:Shape3DGet 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:
getBoundaryin interfaceShape3D- Returns:
- the boundary of this surface; null if a boundary cannot be computed
- See Also:
-
isWellFormed
public boolean isWellFormed()Determine if this BezierVertex is well formed.- Returns:
- true if the grid is well formed; false otherwise
-
isWellFormed
Determine if this BezierVertex 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:Shape3DGet 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:
getComponentin 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:Shape3DGet 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:Shape3DDetermine if this Shape3D is a closed two-dimensional manifold.- Specified by:
isClosedManifoldin interfaceShape3D- Returns:
- true if the surface is a closed two-dimensional manifold; false otherwise
-
isOriented
public boolean isOriented()Description copied from interface:Shape3DDetermine if a surface is oriented.- Specified by:
isOrientedin interfaceShape3D- Returns:
- true if the surface has an orientation; false if it does not
-
numberOfComponents
public int numberOfComponents()Description copied from interface:Shape3DGet the number of components for this shape. Components are connected shapes - surfaces for which every point can connect to any other point.- Specified by:
numberOfComponentsin interfaceShape3D- Returns:
- the number of components for this shape
-