Package snap.gfx3d

Class Path3D

All Implemented Interfaces:
Cloneable, PropChange.DoChange

public class Path3D extends FacetShape implements Cloneable
This class represents a path in 3D space.
  • Field Details

    • MOVE_TO

      public static final Seg MOVE_TO
    • LINE_TO

      public static final Seg LINE_TO
    • QUAD_TO

      public static final Seg QUAD_TO
    • CURVE_TO

      public static final Seg CURVE_TO
    • CLOSE

      public static final Seg CLOSE
  • Constructor Details

    • Path3D

      public Path3D()
      Constructor.
    • Path3D

      public Path3D(Shape aShape, double aDepth)
      Constructor for a 2D path with a depth.
  • Method Details

    • getSegCount

      public int getSegCount()
      Returns the number of segments in this Path3d.
    • getSeg

      public Seg getSeg(int anIndex)
      Returns the Seg at given index.
    • getPointCount

      public int getPointCount()
      Returns the number of points in this Path3d.
      Specified by:
      getPointCount in class FacetShape
    • getPoint

      public Point3D getPoint(int anIndex)
      Returns the Point3D at given index.
      Specified by:
      getPoint in class FacetShape
    • getSeg

      public Seg getSeg(int anIndex, Point3D[] pts)
      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

      public void addShapePath(Shape aPath, double aDepth)
      Adds a Shape path to this path3D at given depth.
    • createNormal

      protected Vector3D createNormal()
      Returns the normal of the path3d. Right hand rule for clockwise/counter-clockwise defined polygons.
      Specified by:
      createNormal in class FacetShape
    • getShape2D

      public Shape getShape2D()
      Returns the 2D shape for the path3d (should only be called when path is facing Z).
      Specified by:
      getShape2D in class FacetShape
    • getStrokeTriangleArray

      protected VertexArray getStrokeTriangleArray()
      Returns a VertexArray for path stroke.
      Overrides:
      getStrokeTriangleArray in class FacetShape
    • transform

      public void transform(Matrix3D xform)
      Transforms the path by the given transform matrix.
    • copyForMatrix

      public Path3D copyForMatrix(Matrix3D aTrans)
      Copies path for given transform matrix.
      Specified by:
      copyForMatrix in class FacetShape
    • reverse

      public void reverse()
      Reverses the path3d.
      Specified by:
      reverse in class FacetShape
    • createBounds3D

      protected Bounds3D createBounds3D()
      Returns the bounds.
      Specified by:
      createBounds3D in class Shape3D
    • clone

      public Path3D clone()
      Standard clone implementation.
      Overrides:
      clone in class FacetShape
    • toStringProps

      public String toStringProps()
      Standard toStringProps implementation.
      Overrides:
      toStringProps in class Shape3D