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

## org.newdawn.slick.geom
Class Path

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

All Implemented Interfaces:
  java.io.Serializable

    public class Path

extends Shape

A shape built from lines and curves. Hole support is present but restricted.

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
`Path(float sx, float sy)` Create a new path

Method Summary
`void` `close()` Close the path to form a polygon
`boolean` `closed()` True if this is a closed shape
`protected void` `createPoints()` Subclasses implement this to create the points of the shape.
`void` `curveTo(float x, float y, float cx1, float cy1, float cx2, float cy2)` Add a curve to the specified location (using the default segments 10)
`void` `curveTo(float x, float y, float cx1, float cy1, float cx2, float cy2, int segments)` Add a curve to the specified location (specifing the number of segments)
`void` `lineTo(float x, float y)` Add a line to the contour or hole which ends at the specified location.
`void` `startHole(float sx, float sy)` Start building a hole in the previously defined contour
`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

### Path

    public Path(float sx,
                float sy)

  Create a new path

  Parameters:
    `sx` - The start x coordinate of the path
    `sy` - The start y coordiante of the path

Method Detail

### startHole

    public void startHole(float sx,
                          float sy)

  Start building a hole in the previously defined contour

  Parameters:
    `sx` - The start point of the hole
    `sy` - The start point of the hole

### lineTo

    public void lineTo(float x,
                       float y)

  Add a line to the contour or hole which ends at the specified location.

  Parameters:
    `x` - The x coordinate to draw the line to
    `y` - The y coordiante to draw the line to

### close

    public void close()

  Close the path to form a polygon

### curveTo

    public void curveTo(float x,
                        float y,
                        float cx1,
                        float cy1,
                        float cx2,
                        float cy2)

  Add a curve to the specified location (using the default segments 10)

  Parameters:
    `x` - The destination x coordinate
    `y` - The destination y coordiante
    `cx1` - The x coordiante of the first control point
    `cy1` - The y coordiante of the first control point
    `cx2` - The x coordinate of the second control point
    `cy2` - The y coordinate of the second control point

### curveTo

    public void curveTo(float x,
                        float y,
                        float cx1,
                        float cy1,
                        float cx2,
                        float cy2,
                        int segments)

  Add a curve to the specified location (specifing the number of segments)

  Parameters:
    `x` - The destination x coordinate
    `y` - The destination y coordiante
    `cx1` - The x coordiante of the first control point
    `cy1` - The y coordiante of the first control point
    `cx2` - The x coordinate of the second control point
    `cy2` - The y coordinate of the second control point
    `segments` - The number of segments to use for the new 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.