Class Cubic

  • All Implemented Interfaces:
    java.lang.Cloneable, Segment

    public class Cubic
    extends AbstractSegment
    A class representing a cubic path segment.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.awt.geom.Point2D.Double p1  
      java.awt.geom.Point2D.Double p2  
      java.awt.geom.Point2D.Double p3  
      java.awt.geom.Point2D.Double p4  
    • Constructor Summary

      Constructors 
      Constructor Description
      Cubic()  
      Cubic​(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)  
      Cubic​(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2, java.awt.geom.Point2D.Double p3, java.awt.geom.Point2D.Double p4)  
    • Field Detail

      • p1

        public java.awt.geom.Point2D.Double p1
      • p2

        public java.awt.geom.Point2D.Double p2
      • p3

        public java.awt.geom.Point2D.Double p3
      • p4

        public java.awt.geom.Point2D.Double p4
    • Constructor Detail

      • Cubic

        public Cubic()
      • Cubic

        public Cubic​(double x1,
                     double y1,
                     double x2,
                     double y2,
                     double x3,
                     double y3,
                     double x4,
                     double y4)
      • Cubic

        public Cubic​(java.awt.geom.Point2D.Double p1,
                     java.awt.geom.Point2D.Double p2,
                     java.awt.geom.Point2D.Double p3,
                     java.awt.geom.Point2D.Double p4)
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • reverse

        public Segment reverse()
      • minX

        public double minX()
      • maxX

        public double maxX()
      • minY

        public double minY()
      • maxY

        public double maxY()
      • getBounds2D

        public java.awt.geom.Rectangle2D getBounds2D()
      • evalDt

        public java.awt.geom.Point2D.Double evalDt​(double t)
      • eval

        public java.awt.geom.Point2D.Double eval​(double t)
      • subdivide

        public void subdivide​(Segment s0,
                              Segment s1)
        Subdivides this Cubic curve into two curves at t = 0.5. can be done with getSegment but this is more efficent.
        Parameters:
        s0 - if non-null contains portion of curve from 0->.5
        s1 - if non-null contains portion of curve from .5->1
      • subdivide

        public void subdivide​(double t,
                              Segment s0,
                              Segment s1)
        Subdivides this Cubic curve into two curves at given t.
        Parameters:
        s0 - if non-null contains portion of curve from 0->t.
        s1 - if non-null contains portion of curve from t->1.
      • subdivide

        public void subdivide​(Cubic c0,
                              Cubic c1)
        Subdivides this Cubic curve into two curves at t = 0.5. can be done with getSegment but this is more efficent.
        Parameters:
        c0 - if non-null contains portion of curve from 0->.5
        c1 - if non-null contains portion of curve from .5->1
      • subdivide

        public void subdivide​(double t,
                              Cubic c0,
                              Cubic c1)
        Subdivides this Cubic curve into two curves at given t.
        Parameters:
        c0 - if non-null contains portion of curve from 0->t.
        c1 - if non-null contains portion of curve from t->1.
      • getSegment

        public Segment getSegment​(double t0,
                                  double t1)
      • subLength

        protected double subLength​(double leftLegLen,
                                   double rightLegLen,
                                   double maxErr)
      • getLength

        public double getLength()
      • getLength

        public double getLength​(double maxErr)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object