scalation.scala2d

QCurve

case class QCurve(p1: R2 = R2 (0.0, 0.0), pc: R2 = R2 (0.0, 0.0), p2: R2 = R2 (0.0, 0.0), straight: Boolean = true) extends Double with CurvilinearShape with Product with Serializable

The QCurve class enhances the QuadCurve.Double class (from the java.awt.geom package) by allowing entities to move along such quadratic curves as well as lines. Although the curve could be developed as a quadratic function where 'y = ax2 + bx + c'. The following quadratic bezier formulation is used: p(t) = (x(t), y(t)) = [(1-t)2 * p1] + [2 * (1-t) * t * pc] + [t^2 * p2].

p1

the starting point for the quad curve

pc

the control point for the quad curve

p2

the ending point for the quad curve

straight

whether the quad curve is straight (i.e., a line)

Linear Supertypes
Serializable, Product, Equals, CurvilinearShape, Error, Double, Serializable, QuadCurve2D, Cloneable, Shape, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. QCurve
  2. Serializable
  3. Product
  4. Equals
  5. CurvilinearShape
  6. Error
  7. Double
  8. Serializable
  9. QuadCurve2D
  10. Cloneable
  11. Shape
  12. AnyRef
  13. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new QCurve(p1: R2, pc: R2, p2: R2)

    Construct a quad curve using an explicitly given control point.

    Construct a quad curve using an explicitly given control point.

    p1

    the starting point

    pc

    the control point

    p2

    the ending point

  2. new QCurve(p1: R2, p2: R2, bend: Double)

    Construct a quad curve where bend indicates the distance to the control point.

    Construct a quad curve where bend indicates the distance to the control point.

    p1

    the starting point

    p2

    the ending point

    bend

    the bend or curvature (1. => line length)

  3. new QCurve(p1: R2, p2: R2)

    Construct a straight line (degenerate quad curve).

    Construct a straight line (degenerate quad curve).

    p1

    the starting point

    p2

    the ending point

  4. new QCurve(p1: R2 = R2 (0.0, 0.0), pc: R2 = R2 (0.0, 0.0), p2: R2 = R2 (0.0, 0.0), straight: Boolean = true)

    p1

    the starting point for the quad curve

    pc

    the control point for the quad curve

    p2

    the ending point for the quad curve

    straight

    whether the quad curve is straight (i.e., a line)

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Definition Classes
    QuadCurve2D → AnyRef
  6. def contains(arg0: Rectangle2D): Boolean

    Definition Classes
    QuadCurve2D → Shape
  7. def contains(arg0: Double, arg1: Double, arg2: Double, arg3: Double): Boolean

    Definition Classes
    QuadCurve2D → Shape
  8. def contains(arg0: Point2D): Boolean

    Definition Classes
    QuadCurve2D → Shape
  9. def contains(arg0: Double, arg1: Double): Boolean

    Definition Classes
    QuadCurve2D → Shape
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def eval(): R2

    Given a value for the trajectory parameter t (in [0.

    Given a value for the trajectory parameter t (in [0., 1.]) calculate the point on the curve using the Quadratic Bezier equation. See http://en.wikipedia.org/wiki/Bézier_curve#Quadratic_curves

  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def flaw(method: String, message: String): Unit

    Show the flaw by printing the error message.

    Show the flaw by printing the error message.

    method

    the method where the error occurred

    message

    the error message

    Definition Classes
    Error
  14. def getBounds(): java.awt.Rectangle

    Definition Classes
    QuadCurve2D → Shape
  15. def getBounds2D(): Rectangle2D

    Definition Classes
    Double → Shape
  16. def getCenterX(): Double

    Get the x-coordinate of the center of the line/curve.

    Get the x-coordinate of the center of the line/curve.

    Definition Classes
    QCurveCurvilinearShape
  17. def getCenterY(): Double

    Get the y-coordinate of the center of the line/curve.

    Get the y-coordinate of the center of the line/curve.

    Definition Classes
    QCurveCurvilinearShape
  18. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  19. def getControl: R2

    Get the control point of the quad curve.

  20. def getCtrlPt(): Point2D

    Definition Classes
    Double → QuadCurve2D
  21. def getCtrlX(): Double

    Definition Classes
    Double → QuadCurve2D
  22. def getCtrlY(): Double

    Definition Classes
    Double → QuadCurve2D
  23. def getFirst(width: Double, height: Double): R2

    Get the first/start point of the quad curve, adjusted from top-left to center coordinates.

    Get the first/start point of the quad curve, adjusted from top-left to center coordinates.

    width

    the width of object traversing the curve

    height

    the height of object traversing the curve

  24. def getFirst: R2

    Get the first/start point of the quad curve.

  25. def getFlatness(): Double

    Definition Classes
    QuadCurve2D
  26. def getFlatnessSq(): Double

    Definition Classes
    QuadCurve2D
  27. def getLast(width: Double, height: Double): R2

    Get the last/end point of the quad curve, adjusted from top-left to center coordinates.

    Get the last/end point of the quad curve, adjusted from top-left to center coordinates.

    width

    the width of object traversing the curve

    height

    the height of object traversing the curve

  28. def getLast: R2

    Get the last/end point of the quad curve.

  29. def getP1(): Point2D

    Definition Classes
    Double → QuadCurve2D
  30. def getP2(): Point2D

    Definition Classes
    Double → QuadCurve2D
  31. def getPathIterator(arg0: AffineTransform, arg1: Double): PathIterator

    Definition Classes
    QuadCurve2D → Shape
  32. def getPathIterator(arg0: AffineTransform): PathIterator

    Definition Classes
    QuadCurve2D → Shape
  33. def getX1(): Double

    Definition Classes
    Double → QuadCurve2D
  34. def getX2(): Double

    Definition Classes
    Double → QuadCurve2D
  35. def getY1(): Double

    Definition Classes
    Double → QuadCurve2D
  36. def getY2(): Double

    Definition Classes
    Double → QuadCurve2D
  37. def intersects(arg0: Rectangle2D): Boolean

    Definition Classes
    QuadCurve2D → Shape
  38. def intersects(arg0: Double, arg1: Double, arg2: Double, arg3: Double): Boolean

    Definition Classes
    QuadCurve2D → Shape
  39. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  40. def isSame(x: Double, y: Double, xe: Double, ye: Double, step: Double): Boolean

    Are (x, y) and (xe, ye) essentially the same?

  41. def length: Double

    Return the length of this QCurve

  42. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  43. def next(width: Double, height: Double): R2

    Return the next point on the quad curve (one step beyond current point) and adjust from top-left to center coordinates for the object traversing the curve based on its width and height.

    Return the next point on the quad curve (one step beyond current point) and adjust from top-left to center coordinates for the object traversing the curve based on its width and height. Return null if t > 1. (i.e., past end point).

    width

    the width of object traversing the curve

    height

    the height of object traversing the curve

    Definition Classes
    QCurveCurvilinearShape
  44. def next(): R2

    Return the next point on the quad curve (one step beyond current point).

    Return the next point on the quad curve (one step beyond current point). Return null if t > 1. (i.e., past end point).

  45. final def notify(): Unit

    Definition Classes
    AnyRef
  46. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  47. var p1: R2

    the starting point for the quad curve

  48. var p2: R2

    the ending point for the quad curve

  49. var pc: R2

    the control point for the quad curve

  50. def setCurve(arg0: Double, arg1: Double, arg2: Double, arg3: Double, arg4: Double, arg5: Double): Unit

    Definition Classes
    Double → QuadCurve2D
  51. def setCurve(arg0: QuadCurve2D): Unit

    Definition Classes
    QuadCurve2D
  52. def setCurve(arg0: Array[Point2D], arg1: Int): Unit

    Definition Classes
    QuadCurve2D
  53. def setCurve(arg0: Point2D, arg1: Point2D, arg2: Point2D): Unit

    Definition Classes
    QuadCurve2D
  54. def setCurve(arg0: Array[Double], arg1: Int): Unit

    Definition Classes
    QuadCurve2D
  55. def setLine(_p1: R2, _pc: R2, _p2: R2): Unit

    Set (or reset) the location for the QCurve as a curve using an explicitly given control point.

    Set (or reset) the location for the QCurve as a curve using an explicitly given control point.

    _p1

    the starting point

    _pc

    the control point

    _p2

    the ending point

    Definition Classes
    QCurveCurvilinearShape
  56. def setLine(_p1: R2, _p2: R2, bend: Double): Unit

    Set (or reset) the location for the QCurve as a curve using bend to calculate the control point.

    Set (or reset) the location for the QCurve as a curve using bend to calculate the control point.

    _p1

    the starting point

    _p2

    the ending point

    bend

    the bend or curvature (1. => line-length)

    Definition Classes
    QCurveCurvilinearShape
  57. def setLine(_p1: R2, _p2: R2): Unit

    Set (or reset) the location for the QCurve as a line.

    Set (or reset) the location for the QCurve as a line.

    _p1

    the starting point

    _p2

    the ending point

    Definition Classes
    QCurveCurvilinearShape
  58. def setSteps(_steps: Int): Unit

    Set the number of steps for tokens to take as move along the quad curve.

  59. def setTrajectory(traj: Double): Unit

    Set the trajectory (t) to a new value.

    Set the trajectory (t) to a new value.

    traj

    the new trajectory for the curve

  60. var straight: Boolean

    whether the quad curve is straight (i.

    whether the quad curve is straight (i.e., a line)

  61. def subdivide(arg0: QuadCurve2D, arg1: QuadCurve2D): Unit

    Definition Classes
    QuadCurve2D
  62. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  63. def toString(): String

    Show the start, control and end points of the the QCurve.

    Show the start, control and end points of the the QCurve.

    Definition Classes
    QCurve → AnyRef → Any
  64. def trajectory: Double

    Return the current trajectory (t) of the curve.

  65. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from CurvilinearShape

Inherited from Error

Inherited from Double

Inherited from Serializable

Inherited from QuadCurve2D

Inherited from Cloneable

Inherited from Shape

Inherited from AnyRef

Inherited from Any

Ungrouped