org.newdawn.slick.geom
Class Ellipse

java.lang.Object
  extended by org.newdawn.slick.geom.Shape
      extended by org.newdawn.slick.geom.Ellipse
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Circle

public class Ellipse
extends Shape

An ellipse meeting the Shape contract. The ellipse is actually an approximation using a series of points generated around the contour of the ellipse.

Author:
Mark
See Also:
Serialized Form

Field Summary
protected static int DEFAULT_SEGMENT_COUNT
          Default number of segments to draw this ellipse with
 
Fields inherited from class org.newdawn.slick.geom.Shape
boundingCircleRadius, center, maxX, maxY, minX, minY, points, pointsDirty, trianglesDirty, tris, x, y
 
Constructor Summary
Ellipse(float centerPointX, float centerPointY, float radius1, float radius2)
          Creates a new Ellipse object.
Ellipse(float centerPointX, float centerPointY, float radius1, float radius2, int segmentCount)
          Creates a new Ellipse object.
 
Method Summary
protected  void calculateRadius()
          Calculate the radius of a circle that can completely enclose this shape.
protected  void createPoints()
          Generate the points to outline this ellipse.
protected  void findCenter()
          Get the center of this polygon.
 float getRadius1()
          Get the horizontal radius of the ellipse
 float getRadius2()
          Get the vertical radius of the ellipse
 void setRadii(float radius1, float radius2)
          Change the shape of this Ellipse
 void setRadius1(float radius1)
          Set the horizontal radius of the ellipse
 void setRadius2(float radius2)
          Set the vertical radius of the ellipse
 Shape transform(Transform transform)
          Apply a transformation and return a new shape.
 
Methods inherited from class org.newdawn.slick.geom.Shape
calculateTriangles, checkPoints, closed, contains, contains, 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
 

Field Detail

DEFAULT_SEGMENT_COUNT

protected static final int DEFAULT_SEGMENT_COUNT
Default number of segments to draw this ellipse with

See Also:
Constant Field Values
Constructor Detail

Ellipse

public Ellipse(float centerPointX,
               float centerPointY,
               float radius1,
               float radius2)
Creates a new Ellipse object.

Parameters:
centerPointX - x coordinate of the center of the ellipse
centerPointY - y coordinate of the center of the ellipse
radius1 - horizontal radius
radius2 - vertical radius

Ellipse

public Ellipse(float centerPointX,
               float centerPointY,
               float radius1,
               float radius2,
               int segmentCount)
Creates a new Ellipse object.

Parameters:
centerPointX - x coordinate of the center of the ellipse
centerPointY - y coordinate of the center of the ellipse
radius1 - horizontal radius
radius2 - vertical radius
segmentCount - how fine to make the ellipse.
Method Detail

setRadii

public void setRadii(float radius1,
                     float radius2)
Change the shape of this Ellipse

Parameters:
radius1 - horizontal radius
radius2 - vertical radius

getRadius1

public float getRadius1()
Get the horizontal radius of the ellipse

Returns:
The horizontal radius of the ellipse

setRadius1

public void setRadius1(float radius1)
Set the horizontal radius of the ellipse

Parameters:
radius1 - The horizontal radius to set

getRadius2

public float getRadius2()
Get the vertical radius of the ellipse

Returns:
The vertical radius of the ellipse

setRadius2

public void setRadius2(float radius2)
Set the vertical radius of the ellipse

Parameters:
radius2 - The vertical radius to set

createPoints

protected void createPoints()
Generate the points to outline this ellipse.

Specified by:
createPoints in class Shape

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)

findCenter

protected void findCenter()
Description copied from class: Shape
Get the center of this polygon.

Overrides:
findCenter in class Shape
See Also:
Shape.findCenter()

calculateRadius

protected void calculateRadius()
Description copied from class: Shape
Calculate the radius of a circle that can completely enclose this shape.

Overrides:
calculateRadius in class Shape
See Also:
Shape.calculateRadius()


Copyright © 2006 New Dawn Software. All Rights Reserved.