Class RMBezier

All Implemented Interfaces:
RMArchiver.Archiving, Cloneable

public class RMBezier extends RMQuadratic
This class models a simple bezier curve, providing methods for extracting points, distance calculation, bisection, hit detection and such.
  • Field Details

  • Constructor Details

    • RMBezier

      public RMBezier()
      Creates a new bezier.
    • RMBezier

      public RMBezier(RMPoint startPoint, RMPoint controlPoint1, RMPoint controlPoint2, RMPoint endPoint)
      Creates a new bezier from the given start point, control points and end point.
  • Method Details

    • setCurve

      public void setCurve(RMPoint p1, RMPoint p2, RMPoint p3, RMPoint p4)
      Sets the values of the curve.
    • getPoint

      public RMPoint getPoint(double t)
      Returns a specific point on the curve at the given parametric value (from 0-1).
      Overrides:
      getPoint in class RMQuadratic
    • getDistanceBezier

      public double getDistanceBezier(RMPoint aPoint)
      Returns the minimum distance from the given point to the curve.
    • getMinX

      public float getMinX()
      Returns the min x point of this bezier.
      Overrides:
      getMinX in class RMQuadratic
    • getMinY

      public float getMinY()
      Returns the min y point of this bezier.
      Overrides:
      getMinY in class RMQuadratic
    • getMaxX

      public float getMaxX()
      Returns the max x point of this bezier.
      Overrides:
      getMaxX in class RMQuadratic
    • getMaxY

      public float getMaxY()
      Returns the max y point of this bezier.
      Overrides:
      getMaxY in class RMQuadratic
    • getBounds2D

      public Rectangle2D getBounds2D()
      Returns the bounding box of the shape.
    • getHitInfo

      public RMHitInfo getHitInfo(RMLine aLine)
      Returns the hit info for this bezier and a given line.
      Overrides:
      getHitInfo in class RMLine
    • getHitInfo

      public RMHitInfo getHitInfo(RMBezier aBezier)
      Returns a hit info for this bezier and given bezier.
      Overrides:
      getHitInfo in class RMLine
    • subdivide

      public void subdivide(RMBezier left, RMBezier right, double t)
      Returns a bezier curve from this curve's start point to the given parametric location (0-1).
    • setEnd

      public void setEnd(double t)
      Reset this curve's end point to the given parametric location (0-1).
      Overrides:
      setEnd in class RMLine
    • setStart

      public void setStart(double t)
      Reset this curve's start point to the given parametric location (0-1).
      Overrides:
      setStart in class RMLine
    • toString

      public String toString()
      Returns a string representation of this bezier.
      Overrides:
      toString in class RMLine