Package snap.gfx3d
Class Path3D
java.lang.Object
snap.props.PropObject
snap.gfx3d.Shape3D
snap.gfx3d.FacetShape
snap.gfx3d.Path3D
- All Implemented Interfaces:
Cloneable
,PropChange.DoChange
This class represents a path in 3D space.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Seg
static final Seg
static final Seg
static final Seg
static final Seg
Fields inherited from class snap.gfx3d.FacetShape
_triangleArray
Fields inherited from class snap.gfx3d.Shape3D
_smoothSides
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addShapePath
(Shape aPath, double aDepth) Adds a Shape path to this path3D at given depth.clone()
Standard clone implementation.void
close()
Adds a close element to the path3d.copyForMatrix
(Matrix3D aTrans) Copies path for given transform matrix.protected Bounds3D
Returns the bounds.protected Vector3D
Returns the normal of the path3d.void
curveTo
(double cp1x, double cp1y, double cp1z, double cp2x, double cp2y, double cp2z, double x, double y, double z) Adds a curve-to to the path3d with the given 3d coords.getPoint
(int anIndex) Returns the Point3D at given index.int
Returns the number of points in this Path3d.getSeg
(int anIndex) Returns the Seg at given index.Returns the element at the given index.int
Returns the number of segments in this Path3d.Returns the 2D shape for the path3d (should only be called when path is facing Z).protected VertexArray
Returns a VertexArray for path stroke.void
lineTo
(double x, double y, double z) Adds a line to the path3d with the given 3D coords.void
moveTo
(double x, double y, double z) Adds a moveto to the path3d with the given 3D coords.void
quadTo
(double cpx, double cpy, double cpz, double x, double y, double z) Adds a quad to to the path3d with the given 3D control point and coords.void
reverse()
Reverses the path3d.Standard toStringProps implementation.void
Transforms the path by the given transform matrix.Methods inherited from class snap.gfx3d.FacetShape
clearCachedValues, createTriangleArray, createVertexArrays, getNormal, getPainter, getPainterToLocal, getPainterVertexArray, getTexture, getTransformToAlignToVector, getTriangleArray, setPainter, setTexture
Methods inherited from class snap.gfx3d.Shape3D
getBounds3D, getBoundsCenter, getColor, getMaxX, getMaxY, getMaxZ, getMinX, getMinY, getMinZ, getName, getOpacity, getParent, getStroke, getStrokeColor, isDoubleSided, isVisible, setBounds3D, setColor, setDoubleSided, setName, setOpacity, setParent, setSmoothSides, setStroke, setStroke, setStrokeColor, setVisible
Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, getPropValue, initProps, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValue, setPropValues, toString
-
Field Details
-
MOVE_TO
-
LINE_TO
-
QUAD_TO
-
CURVE_TO
-
CLOSE
-
-
Constructor Details
-
Path3D
public Path3D()Constructor. -
Path3D
Constructor for a 2D path with a depth.
-
-
Method Details
-
getSegCount
public int getSegCount()Returns the number of segments in this Path3d. -
getSeg
Returns the Seg at given index. -
getPointCount
public int getPointCount()Returns the number of points in this Path3d.- Specified by:
getPointCount
in classFacetShape
-
getPoint
Returns the Point3D at given index.- Specified by:
getPoint
in classFacetShape
-
getSeg
Returns the element at the given index. -
moveTo
public void moveTo(double x, double y, double z) Adds a moveto to the path3d with the given 3D coords. -
lineTo
public void lineTo(double x, double y, double z) Adds a line to the path3d with the given 3D coords. -
quadTo
public void quadTo(double cpx, double cpy, double cpz, double x, double y, double z) Adds a quad to to the path3d with the given 3D control point and coords. -
curveTo
public void curveTo(double cp1x, double cp1y, double cp1z, double cp2x, double cp2y, double cp2z, double x, double y, double z) Adds a curve-to to the path3d with the given 3d coords. -
close
public void close()Adds a close element to the path3d. -
addShapePath
Adds a Shape path to this path3D at given depth. -
createNormal
Returns the normal of the path3d. Right hand rule for clockwise/counter-clockwise defined polygons.- Specified by:
createNormal
in classFacetShape
-
getShape2D
Returns the 2D shape for the path3d (should only be called when path is facing Z).- Specified by:
getShape2D
in classFacetShape
-
getStrokeTriangleArray
Returns a VertexArray for path stroke.- Overrides:
getStrokeTriangleArray
in classFacetShape
-
transform
Transforms the path by the given transform matrix. -
copyForMatrix
Copies path for given transform matrix.- Specified by:
copyForMatrix
in classFacetShape
-
reverse
public void reverse()Reverses the path3d.- Specified by:
reverse
in classFacetShape
-
createBounds3D
Returns the bounds.- Specified by:
createBounds3D
in classShape3D
-
clone
Standard clone implementation.- Overrides:
clone
in classFacetShape
-
toStringProps
Standard toStringProps implementation.- Overrides:
toStringProps
in classShape3D
-