# Curve (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.geom
Class Curve

    java.lang.Object
      org.newdawn.slick.geom.Shape
          org.newdawn.slick.geom.Curve

All Implemented Interfaces:
  java.io.Serializable

    public class Curve

extends Shape

A beizer curve implementation. The curve is defined by a start point, an end point and two control points that it will tend towards. This is implementation is fixed segmenting meaning it doesn't scale too well.

Author:
  kevin
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.newdawn.slick.geom.Shape
`boundingCircleRadius, center, maxX, maxY, minX, minY, points, pointsDirty, trianglesDirty, tris, x, y`

Constructor Summary
`Curve(Vector2f p1, Vector2f c1, Vector2f c2, Vector2f p2)` Create a new curve with the default segments (20)
`Curve(Vector2f p1, Vector2f c1, Vector2f c2, Vector2f p2, int segments)` Create a new curve

Method Summary
`boolean` `closed()` True if this is a closed shape
`protected void` `createPoints()` Subclasses implement this to create the points of the shape.
`Vector2f` `pointAt(float t)` Get the point at a particular location on the curve
`Shape` `transform(Transform transform)` Apply a transformation and return a new shape.

Methods inherited from class org.newdawn.slick.geom.Shape

`calculateRadius, calculateTriangles, checkPoints, contains, contains, findCenter, getBoundingCircleRadius, getCenter, getCenterX, getCenterY, getHeight, getLocation, getMaxX, getMaxY, getMinX, getMinY, getNormal, getPoint, getPointCount, getPoints, getTriangles, getWidth, getX, getY, hasVertex, includes, increaseTriangulation, indexOf, intersects, preCache, prune, setCenterX, setCenterY, setLocation, setLocation, setX, setY, subtract, union`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Curve

    public Curve(Vector2f p1,
                 Vector2f c1,
                 Vector2f c2,
                 Vector2f p2)

  Create a new curve with the default segments (20)

  Parameters:
    `p1` - The start of the curve
    `c1` - The first control point
    `c2` - The second control point
    `p2` - The end of the curve

### Curve

    public Curve(Vector2f p1,
                 Vector2f c1,
                 Vector2f c2,
                 Vector2f p2,
                 int segments)

  Create a new curve

  Parameters:
    `p1` - The start of the curve
    `c1` - The first control point
    `c2` - The second control point
    `p2` - The end of the curve
    `segments` - The number of segments to use

Method Detail

### pointAt

    public Vector2f pointAt(float t)

  Get the point at a particular location on the curve

  Parameters:
    `t` - A value between 0 and 1 defining the location of the curve the point is at
  Returns:
    The point on the curve

### createPoints

    protected void createPoints()

  Description copied from class: `Shape`
  Subclasses implement this to create the points of the shape.

  Specified by:
    `createPoints` in class `Shape`
  See Also:
    `Shape.createPoints()`

### transform

    public Shape transform(Transform transform)

  Description copied from class: `Shape`
  Apply a transformation and return a new shape. This will not alter the current shape but will return the transformed shape.

  Specified by:
    `transform` in class `Shape`
  Parameters:
    `transform` - The transform to be applied
  Returns:
    The transformed shape.
  See Also:
    `Shape.transform(org.newdawn.slick.geom.Transform)`

### closed

    public boolean closed()

  True if this is a closed shape

  Overrides:
    `closed` in class `Shape`
  Returns:
    True if this is a closed shape

Copyright © 2006 New Dawn Software. All Rights Reserved.