Class Linear

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

    public class Linear
    extends java.lang.Object
    implements Segment
    A class representing a linear path segment.
    Version:
    $Id: Linear.java 1805408 2017-08-18 12:21:52Z ssteiner $
    • Field Detail

      • p1

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

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

      • Linear

        public Linear()
      • Linear

        public Linear​(double x1,
                      double y1,
                      double x2,
                      double y2)
      • Linear

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

      • clone

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

        public Segment reverse()
      • minX

        public double minX()
        Specified by:
        minX in interface Segment
      • maxX

        public double maxX()
        Specified by:
        maxX in interface Segment
      • minY

        public double minY()
        Specified by:
        minY in interface Segment
      • maxY

        public double maxY()
        Specified by:
        maxY in interface Segment
      • getBounds2D

        public java.awt.geom.Rectangle2D getBounds2D()
        Specified by:
        getBounds2D in interface Segment
      • evalDt

        public java.awt.geom.Point2D.Double evalDt​(double t)
        Specified by:
        evalDt in interface Segment
      • eval

        public java.awt.geom.Point2D.Double eval​(double t)
        Specified by:
        eval in interface Segment
      • subdivide

        public void subdivide​(Segment s0,
                              Segment s1)
        Subdivides this Linear segment into two segments at t = 0.5. can be done with getSegment but this is more efficent.
        Specified by:
        subdivide in interface Segment
        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 Linear segment into two segments at given t.
        Specified by:
        subdivide in interface Segment
        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​(Linear l0,
                              Linear l1)
        Subdivides this Cubic curve into two curves at t = 0.5. Can be done with getSegment but this is more efficent.
        Parameters:
        l0 - if non-null contains portion of curve from 0->.5
        l1 - if non-null contains portion of curve from .5->1
      • subdivide

        public void subdivide​(double t,
                              Linear l0,
                              Linear l1)
        Subdivides this Cubic curve into two curves. Can be done with getSegment but this is more efficent.
        Parameters:
        t - position to split the curve
        l0 - if non-null contains portion of curve from 0->t
        l1 - if non-null contains portion of curve from t->1
      • getLength

        public double getLength()
        Specified by:
        getLength in interface Segment
      • getLength

        public double getLength​(double maxErr)
        Specified by:
        getLength in interface Segment
      • toString

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