java.lang.Object
org.bzdev.geom.TransformedPathIterator3D
- All Implemented Interfaces:
PathIterator3D
PathIterator3D based on a transformation of another PathIterator3D.
This class obtains the segment type and control points from
a path iterator that it encapsulates, and applies a transform
to those control points. The path iterator passed to the constructor
will be modified as methods are called.
The rationale for this class is the same as for
TransformedPathIterator
.
The same effect can be achieved by calling FlattenedPathIterator3D with a limit of 0, albeit with slightly worse performance.
-
Field Summary
Fields inherited from interface org.bzdev.geom.PathIterator3D
SEG_CLOSE, SEG_CUBICTO, SEG_LINETO, SEG_MOVETO, SEG_QUADTO
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor given an AffineTransform3D.Constructor given a Transform3D. -
Method Summary
Modifier and TypeMethodDescriptionint
currentSegment
(double[] coords) Returns the coordinates and type of the current path segment in the iteration.int
currentSegment
(float[] coords) Returns the coordinates and type of the current path segment in the iteration.boolean
isDone()
Tests if the iteration is complete.void
next()
Moves the iterator to the next segment of the path forwards along the primary direction of traversal as long as there are more points in that direction.
-
Constructor Details
-
TransformedPathIterator3D
Constructor given an AffineTransform3D. Because the path iterator passed to this constructor will be modified by this object's methods, it is a good practice to call the constructor as follows
to avoid having multiple references that modify the same object.PathIterator3D pi = ... AffineTransform3D at = ... pi = new TransformedPathIterator3D(pi, at);
- Parameters:
pi
- the path iteratorat
- the affine transform; null if there is none.- Throws:
NullPointerException
- the path iterator was null
-
TransformedPathIterator3D
Constructor given a Transform3D. Because the path iterator passed to this constructor will be modified by this object's methods, it is a good practice to call the constructor as follows
to avoid having multiple references that modify the same object.PathIterator pi = ... Transform3D at = ... pi = new TransformedPathIterator(pi, at);
- Parameters:
pi
- the path iteratortf
- the transform; null if there is none.- Throws:
NullPointerException
- the path iterator was null
-
-
Method Details
-
currentSegment
public int currentSegment(double[] coords) Description copied from interface:PathIterator3D
Returns the coordinates and type of the current path segment in the iteration. The return value is the path-segment type: SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. A double array of length 9 must be passed in and can be used to store the coordinates of the point(s). Each point is stored as a triplet of double x,y,z coordinates. SEG_MOVETO and SEG_LINETO types returns one point, SEG_QUADTO returns two points, SEG_CUBICTO returns 3 points and SEG_CLOSE does not return any points.- Specified by:
currentSegment
in interfacePathIterator3D
- Parameters:
coords
- - an array that holds the data returned from this method- Returns:
- he path-segment type of the current path segment
-
currentSegment
public int currentSegment(float[] coords) Description copied from interface:PathIterator3D
Returns the coordinates and type of the current path segment in the iteration. The return value is the path-segment type: SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. A float array of length 9 must be passed in and can be used to store the coordinates of the point(s). Each point is stored as a triplet of float x,y,z coordinates. SEG_MOVETO and SEG_LINETO types returns one point, SEG_QUADTO returns two points, SEG_CUBICTO returns 3 points and SEG_CLOSE does not return any points.- Specified by:
currentSegment
in interfacePathIterator3D
- Parameters:
coords
- - an array that holds the data returned from this method- Returns:
- the path-segment type of the current path segment.
-
isDone
public boolean isDone()Description copied from interface:PathIterator3D
Tests if the iteration is complete.- Specified by:
isDone
in interfacePathIterator3D
- Returns:
- true if all the segments have been read; false otherwise.
-
next
public void next()Description copied from interface:PathIterator3D
Moves the iterator to the next segment of the path forwards along the primary direction of traversal as long as there are more points in that direction.- Specified by:
next
in interfacePathIterator3D
-