- All Implemented Interfaces:
Shape3D
,SurfaceOps
- Direct Known Subclasses:
Surface3D.Double
,Surface3D.Float
A surface is represented by a set of segments. There is an orientation defined for each type based on the right-hand rule:
- for a planar triangle - a triangle whose edges are straight lines - connecting vertices v1, v2, and v3, the orientation is determined by the direction of the normal vector given by (va × vb) / |va × vb|, where va = v2 - v1 and vb = v3 - v1. This is equivalent to traversing the vertices in the order v1, v2, v3 using the right-hand rule. When barycentric coordinates are used, the values of (u,v) are (0,0) for vertex v1, (1, 0) for vertex v2, and (0,1) for vertex v3.
- for a cubic triangle, which uses barycentric coordinates u, v, w (where u + v + w = 1), the orientation is provide by the right-hand rule applied to the sequence of vertices whose (u,v) coordinates are (0,0), (1, 0), and (0,1) respectively.
- for a cubic patch, which uses coordinates (u, v), the orientation is provide by the right-hand rule applied to the sequence of vertices whose (u,v) coordinates are (0,0), (1, 0), (1, 1), and (0,1) respectively.
isWellFormed()
determines if this constraint is met. It also
tests that each edge is an edge of at most two segments.
When a surface does not have an orientation, each edge may be shared by at most two segments, with the constraint on the direction of traversal ignored. An example of a surface without an orientation is a Möbius strip (the models made by gluing a paper strip together with a half-twist are topologically cylinders as the edges have a non-zero but very small width - the shape is such that cutting down the center is equivalent to cutting a cylinder along a Möbius strip.)
Well-formed surfaces have a path called a boundary associated with them. For a closed surface (e.g., an approximation to a sphere), the boundary is an empty path. In some cases, the boundary may consist of two or more disjoint curves.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class for computing the boundaries of a surface from a shape iterator.static class
Surface3D class that stores the coordinates of control points as double-precision numbers.static class
Surface3D class that stores the coordinates of control points as single-precision numbers. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAreaToAdder
(Adder adder, SurfaceIterator si) Add the surface area for those segments associated with a surface iterator to an Adder.void
addCubicPatch
(double[] controlPoints) Add a cubic Bézier patch to this surface.void
addCubicPatch
(double[] controlPoints, Color color) Add a cubic Bézier patch to this surface, specifying a color.abstract void
addCubicPatch
(double[] controlPoints, Color color, Object tag) Add a cubic Bézier patch to this surface, specifying a color and a tag.void
addCubicPatch
(double[] controlPoints, Object tag) Add a cubic Bézier patch to this surface, specifying a tag.void
addCubicTriangle
(double[] controlPoints) Add a cubic Bézier triangle to this surface.void
addCubicTriangle
(double[] controlPoints, Color color) Add a cubic Bézier triangle to this surface, specifying a color.abstract void
addCubicTriangle
(double[] controlPoints, Color color, Object tag) Add a cubic Bézier triangle to this surface, specifying a color and a tag.void
addCubicTriangle
(double[] controlPoints, Object tag) Add a cubic Bézier triangle to this surface, specifying a tag.void
addCubicVertex
(double[] controlPoints) Add a cubic vertex to this surface.void
addCubicVertex
(double[] controlPoints, Color color) Add a cubic vertex to this surface, specifying a color.abstract void
addCubicVertex
(double[] controlPoints, Color color, Object tag) Add a cubic vertex to this surface, specifying a color and tag.void
addCubicVertex
(double[] controlPoints, Object tag) Add a cubic vertex to this surface, specifying a tag.void
addCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5) Add a cubic vertex to this surface.void
addCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color) Add a cubic vertex to this surface, specifying a color.void
addCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color, Object tag) Add a cubic vertex to this surface, specifying a color and tag.void
addCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Object tag) Add a cubic vertex to this surface, specifying a tag.void
addCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz) Add a cubic vertex to this surface.void
addCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color) Add a cubic vertex to this surface, specifying a color.void
addCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color, Object tag) Add a cubic vertex to this surface, specifying a color and tag.void
addCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Object tag) Add a cubic vertex to this surface, specifying a tag.void
addFlippedCubicPatch
(double[] controlPoints) Add a cubic Bézier patch to this surface, reversing the orientation of the patch.void
addFlippedCubicPatch
(double[] controlPoints, Color color) Add a cubic Bézier patch to this surface, specifying a color and reversing the orientation of the patch.abstract void
addFlippedCubicPatch
(double[] controlPoints, Color color, Object tag) Add a cubic Bézier patch to this surface, specifying a color and a tag, and reversing the patch's orientation.void
addFlippedCubicPatch
(double[] controlPoints, Object tag) Add a cubic Bézier patch to this surface, specifying a tag and reversing the orientation of the patch.void
addFlippedCubicTriangle
(double[] controlPoints) Add a cubic Bézier triangle to this surface, reversing the triangle's orientation by exchanging its U and V coordinates.void
addFlippedCubicTriangle
(double[] controlPoints, Color color) Add a cubic Bézier triangle to this surface, specifying a color and reversing the triangle's orientation by exchanging its U and V coordinates.abstract void
addFlippedCubicTriangle
(double[] controlPoints, Color color, Object tag) Add a cubic Bézier triangle to this surface, specifying a color and a tag, and reversing the triangle's orientation by exchanging its U and V coordinates, Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].void
addFlippedCubicTriangle
(double[] controlPoints, Object tag) Add a cubic Bézier triangle to this surface, specifying a tag and reversing the triangle's orientation by exchanging its U and V coordinates.void
addFlippedCubicVertex
(double[] controlPoints) Add a flipped cubic vertex to this surface.void
addFlippedCubicVertex
(double[] controlPoints, Color color) Add a flipped cubic vertex to this surface, specifying a color.abstract void
addFlippedCubicVertex
(double[] controlPoints, Color color, Object tag) Add a flipped cubic vertex to this surface, specifying a color and tag.void
addFlippedCubicVertex
(double[] controlPoints, Object tag) Add a flipped cubic vertex to this surface, specifying a tag.void
addFlippedCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5) Add a flipped cubic vertex to this surface.void
addFlippedCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color) Add a flipped cubic vertex to this surface, specifying a color.void
addFlippedCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color, Object tag) Add a flipped cubic vertex to this surface, specifying a color and tag.void
addFlippedCubicVertex
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Object tag) Add a flipped cubic vertex to this surface, specifying a tag.void
addFlippedCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz) Add a flipped cubic vertex to this surface.void
addFlippedCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color) Add a flipped cubic vertex to this surface, specifying a color.void
addFlippedCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color, Object tag) Add a flipped cubic vertex to this surface, specifying a color and tag.void
addFlippedCubicVertex
(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Object tag) Add a flipped cubic vertex to this surface, specifying a tag.void
addFlippedPlanarTriangle
(double[] controlPoints) Add a planner triangle to the surface, specifying a control-point array and reversing the triangle's orientation.void
addFlippedPlanarTriangle
(double[] controlPoints, Color color) Add a planner triangle to the surface, specifying a control-point array and color, and reversing the triangle's orientation.abstract void
addFlippedPlanarTriangle
(double[] controlPoints, Color color, Object tag) Add a planner triangle to the surface, reversing the triangle's orientation by exchanging the triangle's U and V coordinates, and specifying a control-point array, a color, and a tag.void
addFlippedPlanarTriangle
(double[] controlPoints, Object tag) Add a planner triangle to the surface, specifying a control-point array and tag, and reversing the triangle's orientation.void
addFlippedPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) Add a planner triangle to the surface, reversing the triangle's orientation and specifying the coordinates of the vertices.void
addFlippedPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color) Add a planner triangle to the surface, reversing the triangle's orientation, specifying the coordinates of the vertices, and specifying a color.void
addFlippedPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color, Object tag) Add a planner triangle to the surface, reversing the triangle's orientation, and specifying the coordinates of the vertices, a color, and a tag.void
addFlippedPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Object tag) Add a planner triangle to the surface, reversing the triangle's orientation, specifying the coordinates of the vertices, and providing a tag.void
addPlanarTriangle
(double[] controlPoints) Add a planner triangle to the surface, specifying a control-point array.void
addPlanarTriangle
(double[] controlPoints, Color color) Add a planner triangle to the surface, specifying a control-point array and color.abstract void
addPlanarTriangle
(double[] controlPoints, Color color, Object tag) Add a planner triangle to the surface, specifying a control-point array, a color, and a tag.void
addPlanarTriangle
(double[] controlPoints, Object tag) Add a planner triangle to the surface, specifying a control-point array and a tag.void
addPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) Add a planner triangle to the surface, specifying the coordinates of the vertices.void
addPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color) Add a planner triangle to the surface, specifying the coordinates of the vertices and specifying a color.void
addPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color, Object tag) Add a planner triangle to the surface, specifying the coordinates of the vertices, a color, and a tag.void
addPlanarTriangle
(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Object tag) Add a planner triangle to the surface, specifying the coordinates of the vertices and providing a tag.static void
addVolumeToAdder
(Adder adder, SurfaceIterator si, Point3D refPoint) Add the surface-integral contributions, used in computing a volume for those segments associated with a surface iterator, to an Adder.final void
Append the surface segments specified by another surface.final void
append
(Shape3D surface, Transform3D transform) Append the surface segments specified by another surface after applying a transformation.abstract void
Append the surface segments specified by a surface iterator.double
area()
Compute the area of this surface.double
area
(boolean parallel) Compute the area of this surface, perhaps in parallelstatic Point3D
centerOfMassOf
(Shape3D shape) Compute the center of mass of a shape assuming uniform density.static Point3D
centerOfMassOf
(Shape3D shape, boolean parallel, int size) Compute the center of mass of a shape assuming uniform density, specifying whether to use a sequential or parallel computation.static Point3D
centerOfMassOf
(Shape3D shape, double v) Compute the center of mass of a shape assuming uniform density and given the shape's volume.static Point3D
centerOfMassOf
(Shape3D shape, double v, boolean parallel, int size) Compute the center of mass of a shape assuming uniform density and given the shape's volume, and specifying if the computation should be done in parallel.static Point3D
centerOfMassOf
(Shape3D shape, double v, double limit) Compute the center of mass of a shape assuming uniform density and given the shape's volume and a flatness limit.static Point3D
centerOfMassOf
(Shape3D shape, double v, double limit, boolean parallel, int size) Compute the center of mass of a shape assuming uniform density and given the shape's volume and a flatness limit, and specifying if the computation should be done in parallel.static boolean
checkPatchCorners
(double[] ucoords0, double[] ucoords1, double[] vcoords0, double[] vcoords1) Consistency test for the corners of a patch.static boolean
checkPatchCorners
(double[] ucoords0, double[] ucoords1, double[] vcoords0, double[] vcoords1, Appendable out) Consistency test for the corners of a patch, with error messages.abstract void
computeBoundary
(Appendable out, boolean multipleEdges) Compute the boundary of this surface.static void
configArea
(int nCT, int nCP) Configure the number of points used in an area computation for Gaussian-Legendre integration.static Shape3D[]
createComponents
(SurfaceIterator si, Appendable out) Create an array of components given a surface iterator.abstract Surface3D
createTransformedSurface
(Transform3D transform) Create a new surface by applying a transform to this surface.static void
cubicVertexToPatch
(double[] coords, int offset, double[] pcoords, int poffset) Convert a cubic vertex to a cubic patchGet a path that is the boundary of this surface.int[]
Get the edge numbers of the surface segments corresponding to each path segment along the boundary.int[]
Get the indices for the segments bordering on this object's boundary.Get a bounding rectangular cuboid that encloses all of the points of this surface.getComponent
(int i) Get the ith component of a surface The parameter's value is in the range [0,n), where n is the number of components for this surface.int
getSegment
(int i, double[] coords) Get the control points for the ith segment for this surface.protected abstract void
getSegment
(int length, int offset, double[] coords) Get a segment's control points.getSegmentColor
(int i) Get the color for the ith segment of this surface.getSegmentTag
(int i) Get the tag for a segment.boolean
Determine if a surface is a closed manifold.boolean
Determine if a surface is oriented.boolean
Determine if the surface is well formed.boolean
isWellFormed
(Appendable out) Determine if the surface is well formed, recording errors on an Appendable.boolean
isWellFormed
(Appendable out, boolean multipleEdges) Determine if the surface is well formed, recording errors on an Appendable, with a choice of how multiple edges at a single point on a boundary are treated.static double[][]
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p.static double[][]
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying an estimate of the number of segments in a shape and whether or not the moments should be computed in parallel.static double[][]
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume.static double[][]
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume and whether or not the computation should be performed in parallel.static double[][]
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume and a flatness parameter.static double[][]
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume, a flatness parameter, and whether or not the computation should be performed in parallel.int
Get the number of components for a surface.static void
printTag
(Appendable out, String prefix, Object tag) Print a tag used to label Surface3D features.final void
reset()
Reset the surface by removing all of its segments.abstract void
Reverse the orientation of this surface.static void
reverseOrientation
(int type, double[] carray) Reverse the orientation of a surface segment for a double-precision control-point array.static void
reverseOrientation
(int type, float[] carray) Reverse the orientation of a surface segment for a single-precision control-point array.static void
segmentValue
(double[] results, int type, double[] coords, double u, double v) Get coordinates for a specific point on a segment of a surface.static void
segmentValue
(double[] results, int type, double[] coords, double u, double v, double w) Get the coordinates corresponding to a point at a specific location on a segment of a surface, using barycentric coordinates.static Point3D
segmentValue
(int type, double[] coords, double u, double v) Get a point at a specific location on a segment of a surface.static Point3D
segmentValue
(int type, double[] coords, double u, double v, double w) Get a point at a specific location on a segment of a surface, using barycentric coordinates.void
setStackTraceMode
(boolean mode) Set stacktrace mode.static void
setupCP111ForTriangle
(double[] scoords) Set the control point P111,the one that is not a control point for edge of a cubic Bézier triangle, based on a quadratic.static void
setupCP111ForTriangle
(double x, double y, double z, double[] scoords) Set up the control point P111, the one that is not a control point for the edge edge of a cubic Bézier triangle, so that the surface at barycentric coordinates (1/3, 1/3, 1/3) will go through a specified point.static void
setupCP111ForTriangle
(double x, double y, double z, double[] scoords, double u, double v) Set up the control point P111, the one that is not a control point for the edge of a cubic Bézier triangle, so that the surface at barycentric coordinates (u, v, 1-(u+v)) will go through a specified point.static void
setupCP111ForTriangle
(double x, double y, double z, double[] scoords, int offset) Set up the control point P111, the one that is not a control point for the edge edge of a cubic Bézier triangle, so that the surface at barycentric coordinates (1/3, 1/3, 1/3) will go through a specified point, with the point stored in an offseted array.static void
setupPlanarCP111ForTriangle
(double[] scoords) Set up the control point P111, the one that is not a control point for an edge of the cubic Bézier triangle, so that the surface at barycentric coordinates (1/3, 1/3, 1/3) will go through a point on the plane passing through the vertices of the the cubic Bézier triangle.static void
setupRestForPatch
(double[] ccoords) Set up the remaining control points for a cubic Bézier patch, using default values.static void
setupRestForPatch
(double urange, double vrange, double[] d2Pdsdt00, double[] d2Pdsdt10, double[] d2Pdsdt01, double[] d2Pdsdt11, double[] ccoords) Set up the remaining control points for a cubic Bézier patch, specifying derivatives at the corners.static void
setupU0ForPatch
(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=0.static void
setupU0ForPatch
(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=0, where the edge's control points are given by explicit coordinates and an array.static void
setupU0ForTriangle
(double[] pcoords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter u=0 (the edge where the coordinates (u,v) vary from (0,0) to (0,1)).static void
setupU0ForTriangle
(double[] pcoords, double[] scoords, boolean reverse, int offset) Set up offsetted elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter u=0 (the edge where the coordinates (u,v) vary from (0,0) to (0,1)).static void
setupU0ForTriangle
(double lastX, double lastY, double lastZ, double[] coords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter u=0 (the edge where the coordinates (u,v) vary from (0,0) to (0,1)), using the arrays retrieved by PathIterator3D.static void
setupU1ForPatch
(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=1.static void
setupU1ForPatch
(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=1, where the edge's control points are given by explicit coordinates and an array.static void
setupV0ForPatch
(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=0.static void
setupV0ForPatch
(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=0, where the edge's control points are given by explicit coordinates and an array.static void
setupV0ForTriangle
(double[] pcoords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter v=0 (the edge where the coordinates (u,v) vary from (0,0) to (1,0)).static void
setupV0ForTriangle
(double[] pcoords, double[] scoords, boolean reverse, int offset) Set up offseted elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter v=0 (the edge where the coordinates (u,v) vary from (0,0) to (1,0)).static void
setupV0ForTriangle
(double lastX, double lastY, double lastZ, double[] coords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter v=0 (the edge where the coordinates (u,v) vary from (0,0) to (1,0)), using the arrays retrieved by PathIterator3D.static void
setupV1ForPatch
(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=1.static void
setupV1ForPatch
(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=1, where the edge's control points are given by explicit coordinates and an array.static void
setupW0ForTriangle
(double[] pcoords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter w=0 (the edge where the coordinates (u,v) vary from (1,0) to (0,1)).static void
setupW0ForTriangle
(double[] pcoords, double[] scoords, boolean reverse, int offset) Set up offsetted elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter w=0 (the edge where the coordinates (u,v) vary from (1,0) to (0,1)).static void
setupW0ForTriangle
(double lastX, double lastY, double lastZ, double[] coords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter w=0 (the edge where the coordinates (u,v) vary from (1,0) to (0,1))), using the arrays retrieved by PathIterator3.int
size()
Get the number of segments contained in this surface.abstract void
transform
(Transform3D tform) Apply a transform to the surface.static void
triangleToPatch
(double[] tcoords, int toffset, double[] pcoords, int poffset) Convert the control-point coordinates for a cubic Bézier triangle into those for a cubic Bézier patch that has the same shape.static void
uTangent
(double[] results, int type, double[] coords, double u, double v) Get components of the "u" tangent vector at a specific point on a segment of a surface.double
volume()
Compute the volume enclosed by this surface.double
volume
(boolean parallel) Compute the volume enclosed by this surface, optionally in parallel.static void
vTangent
(double[] results, int type, double[] coords, double u, double v) Get components of the "v" tangent vector at a specific point on a segment of a surface.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, getSurfaceIterator, getSurfaceIterator
-
Method Details
-
size
public int size()Get the number of segments contained in this surface.- Specified by:
size
in interfaceSurfaceOps
- Returns:
- the number of segments contained in this surface
-
getSegment
protected abstract void getSegment(int length, int offset, double[] coords) Get a segment's control points. The values for the offset parameter are determined by the methodgetSegment(int, double[])
. As a result, this method should only be used by subclasses.- Parameters:
length
- the number of entries in the coords argument that will be filled, starting at index 0offset
- an index indicating where the control point data will be foundcoords
- an array to hold the results
-
getSegment
Get the control points for the ith segment for this surface. The control points depend on the segment type. The number entries in the coords array is- 48 when the return value is
SurfaceIterator.CUBIC_PATCH
. - 30 when the return value is
SurfaceIterator.CUBIC_TRIANGLE
. - 15 when the return value is
SurfaceIterator.CUBIC_VERTEX
. - 12 when the return value is
SurfaceIterator.PLANAR_TRIANGLE
.
Valid indices are non-negative integers smaller than the value returned by
size()
.- Specified by:
getSegment
in interfaceSurfaceOps
- Parameters:
i
- the indexcoords
- an array to hold the results- Returns:
- the segment type (
SurfaceIterator.CUBIC_PATCH
,SurfaceIterator.CUBIC_TRIANGLE
,SurfaceIterator.PLANAR_TRIANGLE
, orSurfaceIterator.CUBIC_VERTEX
) - Throws:
IllegalArgumentException
- the index i is out of range
- 48 when the return value is
-
getSegmentTag
Get the tag for a segment. Valid indices are non-negative integers smaller than the value returned bysize()
.- Specified by:
getSegmentTag
in interfaceSurfaceOps
- Parameters:
i
- the index of the segment- Returns:
- the tag for this segment
- Throws:
IllegalArgumentException
- the index is out of range
-
getSegmentColor
Description copied from interface:SurfaceOps
Get the color for the ith segment of this surface.- Specified by:
getSegmentColor
in interfaceSurfaceOps
- Parameters:
i
- the index of the segment- Returns:
- the color for this segment; null if none is defined
-
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
-
setStackTraceMode
public void setStackTraceMode(boolean mode) Set stacktrace mode. When stacktrace mode is on (true), surface segments are tagged with a stack trace taken at the point when the segment was created. The default value is false.- Parameters:
mode
- true to turn on stacktrace mode; false to turn it off
-
printTag
Print a tag used to label Surface3D features.- Parameters:
out
- the outputprefix
- a prefix to print at the start of a linetag
- the tag itself- Throws:
IOException
- an I/O error occurred
-
createComponents
Create an array of components given a surface iterator. This is provided as a convenience for classes implementing the Shape3D interface.- Parameters:
si
- the surface iteratorout
- an object to log error messages- Returns:
- a Shape3D array containing the components
-
numberOfComponents
public int numberOfComponents()Get the number of components for a surface. Each component is a connected region of a surface.- Specified by:
numberOfComponents
in interfaceShape3D
- Returns:
- the number of components for this surface; 0 if the surface is not well formed (e.g., is not a 2-manifold)
-
getComponent
Get the ith component of a surface The parameter's value is in the range [0,n), where n is the number of components for this surface. Each component is a connected region of a surface.- Specified by:
getComponent
in interfaceShape3D
- Parameters:
i
- the index for the ith component of this surface- Returns:
- the ith component of a surface
- Throws:
IllegalArgumentException
- the argument is out of rangeIllegalStateException
- the surface is not well formed- See Also:
-
append
Append the surface segments specified by a surface iterator.- Parameters:
si
- the surface iterator
-
append
Append the surface segments specified by another surface.- Parameters:
surface
- the other surface
-
append
Append the surface segments specified by another surface after applying a transformation.- Parameters:
surface
- the other surfacetransform
- the transform to apply to a surface's control points
-
getBounds
Get a bounding rectangular cuboid that encloses all of the points of this surface. The cuboid will have its edges parallel to the X, Y and Z axes and may not be the smallest possible cuboids - for planar and Bézier surface segments, the control points, whose convex hull enclose the segment, are used to find the dimensions and locations of the cuboid: the bounding cuboid is typically used as a quick test to determine if two objects do not overlap, with more expense tests used if their bounding rectangles do overlap. -
computeBoundary
Compute the boundary of this surface. This method is public because org.bzdev.p3d.Model3D uses it.The second argument, when true, relaxes some tests for error conditions. Normally this argument should be false. A choice is provided because the Model3D class uses a partial surface where planar triangles are not included. This can result in cases where multiple boundary segments of this partial surface share the same starting points in the partial surface, but not the full surface.
- Parameters:
out
- an Appendable for logging error messagesmultipleEdges
- true if multiple edges on the boundary can begin at the same vertex; false (the default) otherwise
-
isWellFormed
Determine if the surface is well formed, recording errors on an Appendable. A surface is considered to be well formed if it is a 2-manifold: each edge of each segment is attached to at most one other segment and segments join only at vertices. For two segments with a common edge, that edge will be traversed in opposite directions when the edges of each segment are traversed counterclockwise (around their normal vectors) and the surface is oriented.- Parameters:
out
- an Appendable used to record error messages- Returns:
- true if a surface is well formed; false otherwise
-
isWellFormed
Determine if the surface is well formed, recording errors on an Appendable, with a choice of how multiple edges at a single point on a boundary are treated. A surface is considered to be well formed if it is a 2-manifold: each edge of each segment is attached to at most one other segment and segments join only at vertices. For two segments with a common edge, that edge will be traversed in opposite directions when the edges of each segment are traversed counterclockwise (around their normal vectors) and the surface is oriented.The second argument, when true, relaxes some tests for error conditions. Normally this argument should be false. A choice is provided because the Model3D class uses a partial surface where planar triangles are not included. This can result in cases where multiple boundary segments of this partial surface share the same starting points in the partial surface, but not the full surface.
- Parameters:
out
- an Appendable used to record error messagesmultipleEdges
- true if a boundary can have multiple edges that start at the same point; false otherwise- Returns:
- true if a surface is well formed; false otherwise
-
isWellFormed
public boolean isWellFormed()Determine if the surface is well formed. A surface is considered to be well formed if it is a 2-manifold: each edge of each segment is attached to at most one other segment and segments join only at vertices. For two segments with a common edge, that edge will be traversed in opposite directions when the edges of each segment are traversed counterclockwise (around their normal vectors) and the surface is oriented.- Returns:
- true if a surface is well formed; false otherwise
-
getBoundary
Get a path that is the boundary of this surface. The path returned will be an empty path if the surface has no boundary.- Specified by:
getBoundary
in interfaceShape3D
- Returns:
- the boundary of this surface; null if a boundary cannot be computed
- See Also:
-
getBoundarySegmentIndices
public int[] getBoundarySegmentIndices()Description copied from interface:SurfaceOps
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.- Specified by:
getBoundarySegmentIndices
in interfaceSurfaceOps
- Returns:
- an array containing the segment indices; null if the surface is not well formed
-
getBoundaryEdgeNumbers
public int[] getBoundaryEdgeNumbers()Description copied from interface:SurfaceOps
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's edge number.The edge numbers 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)
- Specified by:
getBoundaryEdgeNumbers
in interfaceSurfaceOps
- 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,
-
reset
public final void reset()Reset the surface by removing all of its segments. This method should not be called if a surface iterator is in use. -
createTransformedSurface
Create a new surface by applying a transform to this surface.- Parameters:
transform
- the transform- Returns:
- the new surface
-
reverseOrientation
public static void reverseOrientation(int type, double[] carray) Reverse the orientation of a surface segment for a double-precision control-point array. The array argument stores the control points in the order specified byaddCubicPatch(double[])
,addCubicTriangle(double[])
, andaddPlanarTriangle(double[])
.- Parameters:
type
- the type of the segment (SurfaceIterator.PLANAR_TRIANGLE, SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.CUBIC_PATCH, or SurfaceIterator.CUBIC_VERTEX)carray
- the array containing the control points
-
reverseOrientation
public static void reverseOrientation(int type, float[] carray) Reverse the orientation of a surface segment for a single-precision control-point array. The array argument stores the control points in the order specified byaddCubicPatch(double[])
,addCubicTriangle(double[])
, andaddPlanarTriangle(double[])
.- Parameters:
type
- the type of the segment (SurfaceIterator.PLANAR_TRIANGLE, SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.CUBIC_PATCH, or SurfaceIterator.CUBIC_VERTEX)carray
- the array containing the control points
-
setupV0ForPatch
public static void setupV0ForPatch(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=0. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter u is 0.0, and the last control point is the point on the curve where the parameter u is 1.0. There are a total of four control points for this curve.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P0,0, P1,0, P2,0, and P3,0.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The initial control point in the input array for
setupU0ForPatch(double[],double[],boolean)
is the same as the initial control point in the input array for this method. In addition, the initial control point in the input array forsetupU1ForPatch(double[],double[],boolean)
is the same as the final point in the input array for this method. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
checkPatchCorners
public static boolean checkPatchCorners(double[] ucoords0, double[] ucoords1, double[] vcoords0, double[] vcoords1) Consistency test for the corners of a patch.- Parameters:
ucoords0
- the coordinates for the U0 edge of the patchucoords1
- the coordinates for the U1 edge of the patchvcoords0
- the coordinates for the V0 edge of the patchvcoords1
- the coordinates for the V1 edge of the patch- Returns:
- true on success; false on failure
-
checkPatchCorners
public static boolean checkPatchCorners(double[] ucoords0, double[] ucoords1, double[] vcoords0, double[] vcoords1, Appendable out) throws IOException Consistency test for the corners of a patch, with error messages.- Parameters:
ucoords0
- the coordinates for the U0 edge of the patchucoords1
- the coordinates for the U1 edge of the patchvcoords0
- the coordinates for the V0 edge of the patchvcoords1
- the coordinates for the V1 edge of the patchout
- anAppendable
to record error messages- Returns:
- true on success; false on failure
- Throws:
IOException
- an IO error occurred
-
setupV0ForPatch
public static void setupV0ForPatch(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=0, where the edge's control points are given by explicit coordinates and an array. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter u is 0.0, and the last control point is the point on the curve where the parameter u is 1.0. There are a total of four control points for this curve. The first control point for this curve is specified by the first three arguments and the remaining control points ares specified by the forth argument.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P0,0, P1,0, P2,0, and P3,0.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The initial control point in the input array for
setupU0ForPatch(double[],double[],boolean)
is the same as the initial control point in the input array for this method. In addition, the initial control point in the input array forsetupU1ForPatch(double[],double[],boolean)
is the same as the final point in the input array for this method. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
x
- the X coordinate of the initial control point for the edgey
- the Y coordinate of the initial control point for the edgez
- the Z coordinate of the initial control point for the edgepcoords
- the coordinates for the remaining control points of the cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupV1ForPatch
public static void setupV1ForPatch(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=1. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter u is 0.0, and the last control point is the point on the curve where the parameter u is 1.0. There are a total of four control points for this curve.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P0,3, P1,3, P2,3, and P3,3.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The final control point for the input array for
setupU0ForPatch(double[],double[],boolean)
and the initial control point as for the input array of this method are the same. In addition the final control point of the input array forsetupU1ForPatch(double[],double[],boolean)
and the final control point of the input array for this method are the same. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupV1ForPatch
public static void setupV1ForPatch(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter v=1, where the edge's control points are given by explicit coordinates and an array. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter u is 0.0, and the last control point is the point on the curve where the parameter u is 1.0. There are a total of four control points for this curve. The first control point for this curve is specified by the first three arguments and the remaining control points ares specified by the forth argument.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P0,3, P1,3, P2,3, and P3,3.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The final control point for the input array for
setupU0ForPatch(double[],double[],boolean)
and the initial control point as for the input array of this method are the same. In addition the final control point of the input array forsetupU1ForPatch(double[],double[],boolean)
and the final control point of the input array for this method are the same. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
x
- the X coordinate of the initial control point for the edgey
- the Y coordinate of the initial control point for the edgez
- the Z coordinate of the initial control point for the edgepcoords
- the coordinates for the remaining control points of the cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupU0ForPatch
public static void setupU0ForPatch(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=0. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P0,0, P0,1, P0,2, and P0,3.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The initial control point in the input array for
setupV0ForPatch(double[],double[],boolean)
is the same as the initial control point in the input array for this method. In addition, the initial control point in the input array forsetupV1ForPatch(double[],double[],boolean)
is the same as the final point in the input array for this method. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupU0ForPatch
public static void setupU0ForPatch(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=0, where the edge's control points are given by explicit coordinates and an array. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve. The first control point for this curve is specified by the first three arguments and the remaining control points ares specified by the forth argument.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P0,0, P0,1, P0,2, and P0,3.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 9. The initial control point in the input array for
setupV0ForPatch(double[],double[],boolean)
is the same as the initial control point in the input array for this method. In addition, the initial control point in the input array forsetupV1ForPatch(double[],double[],boolean)
is the same as the final point in the input array for this method. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
x
- the X coordinate of the initial control point for the edgey
- the Y coordinate of the initial control point for the edgez
- the Z coordinate of the initial control point for the edgepcoords
- the coordinates for the remaining control points of the cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupU1ForPatch
public static void setupU1ForPatch(double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=1. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P3,0, P3,1, P3,2, and P3,3.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The final control point in the input array for
setupV0ForPatch(double[],double[],boolean)
is the same as the initial control point in the input array for this method. In addition, the final control point in the input array forsetupV1ForPatch(double[],double[],boolean)
is the same as the final point in the input array for this method. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupU1ForPatch
public static void setupU1ForPatch(double x, double y, double z, double[] pcoords, double[] ccoords, boolean reverse) Set up elements of an array containing the coordinates of a Bézier patch's control points for those control points corresponding to the edge of the patch for which the parameter u=1, where the edge's control points are given by explicit coordinates and an array. Each edge is a cubic Bézier curve.The coordinates of the control points for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve. The first control point for this curve is specified by the first three arguments and the remaining control points ares specified by the forth argument.
The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P3,0, P3,1, P3,2, and P3,3.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12. The final control point in the input array for
setupV0ForPatch(double[],double[],boolean)
is the same as the initial control point in the input array for this method. In addition, the final control point in the input array forsetupV1ForPatch(double[],double[],boolean)
is the same as the final point in the input array for this method. It its the caller's responsibility to make sure the same values are used.For an oriented surface, the direction of the normal vector is the same as that for the cross product of a tangent vector in the increasing-u direction with a tangent vector in the increasing-v direction. This is equivalent to using the right-hand rule when traversing vertices whose (u,v) coordinates are (0,0), followed by (1, 0), followed by (1,1), followed by (1,0). For a closed, oriented surface,the normal vector should point towards the outside of the surface.
- Parameters:
x
- the X coordinate of the initial control point for the edgey
- the Y coordinate of the initial control point for the edgez
- the Z coordinate of the initial control point for the edgepcoords
- the coordinates for the remaining control points of the cubic Bézier curveccoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)
-
setupRestForPatch
public static void setupRestForPatch(double[] ccoords) Set up the remaining control points for a cubic Bézier patch, using default values. A cubic Bézier patch has two parameters (u,v). This method sets four control points so that for a point p on the surface, ∂p/(∂u∂v) = 0 at the corners of the patch - at a corner, the values of (u,v) are either (0,0), (1,0), (0,1), or (1,1). A precondition is that the control points set by the methodssetupV0ForPatch(double[],double[],boolean)
setupV1ForPatch(double[],double[],boolean)
setupU0ForPatch(double[],double[],boolean)
andsetupU1ForPatch(double[],double[],boolean)
have been set.The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P1,1, P1,2, P2,1, and P2,2.The length of the array ccoords must be at least 48.
- Parameters:
ccoords
- the coordinates for a cubic Bézier patch's control points
-
setupRestForPatch
public static void setupRestForPatch(double urange, double vrange, double[] d2Pdsdt00, double[] d2Pdsdt10, double[] d2Pdsdt01, double[] d2Pdsdt11, double[] ccoords) Set up the remaining control points for a cubic Bézier patch, specifying derivatives at the corners. A cubic Bézier patch has two parameters (u,v). This method sets four control points so that for a point p on the surface, ∂p/(∂s∂t) has specified values at the corners of the patch - at a corner, the values of (u,v) are either (0,0), (1,0), (0,1), or (1,1). The parameter s is a linear function of u and the parameter t is a linear function of v. A precondition is that the control points set by the methodssetupV0ForPatch(double[],double[],boolean)
setupV1ForPatch(double[],double[],boolean)
setupU0ForPatch(double[],double[],boolean)
andsetupU1ForPatch(double[],double[],boolean)
have been set.The coordinates of each of the patch's 16 control points are grouped so that for each point the X coordinate is followed immediately by the Y coordinate and then the Z coordinate. The position of a point p on the patch is given by
p = ∑i,j Pi,jBi,3(u)Bi,3(v)
where i and j vary from 0 to 3 inclusive, u and v vary from 0.0 to 1.0, and Bi,3(u) = (3!/(i!(3-i)!)ui(1-u)(3-i). The array ccoords stores the Pi,j control points with the index i varying the fastest. The control points that will be set are P1,1, P1,2, P2,1, and P2,2.The length of the array ccoords must be at least 48 and the length of the array pcoords must be at least 12.
- Parameters:
urange
- the range for s when u varies from 0 to 1vrange
- the range for t when v varies from 0 to 1d2Pdsdt00
- An array containing the values ∂2x/(∂s∂t), ∂2y/(∂s∂t), and ∂2z/(∂s∂t), evaluated with u = 0 and v = 0d2Pdsdt10
- An array containing the values ∂2x/(∂s∂t), ∂2y/(∂s∂t), and ∂2z/(∂s∂t), evaluated with u = 1 and v = 0d2Pdsdt01
- An array containing the values ∂2x/(∂s∂t), ∂2y/(∂s∂t), and ∂2z/(∂s∂t), evaluated with u = 0 and v = 1d2Pdsdt11
- An array containing the values ∂2x/(∂s∂t), ∂2y/(∂s∂t), and ∂2z/(∂s∂t), evaluated with u = 1 and v = 1ccoords
- the coordinates for a cubic Bézier patch's control points
-
addCubicPatch
public void addCubicPatch(double[] controlPoints) Add a cubic Bézier patch to this surface. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. For an oriented surface, the orientation of the patch is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that of the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
All control points associated with an edge of a cubic patch may be identical, in which case the length of the edge is zero and the edge is equivalent to a vertex, but it is illegal for two adjacent edges to have zero length. Furthermore, if the end points of an edge are identical, the intermediate control points must be located at the same point as the vertex.- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.
-
addFlippedCubicPatch
public void addFlippedCubicPatch(double[] controlPoints) Add a cubic Bézier patch to this surface, reversing the orientation of the patch. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. Before the orientation of the patch is reversed, its orientation is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that opposite to the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
setupV0ForPatch(double[],double[],boolean)
.setupV1ForPatch(double[],double[],boolean)
.setupU0ForPatch(double[],double[],boolean)
.setupU1ForPatch(double[],double[],boolean)
.setupRestForPatch(double[])
.setupRestForPatch(double,double,double[],double[],double[],double[],double[])
.
For a flipped and non-flipped patch created using the same arguments, a point on the surface at coordinates (v,u) for the flipped patch is the same as the point at coordinates (u,v) for the non-flipped patch.
- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.
-
addCubicPatch
Add a cubic Bézier patch to this surface, specifying a color. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. For an oriented surface, the orientation of the patch is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that of the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
All control points associated with an edge of a cubic patch may be identical, in which case the length of the edge is zero and the edge is equivalent to a vertex, but it is illegal for two adjacent edges to have zero length. Furthermore, if the end points of an edge are identical, the intermediate control points must be located at the same point as the vertex.- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.color
- the color of this patch; null if none is specified
-
addFlippedCubicPatch
Add a cubic Bézier patch to this surface, specifying a color and reversing the orientation of the patch. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. Before the orientation of the patch is reversed, its orientation is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that opposite to the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
setupV0ForPatch(double[],double[],boolean)
.setupV1ForPatch(double[],double[],boolean)
.setupU0ForPatch(double[],double[],boolean)
.setupU1ForPatch(double[],double[],boolean)
.setupRestForPatch(double[])
.setupRestForPatch(double,double,double[],double[],double[],double[],double[])
.
For a flipped and non-flipped patch created using the same arguments, a point on the surface at coordinates (v,u) for the flipped patch is the same as the point at coordinates (u,v) for the non-flipped patch.
- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.color
- the color of this patch; null if none is specified
-
addCubicPatch
Add a cubic Bézier patch to this surface, specifying a tag. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. For an oriented surface, the orientation of the patch is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that of the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
All control points associated with an edge of a cubic patch may be identical, in which case the length of the edge is zero and the edge is equivalent to a vertex, but it is illegal for two adjacent edges to have zero length. Furthermore, if the end points of an edge are identical, the intermediate control points must be located at the same point as the vertex.- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.tag
- a tag naming this patch; null if there is none
-
addFlippedCubicPatch
Add a cubic Bézier patch to this surface, specifying a tag and reversing the orientation of the patch. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. Before the orientation of the patch is reversed, its orientation is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that opposite to the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
setupV0ForPatch(double[],double[],boolean)
.setupV1ForPatch(double[],double[],boolean)
.setupU0ForPatch(double[],double[],boolean)
.setupU1ForPatch(double[],double[],boolean)
.setupRestForPatch(double[])
.setupRestForPatch(double,double,double[],double[],double[],double[],double[])
.
For a flipped and non-flipped patch created using the same arguments, a point on the surface at coordinates (v,u) for the flipped patch is the same as the point at coordinates (u,v) for the non-flipped patch.
- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.tag
- a tag naming this patch; null if there is none
-
addCubicPatch
Add a cubic Bézier patch to this surface, specifying a color and a tag. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. The orientation of the patch is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that of the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
All control points associated with an edge of a cubic patch may be identical, in which case the length of the edge is zero and the edge is equivalent to a vertex, but it is illegal for two adjacent edges to have zero length. Furthermore, if the end points of an edge are identical, the intermediate control points must be located at the same point as the vertex.- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.color
- the color of this patch; null if none is specifiedtag
- a tag naming this patch; null if there is none
-
addFlippedCubicPatch
Add a cubic Bézier patch to this surface, specifying a color and a tag, and reversing the patch's orientation. The control points Pi,j, with i and j in the range [0,3], determine a cubic Bézier patch. The equation
where Bi,3 are Bernstein polynomials of degree 3. The orientation of the patch is determined by the right-hand rule when traversing the edges of the patch so that the (u,v) coordinates lie along a square whose vertices are (0,0), (1,0), (1,1), (0,1), traversed in that order before returning to (0,0). More precisely, at a point (u,v), the direction of the normal to an oriented surface is that opposite to the cross product of a tangent vector at (u, v) in the direction of increasing u with v constant and the tangent vector at (u, v) with constant u.P = ∑i,j Pi,jBi,3(u)Bj,3(v)
The controlPoints array contains 16 control points. The matrix of control points Pij is stored in column-major order with the X, Y, and Z values of a control point listed sequentially. The first 4 control points are also the control points for a cubic Bézier curve that lies along the edge of the patch where v=0; and the last 4 control points are the control points for a Bézier curve that lies along the edge of the patch where v=1. The control points for the Bézier curves along the edges where u=0 and u=1 do not consist of contiguous entries in the controlPoints array.
Methods to help configure the control patches include
setupV0ForPatch(double[],double[],boolean)
.setupV1ForPatch(double[],double[],boolean)
.setupU0ForPatch(double[],double[],boolean)
.setupU1ForPatch(double[],double[],boolean)
.setupRestForPatch(double[])
.setupRestForPatch(double,double,double[],double[],double[],double[],double[])
.
For a flipped and non-flipped patch created using the same arguments, a point on the surface at coordinates (v,u) for the flipped patch is the same as the point at coordinates (u,v) for the non-flipped patch.
- Parameters:
controlPoints
- the control points defining this cubic Bézier patch.color
- the color for this patch; null if none is specifiedtag
- a tag naming this patch; null if there is none
-
setupU0ForTriangle
public static void setupU0ForTriangle(double lastX, double lastY, double lastZ, double[] coords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter u=0 (the edge where the coordinates (u,v) vary from (0,0) to (0,1)), using the arrays retrieved by PathIterator3D. Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve. The coordinates of the first of these are provided as explicit arguments and the coordinates of the rest are provided in an array.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (0,0,3), (0,1,2),(0,2,1), and (0,3,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The normal vector at the vertices is the normalized cross product of tangent vectors at these vertices:
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point, given by the first three arguments, will match the (u,v) coordinates (0,0); when reverse is true, the first control point will match (0,1). The coordinates for the first control point are lastX, lastY, and lastZ: the names reflect the typical use of a path iterator in which the end of the last segment, or coordinates specified by a SEG_MOVETO operation, is used as the start of the next.
Given the following diagram:
the control points P0, P1, P2, and P3, specified by lastX, lastY, lastZ, and the coords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when reverse is true), will be placed at locations 003, 012, 021, and 030 respectively.
- Parameters:
lastX
- the initial control point's X coordinatelastY
- the initial control point's Y coordinatelastZ
- the initial control point's Z coordinatecoords
- the coordinates for the control points of a cubic Bézier curve as returned byPathIterator3D.currentSegment(double[])
scoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)- See Also:
-
setupU0ForTriangle
public static void setupU0ForTriangle(double[] pcoords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter u=0 (the edge where the coordinates (u,v) vary from (0,0) to (0,1)). Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (0,0,3), (0,1,2),(0,2,1), and (0,3,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point in the pcoords array will match the (u,v) coordinates (0,0); when reverse is true, the first control point will match (0,1).
Given the following diagram:
the control points P0, P1, P2, and P3, specified by the pcoords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when reverse is true), will be placed at locations 003, 012, 021, and 030.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curvescoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)- See Also:
-
setupU0ForTriangle
public static void setupU0ForTriangle(double[] pcoords, double[] scoords, boolean reverse, int offset) Set up offsetted elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter u=0 (the edge where the coordinates (u,v) vary from (0,0) to (0,1)). Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (0,0,3), (0,1,2),(0,2,1), and (0,3,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point in the pcoords array will match the (u,v) coordinates (0,0); when reverse is true, the first control point will match (0,1).
Given the following diagram:
the control points P0, P1, P2, and P3, specified by the pcoords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when 'reverse' is true), will be placed at locations 003, 012, 021, and 030.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curvescoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)offset
- the offset into the scoords array, starting at which offset the results are stored- See Also:
-
setupV0ForTriangle
public static void setupV0ForTriangle(double lastX, double lastY, double lastZ, double[] coords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter v=0 (the edge where the coordinates (u,v) vary from (0,0) to (1,0)), using the arrays retrieved by PathIterator3D. Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve. The coordinates of the first of these are provided as explicit arguments and the coordinates of the rest are provided in an array.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (0,0,3), (1,0,2),(2,0,1), and (3,0,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point, given by the first three arguments, will match the (u,v) coordinates (0,0); when reverse is true, the first control point will match (1,0). The coordinates for the first control point are lastX, lastY, and lastZ: the names reflect the typical use of a path iterator in which the end of the last segment, or coordinates specified by a SEG_MOVETO operation, is used as the start of the next. Given the following diagram:
the control points P0, P1, P2, and P3, specified by lastX, lastY, lastZ, and the coords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when reverse is true), will be placed at locations 003, 102, 201, and 300 respectively.
- Parameters:
lastX
- the first control point's X coordinatelastY
- the first control point's Y coordinatelastZ
- the first control point's Z coordinatecoords
- the coordinates for the control points of a cubic Bézier curve as returned byPathIterator3D.currentSegment(double[])
scoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)- See Also:
-
setupV0ForTriangle
public static void setupV0ForTriangle(double[] pcoords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter v=0 (the edge where the coordinates (u,v) vary from (0,0) to (1,0)). Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (0,0,3), (1,0,2),(2,0,1), and (3,0,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point in the pcoords array will match the (u,v) coordinates (0,0); when reverse is true, the first control point will match (1,0).
Given the following diagram:
the control points P0, P1, P2, and P3, specified by the pcoords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when 'reverse' is true), will be placed at locations 003, 102, 201, and 300.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curvescoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)- See Also:
-
setupV0ForTriangle
public static void setupV0ForTriangle(double[] pcoords, double[] scoords, boolean reverse, int offset) Set up offseted elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter v=0 (the edge where the coordinates (u,v) vary from (0,0) to (1,0)). Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter v is 0.0, and the last control point is the point on the curve where the parameter v is 1.0. There are a total of four control points for this curve.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (0,0,3), (1,0,2),(2,0,1), and (3,0,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point in the pcoords array will match the (u,v) coordinates (0,0); when reverse is true, the first control point will match (1,0).
Given the following diagram:
the control points P0, P1, P2, and P3, specified by the pcoords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when 'reverse' is true), will be placed at locations 003, 102, 201, and 300.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curvescoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)offset
- the offset into the scoords array, starting at which offset the results are stored- See Also:
-
setupW0ForTriangle
public static void setupW0ForTriangle(double lastX, double lastY, double lastZ, double[] coords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter w=0 (the edge where the coordinates (u,v) vary from (1,0) to (0,1))), using the arrays retrieved by PathIterator3. Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter t is 0.0, and the last control point is the point on the curve where the parameter t is 1.0. There are a total of four control points for this curve. The coordinates of the first of these are provided as explicit arguments and the coordinates of the rest are provided in an array.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (3,0,0), (2,1,0),(1,2,0), and (0,3,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point, given by the first three arguments, will match the (u,v) coordinates (1,0); when reverse is true, the first control point will match (0,1). The coordinates for the first control point are lastX, lastY, and lastZ: the names reflect the typical use of a path iterator in which the end of the last segment, or coordinates specified by a SEG_MOVETO operation, is used as the start of the next. Given the following diagram:
the control points P0, P1, P2, and P3, specified by lastX, lastY, lastZ, and the coords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when 'reverse' is true), will be placed at locations 300, 210, 210, and 030.
- Parameters:
lastX
- the initial control point's X coordinatelastY
- the initial control point's Y coordinatelastZ
- the initial control point's Z coordinatecoords
- the coordinates for the control points of a cubic Bézier curve as returned byPathIterator3D.currentSegment(double[])
scoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)- See Also:
-
setupW0ForTriangle
public static void setupW0ForTriangle(double[] pcoords, double[] scoords, boolean reverse) Set up elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter w=0 (the edge where the coordinates (u,v) vary from (1,0) to (0,1)). Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2, and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter t is 0.0, and the last control point is the point on the curve where the parameter t is 1.0. There are a total of four control points for this curve.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (3,0,0), (2,1,0),(1,2,0), and (0,3,0).
When the argument 'reverse' is false, the path control points P0, P1, P2, and P3 are mapped to the cubic-triangle control points P300, P210, P120, and P030 respectively. When the argument 'reverse' is true, the path control points P3, P2, P1, and P0 are mapped to P300, P210, P120, and P030 respectively.
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point in the pcoords array will match the (u,v) coordinates (1,0); when reverse is true, the first control point will match (0,1).
Given the following diagram:
the control points P0, P1, P2, and P3, specified by the pcoords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when 'reverse' is true), will be placed at locations 300, 210, 120, and 030.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curvescoords
- the coordinates for a cubic Bézier triangle's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)- See Also:
-
setupW0ForTriangle
public static void setupW0ForTriangle(double[] pcoords, double[] scoords, boolean reverse, int offset) Set up offsetted elements of an array containing the coordinates of a cubic Bézier triangle's control points for those control points corresponding to the edge of the patch for which the parameter w=0 (the edge where the coordinates (u,v) vary from (1,0) to (0,1)). Bézier triangle use barycentric coordinates (u,v,w) with the constraint u+v+w = 1, and where u, v, and w are constrained to lie in the interval [0,1]. Each edge is a cubic Bézier curve.The coordinates of the control points (P0, P1, P2 and P3) for the cubic curve are listed sequentially, with X, Y, and Z values for each control point grouped together and in that order. The first (Oth) control point is the point on the curve where the parameter t is 0.0, and the last control point is the point on the curve where the parameter t is 1.0. There are a total of four control points for this curve.
A cubic Bézier triangle is specified by 10 control points. These are labeled by a set of indices λ=(λ1,λ2,λ3) where λ1+λ2+λ3=3 and where each component λi can be 0, 1, 2, or 3. The control point indices, in the order in which they will appear in the scoords array, are (0,0,3), (0,1,2),(0,2,1), (0,3,0), (1,0,2), (1,1,1), (1,2,0), (2,0,1), (2,1,0), and (3,0,0). The indices for the control points set by this method are (3,0,0), (2,1,0),(1,2,0), and (0,3,0).
For an oriented surface, a Bézier triangle's normal vector's direction is set by using the right-hand rule with vertices traversed in barycentric coordinates (u,v,w) from (0,0,1) to (1, 0, 0) to (0, 1, 0). The corresponding edges satisfy the constraints v = 0 and w = 0. To continue from (0,1,0) back to (0, 0, 1), the u=0 edge is traversed in the opposite direction. The the normal vector at the vertices is the normalized cross product of tangent vectors at these vertices.
- For the (0,0,1) vertex, one computes the cross product of the tangent for the v=0 edge with the tangent for the u=0 edge.
- For the (1,0,0) vertex one computes the cross product of the tangent for the w=0 edge with the tangent for the v=0 edge.
- For the (0,1,0) vertex one computes the cross product of the tangent for the u=0 edge with the tangent for the w=0 edge.
After the cross products are computed, the resulting vector is normalized. In each case the tangent vector is the difference between an adjacent control point and the control point at the vertex at which the tangent vector is computed.
When reverse is false, the first control point in the pcoords array will match the (u,v) coordinates (1,0); when reverse is true, the first control point will match (0,1).
Given the following diagram:
the control points P0, P1, P2, and P3, specified by the pcoords array, and read in the order specified by the 'reverse' argument (P0 to P3 when 'reverse' is false and P3 to P0 when 'reverse' is true), will be placed at locations 300, 210, 120, and 030.
- Parameters:
pcoords
- the coordinates for the control points of a cubic Bézier curvescoords
- the coordinates for a cubic Bézier patch's control pointsreverse
- true if the control points should be read from pcoords in reverse order (i.e., highest indices first); false for normal order (lowest indices first)offset
- the offset into the scoords array, starting at which offset the results are stored- See Also:
-
setupCP111ForTriangle
public static void setupCP111ForTriangle(double x, double y, double z, double[] scoords) Set up the control point P111, the one that is not a control point for the edge edge of a cubic Bézier triangle, so that the surface at barycentric coordinates (1/3, 1/3, 1/3) will go through a specified point.The value set is dependent on the other control points being previously configured.
- Parameters:
x
- the X coordinate of the specified pointy
- the Y coordinate of the specified pointz
- the Z coordinate of the specified pointscoords
- the array holding the control-point coordinates
-
setupCP111ForTriangle
public static void setupCP111ForTriangle(double x, double y, double z, double[] scoords, int offset) Set up the control point P111, the one that is not a control point for the edge edge of a cubic Bézier triangle, so that the surface at barycentric coordinates (1/3, 1/3, 1/3) will go through a specified point, with the point stored in an offseted array.The value set is dependent on the other control points being previously configured.
- Parameters:
x
- the X coordinate of the specified pointy
- the Y coordinate of the specified pointz
- the Z coordinate of the specified pointscoords
- the array holding the control-point coordinatesoffset
- the offset into the scoords array, starting at which offset the results are stored
-
setupCP111ForTriangle
public static void setupCP111ForTriangle(double x, double y, double z, double[] scoords, double u, double v) throws IllegalArgumentException Set up the control point P111, the one that is not a control point for the edge of a cubic Bézier triangle, so that the surface at barycentric coordinates (u, v, 1-(u+v)) will go through a specified point. The value of u and v must not be one that matches a point on an edge.The value set is dependent on the other control points being previously configured.
- Parameters:
x
- the X coordinate of the specified pointy
- the Y coordinate of the specified pointz
- the Z coordinate of the specified pointscoords
- the array holding the control-point coordinatesu
- the first barycentric coordinatev
- the second barycentric coordinate- Throws:
IllegalArgumentException
- u and/or v are out of range
-
setupCP111ForTriangle
public static void setupCP111ForTriangle(double[] scoords) Set the control point P111,the one that is not a control point for edge of a cubic Bézier triangle, based on a quadratic. The value for this control point is (P012+P021+P102+P120+P201+P210)/4.0 + (P003+P030+P300)/6.0, as describe in Bézier Triangles and N-Patches, Farin, Gerald, Curves and Surfaces for Computer Aided Geometric Design--A Practical Guide, Fourth Edition (First Edition, 1988), Academic Press Inc., 1996, and Farin, Gerald, "Triangular Bernstein-Bézier Patches," Computer Aided Geometric Design, vol. 3, no. 2, pp. 83-127, 1986.The value set is dependent on the other control points being previously configured.
- Parameters:
scoords
- the array holding the control-point coordinates
-
setupPlanarCP111ForTriangle
public static void setupPlanarCP111ForTriangle(double[] scoords) Set up the control point P111, the one that is not a control point for an edge of the cubic Bézier triangle, so that the surface at barycentric coordinates (1/3, 1/3, 1/3) will go through a point on the plane passing through the vertices of the the cubic Bézier triangle. This point will have the value (v1 + v2 + v3)/3 where v1, v2, and v3 are the vertices of the cubic Bézier triangle.This method is useful when a cubic Bézier triangle, including its edges, should lie in a plane.
- Parameters:
scoords
- the array holding the control-point coordinates
-
addCubicTriangle
public void addCubicTriangle(double[] controlPoints) Add a cubic Bézier triangle to this surface. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].The control points, labeled by their three indices, are located as follows:
The orientation of the triangle is determined by applying the right-hand rule, starting with the edge (0,0)-->(1,0) and ending with the edge (0,0)-->(0,1), where the ordered pairs represent the coordinates (u,v). More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).For a valid triangle, all vertices must be located at different points.
Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
- Parameters:
controlPoints
- the control points for a Bézier triangle
-
addFlippedCubicTriangle
public void addFlippedCubicTriangle(double[] controlPoints) Add a cubic Bézier triangle to this surface, reversing the triangle's orientation by exchanging its U and V coordinates. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].Before the orientation is reversed, the control points, labeled by their three indices, are located as follows:
The orientation of the triangle before the triangle's orientation is reversed is determined by applying the right-hand rule, starting with the edge (0,0)-->(1,0) and ending with the edge (0,0)-->(0,1), where the ordered pairs represent the coordinates (u,v). More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction opposite to that of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (u,v,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the control points for a Bézier triangle
-
addCubicTriangle
Add a cubic Bézier triangle to this surface, specifying a color. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].The control points, labeled by their three indices, are located as follows:
The orientation of the triangle is determined by applying the right-hand rule, starting with the edge (0,0)-->(1,0) and ending with the edge (0,0)-->(0,1), where the ordered pairs represent the coordinates (u,v). More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).For a valid triangle, all vertices must be located at different points.
Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
- Parameters:
controlPoints
- the control points for a Bézier trianglecolor
- the triangle's color; null if none is specified
-
addFlippedCubicTriangle
Add a cubic Bézier triangle to this surface, specifying a color and reversing the triangle's orientation by exchanging its U and V coordinates. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].Before the orientation is reversed, the control points, labeled by their three indices, are located as follows:
The orientation of the triangle before the triangle's orientation is reversed is determined by applying the right-hand rule, starting with the edge (0,0)-->(1,0) and ending with the edge (0,0)-->(0,1), where the ordered pairs represent the coordinates (u,v). More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction opposite to that of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (u,v,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the control points for a Bézier trianglecolor
- the triangle's color; null if non is specified
-
addCubicTriangle
Add a cubic Bézier triangle to this surface, specifying a tag. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].The control points, labeled by their three indices, are located as follows:
The orientation of the triangle is determined by applying the right-hand rule, starting with the edge (0,0)-->(1,0) and ending with the edge (0,0)-->(0,1), where the ordered pairs represent the coordinates (u,v). More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).For a valid triangle, all vertices must be located at different points.
Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
- Parameters:
controlPoints
- the control points for a Bézier triangletag
- an object tagging this triangle
-
addFlippedCubicTriangle
Add a cubic Bézier triangle to this surface, specifying a tag and reversing the triangle's orientation by exchanging its U and V coordinates. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].Before the orientation is reversed, the control points, labeled by their three indices, are located as follows:
The orientation of the triangle before the triangle's orientation is reversed is determined by applying the right-hand rule, starting with the edge (0,0)-->(1,0) and ending with the edge (0,0)-->(0,1), where the ordered pairs represent the coordinates (u,v). More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction opposite to that of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (u,v,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the control points for a Bézier triangletag
- the triangle's tag; null if none is specified
-
addCubicTriangle
Add a cubic Bézier triangle to this surface, specifying a color and a tag. Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].The control points, labeled by their three indices, are located as follows:
The orientation of the triangle is determined by applying the right-hand rule, when traversing the vertices whose (u,v) values are (0,0), (1,0), and (0,1) in that order. More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
- Parameters:
controlPoints
- the control points for a Bézier trianglecolor
- the color for the triangle; null if none is specifiedtag
- a tag naming this triangle
-
addFlippedCubicTriangle
Add a cubic Bézier triangle to this surface, specifying a color and a tag, and reversing the triangle's orientation by exchanging its U and V coordinates, Cubic Bézier triangles uses barycentric coordinates u, v, and w, where u + v + w = 1 and all three coordinates are in the range [0,1].Before the orientation is reversed, the control points, labeled by their three indices, are located as follows:
The orientation of the triangle, again before the orientation is reversed, is determined by applying the right-hand rule, when traversing the vertices whose (u,v) values are (0,0), (1,0), and (0,1) in that order. More precisely, for an orientated surface at a point (u, v, 1 - u - v), the cross product of a tangent vector in the direction of increasing u with v constant and the tangent vector in the direction of increasing v with u constant points in the direction opposite to that of a normal to the surface.
The controlPoints array contains the control points whose indices are 003, 012, 021, 030, 102, 111, 120, 201, 210, 300, listed in that order with the X, Y, and Z values for each control point specified as adjacent array entries, again in that order.
If an edge of the segment to be added is a straight line, one should use
Path3D.setupCubic(Point3D,Point3D)
orPath3D.setupCubic(double,double,double,double,double,double)
to obtain the control points that lie along that edge (while contiguous in the array returned by the toCubic method, the locations at which these values should be placed in the controlPoints array may not be contiguous).Several methods exit to help set up the control points. These include
setupU0ForTriangle(double[],double[],boolean)
setupV0ForTriangle(double[],double[],boolean)
setupW0ForTriangle(double[],double[],boolean)
setupU0ForTriangle(double,double,double,double[],double[],boolean)
setupV0ForTriangle(double,double,double,double[],double[],boolean)
setupW0ForTriangle(double,double,double,double[],double[],boolean)
setupCP111ForTriangle(double,double,double,double[])
setupCP111ForTriangle(double,double,double,double[],double,double)
setupCP111ForTriangle(double[])
setupPlanarCP111ForTriangle(double[])
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (u,v,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the control points for a Bézier trianglecolor
- the color for the triangle; null if none is specifiedtag
- a tag naming this triangle
-
addPlanarTriangle
public void addPlanarTriangle(double[] controlPoints) Add a planner triangle to the surface, specifying a control-point array. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. As a result, applying the right hand rule using the ordering of the control points (v1 to v3 to v3 yields an orientation opposite to that of the triangle. It is not the same as the ordering used for It is not the same as the ordering used for
addPlanarTriangle(double,double,double,double,double,double,double,double,double)
.- Parameters:
controlPoints
- the vertices of the triangle
-
addFlippedPlanarTriangle
public void addFlippedPlanarTriangle(double[] controlPoints) Add a planner triangle to the surface, specifying a control-point array and reversing the triangle's orientation. Before the triangle's orientation is reversed, the control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. For a flipped triangle, the order of the control points determines the orientation using the right hand rule for traversing v1 to v3 to v2.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the vertices of the triangle
-
addPlanarTriangle
Add a planner triangle to the surface, specifying a control-point array and color. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. As a result, applying the right hand rule using the ordering of the control points (v1 to v3 to v3 yields an orientation opposite to that of the triangle. It is not the same as the ordering used for
addPlanarTriangle(double,double,double,double,double,double,double,double,double,Color)
.- Parameters:
controlPoints
- the vertices of this trianglecolor
- the color of this triangle; null if none is specified
-
addFlippedPlanarTriangle
Add a planner triangle to the surface, specifying a control-point array and color, and reversing the triangle's orientation. Before the triangle's orientation is reversed, the control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. It is not the same as the ordering used for
addPlanarTriangle(double,double,double,double,double,double,double,double,double,Color)
. For a flipped triangle, the order of the control points determines the orientation using the right hand rule for traversing v1 to v3 to v2.For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the vertices of this trianglecolor
- the color of this triangle; null if none is specified
-
addPlanarTriangle
Add a planner triangle to the surface, specifying a control-point array and a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. As a result, applying the right hand rule using the ordering of the control points (v1 to v3 to v3 yields an orientation opposite to that of the triangle. It is not the same as the ordering used for It is not the same as the ordering used for
addPlanarTriangle(double,double,double,double,double,double,double,double,double,Object)
.- Parameters:
controlPoints
- the vertices of this triangletag
- a tag naming this triangle
-
addFlippedPlanarTriangle
Add a planner triangle to the surface, specifying a control-point array and tag, and reversing the triangle's orientation. Before the triangle's orientation is reversed, the control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. For a flipped triangle, the order of the control points determines the orientation using the right hand rule for traversing v1 to v3 to v2.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the vertices of this triangletag
- a tag naming this triangle; null if there is none
-
addPlanarTriangle
Add a planner triangle to the surface, specifying a control-point array, a color, and a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The control-points array stores the vertices in the following order, so as to match the convention for barycentric coordinates used for cubic triangles.
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
This order matches the ordering used for a cubic Bezier triangle. As a result, applying the right hand rule using the ordering of the control points (v1 to v3 to v3 yields an orientation opposite to that of the triangle. It is not the same as the ordering used for
addPlanarTriangle(double,double,double,double,double,double,double,double,double,Color,Object)
.- Parameters:
controlPoints
- the vertices of the trianglecolor
- the color of this triangle; null if none is specifiedtag
- a tag naming this triangle; null if there is none
-
addFlippedPlanarTriangle
Add a planner triangle to the surface, reversing the triangle's orientation by exchanging the triangle's U and V coordinates, and specifying a control-point array, a color, and a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The the vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
Before the triangle's orientation is reversed, the control-points array stores the vertices in the following order so as to match the convention for barycentric coordinates used for cubic triangles:
- controlPoints[0], controlPoints[1], controlPoints[2] - the X, Y and Z coordinates respectively for the first vertex.
- controlPoints[3], controlPoints[4], controlPoints[5] - the X, Y and Z coordinates respectively for the third vertex.
- controlPoints[6], controlPoints[7], controlPoints[8] - the X, Y and Z coordinates respectively for the second vertex.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
controlPoints
- the vertices of the trianglecolor
- the color of this triangle; null if none is specifiedtag
- a tag naming this triangle; null if there is none
-
addPlanarTriangle
public void addPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) Add a planner triangle to the surface, specifying the coordinates of the vertices. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The orientation of the triangle is that given by the right hand rule when traversing the triangle from v1 to v2 to v3, which is the same order as the arguments. This differs from the convention used for
addPlanarTriangle(double[])
.- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3
-
addFlippedPlanarTriangle
public void addFlippedPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) Add a planner triangle to the surface, reversing the triangle's orientation and specifying the coordinates of the vertices. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that the right hand rule indicates an outward direction before the triangle's orientation is reversed, in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2. For a flipped triangle the orientation is given by using the right hand rule when traversing the vertices from v1 to v3 to v2, the opposite of a non-flipped triangle created with the same arguments.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3
-
addPlanarTriangle
public void addPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color) Add a planner triangle to the surface, specifying the coordinates of the vertices and specifying a color. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The orientation of the triangle is that given by the right hand rule when traversing the triangle from v1 to v2 to v3, which is the same order as the arguments. This differs from the convention used for
addPlanarTriangle(double[],Color)
.- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3color
- the color of this triangle; null if none is specified
-
addFlippedPlanarTriangle
public void addFlippedPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color) Add a planner triangle to the surface, reversing the triangle's orientation, specifying the coordinates of the vertices, and specifying a color. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that, before the orientation is reversed, the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2. For a flipped triangle the orientation is given by using the right hand rule when traversing the vertices from v1 to v3 to v2, the opposite of a non-flipped triangle created with the same arguments.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3color
- the color of this triangle; null if none is specified
-
addPlanarTriangle
public void addPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Object tag) Add a planner triangle to the surface, specifying the coordinates of the vertices and providing a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2.
The orientation of the triangle is that given by the right hand rule when traversing the triangle from v1 to v2 to v3, which is the same order as the arguments. This differs from the convention used for
addPlanarTriangle(double[],Object)
.- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3tag
- a tag naming this triangle
-
addFlippedPlanarTriangle
public void addFlippedPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Object tag) Add a planner triangle to the surface, reversing the triangle's orientation, specifying the coordinates of the vertices, and providing a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that, before the orientation is reversed, the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2. For a flipped triangle the orientation is given by using the right hand rule when traversing the vertices from v1 to v3 to v2, the opposite of a non-flipped triangle created with the same arguments.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3tag
- a tag naming this triangle
-
addPlanarTriangle
public void addPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color, Object tag) Add a planner triangle to the surface, specifying the coordinates of the vertices, a color, and a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2. The orientation of the triangle is that given by the right hand rule when traversing the triangle from v1 to v2 to v3, which is the same order as the arguments. This differs from the convention used for
addPlanarTriangle(double[],Color,Object)
.- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3color
- the color of this triangle; null if none is specifiedtag
- a tag naming this triangle
-
addFlippedPlanarTriangle
public void addFlippedPlanarTriangle(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, Color color, Object tag) Add a planner triangle to the surface, reversing the triangle's orientation, and specifying the coordinates of the vertices, a color, and a tag. The control points represent three vertices each represented by three array elements for the X, Y, and Z coordinates of the points respectively. The vertices are numbered so that, before the orientation is reversed, the right hand rule indicates an outward direction in order to be consistent with the representation used in the org.bzdev.p3d package (which is based on the ordering required in STL files):Points on the triangle can be expressed in barycentric coordinates u, v, and w. These have a constraint u + v + w = 1. By convention, we will use u and v and set w = 1 - (u + v). All three coordinates are restricted to the range [0,1]. In barycentric coordinates, a point p will be located at p = wv1 +uv3 + vv2. For a flipped triangle the orientation is given by using the right hand rule when traversing the vertices from v1 to v3 to v2, the opposite of a non-flipped triangle created with the same arguments.
For a flipped and non-flipped triangle created using the same arguments, a point on the surface at coordinates (v,u,w) for the flipped triangle is the same as the point at coordinates (v,u,w) for the non-flipped triangle.
- Parameters:
x1
- the X coordinate of vertex v1y1
- the Y coordinate of vertex v1z1
- the Z coordinate of vertex v1x2
- the X coordinate of vertex v2y2
- the Y coordinate of vertex v2z2
- the Z coordinate of vertex v2x3
- the X coordinate of vertex v3y3
- the Y coordinate of vertex v3z3
- the Z coordinate of vertex v3color
- the color of this triangle; null if none is specifiedtag
- a tag naming this triangle; null if there is none
-
triangleToPatch
public static void triangleToPatch(double[] tcoords, int toffset, double[] pcoords, int poffset) Convert the control-point coordinates for a cubic Bézier triangle into those for a cubic Bézier patch that has the same shape.The algorithm citation is Shi-Min Hu, "Conversion between triangular and rectangular Bézier patches" Computer Aided Design 18 (2001) 667–671 . The rationale for providing this method is that the X3D file format supports Bézier patches but not Bézier triangles, so converting a Bézier triangle to a Bézier patch allows this segment of a surface to be described using X3D constructs with no loss of accuracy. the algorithm maps barycentric coordinates (u, v, w), where u + v + w = 1, to patch coordinates (u',v') where u' = u and v' = v/(1-u) = v/(v+w).
- Parameters:
tcoords
- the coordinates for a cubic Bézier triangletoffset
- the offset into the tcoords array for the start of the control-point coordinates for the cubic Bézier trianglepcoords
- the coordinates for a cubic Bézier patchpoffset
- the offset into the tcoords array for the start of the control-point coordinates for the cubic Bézier patch
-
addCubicVertex
public void addCubicVertex(double[] controlPoints) Add a cubic vertex to this surface. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinate
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double[] controlPoints) Add a flipped cubic vertex to this surface. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinate
-
addCubicVertex
Add a cubic vertex to this surface, specifying a color. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinatecolor
- the color of this surface segment
-
addFlippedCubicVertex
Add a flipped cubic vertex to this surface, specifying a color. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinatecolor
- the color of this surface segment
-
addCubicVertex
Add a cubic vertex to this surface, specifying a tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinatetag
- the tag of this surface segment
-
addFlippedCubicVertex
Add a flipped cubic vertex to this surface, specifying a tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally to back P0. When viewed from the oriented side the surface, this traversal will go clockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinatetag
- the tag of this surface segment
-
addCubicVertex
Add a cubic vertex to this surface, specifying a color and tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinatecolor
- the tag of this surface segmenttag
- the tag for this surface segment
-
addFlippedCubicVertex
Add a flipped cubic vertex to this surface, specifying a color and tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.- Parameters:
controlPoints
- the control points, in order, with each represented by three array elements containing a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinatecolor
- the color of this surface segmenttag
- the tag for this surface segment
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5) Add a cubic vertex to this surface. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5) Add a flipped cubic vertex to this surface. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color) Add a cubic vertex to this surface, specifying a color. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4color
- the color for this segment
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color) Add a flipped cubic vertex to this surface, specifying a color. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4color
- the color for this segment
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Object tag) Add a cubic vertex to this surface, specifying a tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4tag
- the tag for this segment
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Object tag) Add a flipped cubic vertex to this surface, specifying a tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface,* this traversal will go clockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4tag
- the tag for this segment
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color, Object tag) Add a cubic vertex to this surface, specifying a color and tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise. P4 and back to the start- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4color
- the color for this segmenttag
- the tag for this segment
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, double x5, double y5, double z5, Color color, Object tag) Add a flipped cubic vertex to this surface, specifying a color and tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface,* this traversal will go clockwise.- Parameters:
x1
- the x coordinate for P0y1
- the y coordinate for P0z1
- the x coordinate for P0x2
- the x coordinate for P1y2
- the y coordinate for P1z2
- the x coordinate for P1x3
- the x coordinate for P2y3
- the y coordinate for P2z3
- the x coordinate for P2x4
- the x coordinate for P3y4
- the y coordinate for P3z4
- the x coordinate for P3x5
- the x coordinate for P4y5
- the y coordinate for P4z5
- the x coordinate for P4color
- the color of this segmenttag
- the tag for this segment
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz) Add a cubic vertex to this surface. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz) Add a flipped cubic vertex to this surface. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color) Add a cubic vertex to this surface, specifying a color. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4color
- the color of the new segment
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color) Add a flipped cubic vertex to this surface, specifying a color. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4color
- the color of the new segment
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Object tag) Add a cubic vertex to this surface, specifying a tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4tag
- the tag for the new segment
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Object tag) Add a flipped cubic vertex to this surface, specifying a tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4tag
- the tag for the new segment
-
addCubicVertex
public void addCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color, Object tag) Add a cubic vertex to this surface, specifying a color and tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go counterclockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4color
- the color for the new segmenttag
- the tag for the new segment
-
addFlippedCubicVertex
public void addFlippedCubicVertex(double x1, double y1, double z1, int type, double[] coords, double vx, double vy, double vz, Color color, Object tag) Add a flipped cubic vertex to this surface, specifying a color and tag. A cubic vertex has five control points, P0, P1, P2, P3, and P4. The first four control points are the control points for a cubic Bézier curve and the fifth control point P4 is the control point of a vertex connected points along the Bézier curve by straight lines. The orientation of this surface is that obtained by using the right hand rule when following the Bézier curve from P0 to P3, then proceeding to P4, and finally back to P0. When viewed from the oriented side of the surface, this traversal will go clockwise.The number of entries in the coords array (argument 5) is 3 when the type is
PathIterator3D.SEG_LINETO
, 6 when the type isPathIterator3D.SEG_QUADTO
, and 9 when the type isPathIterator3D.SEG_CUBICTO
. The format for the coords array is that specified forPathIterator3D.currentSegment(double[])
.- Parameters:
x1
- the X coordinate for the control point P0y1
- the Y coordinate for the control point P0z1
- the Y coordinate for the control point P0type
- the segment type for the next argument (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)coords
- the control points, other than P0 for the curve ending at P3vx
- the X coordinate for P4vy
- the Y coordinate for P4vz
- the Z coordinate for P4color
- the color for the new segmenttag
- the tag for the new segment
-
transform
Apply a transform to the surface. The transform will be applied to each segment's control points.- Parameters:
tform
- the transform
-
reverseOrientation
public abstract void reverseOrientation()Reverse the orientation of this surface. This changes the direction associated with each edge and each segment. -
isClosedManifold
public boolean isClosedManifold()Determine if a surface is a closed manifold.- Specified by:
isClosedManifold
in interfaceShape3D
- Returns:
- true if the surface is closed; false otherwise
-
segmentValue
public static Point3D segmentValue(int type, double[] coords, double u, double v) throws IllegalArgumentException Get a point at a specific location on a segment of a surface.- Parameters:
type
- the segment type (SurfaceIterator.PLANAR_TRIANGLE, SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.CUBIC_PATCH, or SurfaceIterator.CUBIC_VERTEX)coords
- the control-point array for the segmentu
- the first parameter for the surfacev
- the second parameter for the surface- Returns:
- the point corresponding to coordinates (u,v)
- Throws:
IllegalArgumentException
-
segmentValue
public static void segmentValue(double[] results, int type, double[] coords, double u, double v) throws IllegalArgumentException Get coordinates for a specific point on a segment of a surface.- Parameters:
results
- an array to hold the X, Y, and Z coordinates of point corresponding to parameters (u,v)type
- the segment type (SurfaceIterator.PLANAR_TRIANGLE, SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.CUBIC_PATCH, or SurfaceIterator.CUBIC_VERTEX)coords
- the control-point array for the segmentu
- the first parameter for the surfacev
- the second parameter for the surface- Throws:
IllegalArgumentException
-
segmentValue
public static Point3D segmentValue(int type, double[] coords, double u, double v, double w) throws IllegalArgumentException Get a point at a specific location on a segment of a surface, using barycentric coordinates.The coordinates must satisfy the constraint u + w + v = 1; To compute a value from the other two, use
- u = 1.0 - (v + w);
- v = 1.0 - (u + w);
- w = 1.0 - (u + v);
- Parameters:
type
- the segment type (SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.PLANAR_TRIANGLE, or SurfaceIterator.CUBIC_VERTEX)coords
- the control-point array for the segmentu
- the first parameter for the surface; -1 if the value of u should be computed from the other two parametersv
- the second parameter for the surface; -1 if the value of v should be computed from the other two parametersw
- the third parameter for the surface; -1 if the value of w should be computed from the other two parameters- Returns:
- the point corresponding to coordinates (u,v,w)
- Throws:
IllegalArgumentException
- an argument was out of range, more than one argument was set to -1, or the type was not acceptable
-
segmentValue
public static void segmentValue(double[] results, int type, double[] coords, double u, double v, double w) throws IllegalArgumentException Get the coordinates corresponding to a point at a specific location on a segment of a surface, using barycentric coordinates.The coordinates must satisfy the constraint u + w + v = 1; To compute a value from the other two, use
- u = 1.0 - (v + w);
- v = 1.0 - (u + w);
- w = 1.0 - (u + v);
- Parameters:
results
- an array holding the X, Y and Z coordinates of the desired point, listed in that ordertype
- the segment type (SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.PLANAR_TRIANGLE, or SurfaceIterator.CUBIC_VERTEX)coords
- the control-point array for the segmentu
- the first parameter for the surface; -1 if the value of u should be computed from the other two parametersv
- the second parameter for the surface; -1 if the value of v should be computed from the other two parametersw
- the third parameter for the surface; -1 if the value of w should be computed from the other two parameters- Throws:
IllegalArgumentException
- an argument was out of range, more than one argument was set to -1, or the type was not acceptable
-
uTangent
public static void uTangent(double[] results, int type, double[] coords, double u, double v) Get components of the "u" tangent vector at a specific point on a segment of a surface. The value of the vector is ∂p/∂u where p is a point for parameters (u,v). For cases where barycentric coordinates are used p(u,v,1-(u+v)) is differentiated.- Parameters:
results
- an array to hold the X, Y, and Z components of the tangent vector for the u direction when the parameters are (u,v)type
- the segment type (SurfaceIterator.PLANAR_TRIANGLE, SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.CUBIC_PATCH, or SurfaceIterator.CUBIC_VERTEX)coords
- the control-point array for the segmentu
- the first parameter for the surfacev
- the second parameter for the surface
-
vTangent
public static void vTangent(double[] results, int type, double[] coords, double u, double v) Get components of the "v" tangent vector at a specific point on a segment of a surface. The value of the vector is ∂p/∂v where p is a point for parameters (u,v). For cases where barycentric coordinates are used p(u,v,1-(u+v)) is differentiated.- Parameters:
results
- an array to hold the X, Y, and Z components of the tangent vector for the u direction when the parameters are (u,v)type
- the segment type (SurfaceIterator.PLANAR_TRIANGLE, SurfaceIterator.CUBIC_TRIANGLE, SurfaceIterator.CUBIC_PATCH, or SurfaceIterator.CUBIC_VERTEX)coords
- the control-point array for the segmentu
- the first parameter for the surfacev
- the second parameter for the surface
-
configArea
public static void configArea(int nCT, int nCP) Configure the number of points used in an area computation for Gaussian-Legendre integration. The default for both is 8. If values are set to be less than 8, they will be increased to 8, so giving values of 0 will produce the default. Normally the default should be adequate. Setting higher values is useful for testing. One should note that increasing the values improves the accuracy for each segment in the absence of floating-point errors, but increases the number of values summed.- Parameters:
nCT
- the number of points for cubic Bézier trianglesnCP
- the number of points for cubic Bézier patches
-
cubicVertexToPatch
public static void cubicVertexToPatch(double[] coords, int offset, double[] pcoords, int poffset) Convert a cubic vertex to a cubic patch- Parameters:
coords
- an array holding the 5 control points representing a cubic vertex in the order used byaddCubicVertex(double[])
offset
- the offset into coords where the control points startpcoords
- an array that will hold the 16 control points representing a cubic patch in the order used byaddCubicPatch(double[])
poffset
- the offset into pocoords where the control points start
-
addAreaToAdder
Add the surface area for those segments associated with a surface iterator to an Adder. The surface iterator will be modified.- Parameters:
adder
- the addersi
- the surface iterator
-
area
public double area()Compute the area of this surface.- Returns:
- the area
-
area
public double area(boolean parallel) Compute the area of this surface, perhaps in parallel- Parameters:
parallel
- true if the implementation should take advantage of a multiprocessor; false otherwise- Returns:
- the area
-
addVolumeToAdder
Add the surface-integral contributions, used in computing a volume for those segments associated with a surface iterator, to an Adder. The surface iterator will be modified. The total added to the adder will be 3 times the contribution of the iterator's patches to the volume of the shape it represents or partially represents. (Dividing by 3 at the end improves numerical accuracy.)The volume assumes the surface is well formed and is embedded in a Euclidean three-dimensional space. The algorithm first (in effect) translates an arbitrary reference point (rx, ry, rz) to the origin and then computes the integral of the vector (x, y, z) over the translated surface. The divergence of this vector is the constant 3, and Gauss's theorem states that the integral of the divergence of a vector field v over a volume bounded by a surface S is equal to the the surface integral of v over S (the integral over the surface of the dot product of v and the normal to the surface). Since the divergence is 3, this surface integral's value is 3 times the volume. It is the caller's responsibility to divide by this factor of 3 at the appropriate point.
A reasonable choice of the reference point is the center of the surface's bounding box, a heuristic that helps reduce floating-point errors.
- Parameters:
adder
- the addersi
- the surface iteratorrefPoint
- a reference point
-
volume
Compute the volume enclosed by this surface. The surface must be a closed manifold.- Returns:
- the volume enclosed by this surface
- Throws:
IllegalStateException
- the surface is not a closed manifold, is not an oriented manifold, or is not well formed
-
volume
public double volume(boolean parallel) Compute the volume enclosed by this surface, optionally in parallel. The surface must be a closed manifold.- Parameters:
parallel
- true if the computation should be performed in parallel; false otherwise- Returns:
- the volume enclosed by this surface
- Throws:
IllegalStateException
- the surface is not a closed manifold, is not an oriented manifold, or is not well formed
-
centerOfMassOf
Compute the center of mass of a shape assuming uniform density.- Parameters:
shape
- the shape- Returns:
- the center of mass
- Throws:
IllegalArgumentException
-
centerOfMassOf
public static Point3D centerOfMassOf(Shape3D shape, boolean parallel, int size) throws IllegalArgumentException Compute the center of mass of a shape assuming uniform density, specifying whether to use a sequential or parallel computation.The size estimate is used to determine how many threads to use when computing the moments in parallel.
- Parameters:
shape
- the shapeparallel
- true if the computation is done in parallel; false if it is done sequentially.size
- an estimate of the number of segments in the shape (ignored if the argument 'parallel' is false)- Returns:
- the center of mass
- Throws:
IllegalArgumentException
-
centerOfMassOf
Compute the center of mass of a shape assuming uniform density and given the shape's volume. The volume is provided as a parameter to speed up the computation for cases where the volume is already available.- Parameters:
shape
- the shapev
- the volume of the shape.- Returns:
- the center of mass
- Throws:
IllegalArgumentException
-
centerOfMassOf
public static Point3D centerOfMassOf(Shape3D shape, double v, boolean parallel, int size) throws IllegalArgumentException Compute the center of mass of a shape assuming uniform density and given the shape's volume, and specifying if the computation should be done in parallel. The volume is provided as a parameter to speed up the computation for cases where the volume is already available.The size estimate is used to determine how many threads to use when computing the moments in parallel.
- Parameters:
shape
- the shapev
- the volume of the shape.parallel
- true if the computation is done in parallel; false if it is done sequentially.size
- an estimate of the number of segments is the shape (ignored if the argument 'parallel' is false)- Returns:
- the center of mass
- Throws:
IllegalArgumentException
-
centerOfMassOf
public static Point3D centerOfMassOf(Shape3D shape, double v, double limit) throws IllegalArgumentException Compute the center of mass of a shape assuming uniform density and given the shape's volume and a flatness limit. The volume is provided as a parameter to speed up the computation for cases where the volume is already available. Flatness parameters are described in the documentation forSurfaceIntegral(int,RealValuedFunctThreeOps,RealValuedFunctThreeOps,RealValuedFunctThreeOps,double)
, and can be used to decrease running time at the expense of a possible reduction in accuracy.- Parameters:
shape
- the shapev
- the volume of the shape.limit
- the flatness parameter- Returns:
- the center of mass
- Throws:
IllegalArgumentException
-
centerOfMassOf
public static Point3D centerOfMassOf(Shape3D shape, double v, double limit, boolean parallel, int size) throws IllegalArgumentException Compute the center of mass of a shape assuming uniform density and given the shape's volume and a flatness limit, and specifying if the computation should be done in parallel. The volume is provided as a parameter to speed up the computation for cases where the volume is already available. Flatness parameters are described in the documentation forSurfaceIntegral(int,RealValuedFunctThreeOps,RealValuedFunctThreeOps,RealValuedFunctThreeOps,double)
, and can be used to decrease running time at the expense of a possible reduction in accuracy.The size estimate is used to determine how many threads to use when computing the moments in parallel.
- Parameters:
shape
- the shapev
- the volume of the shape.limit
- the flatness parameterparallel
- true if the computation is done in parallel; false if it is done sequentially.size
- an estimate of the number of segments is the shape (ignored if the argument 'parallel' is false)- Returns:
- the center of mass
- Throws:
IllegalArgumentException
-
momentsOf
Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p. If p = (px, py, pz), r = (rx, ry, rz), and- x = rx - px
- y = ry - py
- z = rz - pz
- Parameters:
shape
- the shape whose moments are computedp
- the point about which to compute the moments- Returns:
- the moments
- Throws:
IllegalArgumentException
-
momentsOf
public static double[][] momentsOf(Shape3D shape, Point3D p, boolean parallel, int size) throws IllegalArgumentException Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying an estimate of the number of segments in a shape and whether or not the moments should be computed in parallel. If p = (px, py, pz), r = (rx, ry, rz), and- x = rx - px
- y = ry - py
- z = rz - pz
The size estimate is used to determine how many threads to use when computing the moments in parallel.
- Parameters:
shape
- the shape whose moments are computedp
- the point about which to compute the momentsparallel
- true if the moments should be computed in parallel; false otherwisesize
- an estimate of the number of element in the shape (ignored if 'parallel' is false)- Returns:
- the moments
- Throws:
IllegalArgumentException
-
momentsOf
public static double[][] momentsOf(Shape3D shape, Point3D p, double v) throws IllegalArgumentException Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume. If p = (px, py, pz), r = (rx, ry, rz), and- x = rx - px
- y = ry - py
- z = rz - pz
- Parameters:
shape
- the shape whose moments are computedp
- the point about which to compute the momentsv
- the shape's volume- Returns:
- the moments
- Throws:
IllegalArgumentException
-
momentsOf
public static double[][] momentsOf(Shape3D shape, Point3D p, double v, boolean parallel, int size) throws IllegalArgumentException Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume and whether or not the computation should be performed in parallel. If p = (px, py, pz), r = (rx, ry, rz), and- x = rx - px
- y = ry - py
- z = rz - pz
The size estimate is used to determine how many threads to use when computing the moments in parallel.
- Parameters:
shape
- the shape whose moments are computedp
- the point about which to compute the momentsv
- the shape's volumeparallel
- true if the computation is done in parallel; false if it is done sequentially.size
- an estimate of the number of segments is the shape (ignored if the argument 'parallel' is false)- Returns:
- the moments
- Throws:
IllegalArgumentException
-
momentsOf
public static double[][] momentsOf(Shape3D shape, Point3D p, double v, double limit) throws IllegalArgumentException Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume and a flatness parameter. If p = (px, py, pz), r = (rx, ry, rz), and- x = rx - px
- y = ry - py
- z = rz - pz
Flatness parameters are described in the documentation for
SurfaceIntegral(int,RealValuedFunctThreeOps,RealValuedFunctThreeOps,RealValuedFunctThreeOps,double)
, and can be used to decrease running time at the expense of a possible reduction in accuracy.- Parameters:
shape
- the shape whose moments are computedp
- the point about which to compute the momentsv
- the shape's volumelimit
- the flatness parameter- Returns:
- the moments
- Throws:
IllegalArgumentException
-
momentsOf
public static double[][] momentsOf(Shape3D shape, Point3D p, double v, double limit, boolean parallel, int size) throws IllegalArgumentException Compute the moments about axes parallel to the X, Y, and Z axis and located at a point p, specifying the shape's volume, a flatness parameter, and whether or not the computation should be performed in parallel. If p = (px, py, pz), r = (rx, ry, rz), and- x = rx - px
- y = ry - py
- z = rz - pz
Flatness parameters are described in the documentation for
SurfaceIntegral(int,RealValuedFunctThreeOps,RealValuedFunctThreeOps,RealValuedFunctThreeOps,double)
, and can be used to decrease running time at the expense of a possible reduction in accuracy.The size estimate is used to determine how many threads to use when computing the moments in parallel.
- Parameters:
shape
- the shape whose moments are computedp
- the point about which to compute the momentsv
- the shape's volumelimit
- the flatness parameterparallel
- true if the computation is done in parallel; false if it is done sequentially.size
- an estimate of the number of segments is the shape (ignored if the argument 'parallel' is false)- Returns:
- the moments
- Throws:
IllegalArgumentException
-