PenProfile 2.x

com.livescribe.geom
Class Ellipse

java.lang.Object
  extended by com.livescribe.geom.Shape
      extended by com.livescribe.geom.Ellipse

public class Ellipse
extends Shape

This class describes an ellipse with the upper left and lower right points. The width and height are calculated as the difference between the X- and Y-coordinates, respectively. This is similar to a Rectangle.

Note that "upper left" refers to page coordinates and not mathematical coordinates. In other words, the "upper left" is considered to contain the minimum X- and Y-coordinate values.

It is assumed that the X- and Y-coordinates of the first point (coordinate zero) are ≤ the coordinates of the second point (coordinate one). Some, but not all, of the methods here enforce this. Be aware of this fact.


Field Summary
 
Fields inherited from class com.livescribe.geom.Shape
COORD_MAX, COORD_MIN, INTERSECT_CLIP, INTERSECT_EXTERNAL, INTERSECT_INTERNAL1, INTERSECT_INTERNAL2, SHAPE_COMPOSITE, SHAPE_ELLIPSE, SHAPE_LINESEGMENT, SHAPE_POINT, SHAPE_POLYGON, SHAPE_POLYLINE, SHAPE_RECTANGLE, SHAPE_STROKE, type, vertex
 
Constructor Summary
Ellipse()
          Creates a new ellipse having its top left point at (0,0) and a height and width of zero.
Ellipse(int[] v)
          Creates a new ellipse having the specified points.
Ellipse(int x, int y, int width, int height)
          Creates a new ellipse having the specified top left coordinate and size.
 
Method Summary
 int getHeight()
          Gets the height of this ellipse.
 int getWidth()
          Gets the width of this ellipse.
 int getX()
          Returns the X-coordinate of the top left corner.
 int getY()
          Returns the Y-coordinate of the top left corner.
 void setHeight(int height)
          Sets the ellipse height.
 void setWidth(int width)
          Sets the ellipse width.
 void setX(int x)
          Sets the X-coordinate of the top left corner.
 void setY(int y)
          Sets the Y-coordinate of the top left corner.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class com.livescribe.geom.Shape
contains, getBoundingBox, getNumberofVertices, getNumberOfVertices, getSize, getType, getUnion, getX, getXY, getY, intersectsWith, setVertexArray, setX, setXY, setXY, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ellipse

public Ellipse()
Creates a new ellipse having its top left point at (0,0) and a height and width of zero.


Ellipse

public Ellipse(int x,
               int y,
               int width,
               int height)
Creates a new ellipse having the specified top left coordinate and size.

Parameters:
x - the top left X-coordinate
y - the top left Y-coordinate
width - the width
height - the height
Throws:
IllegalArgumentException - if the width or height are negative.

Ellipse

public Ellipse(int[] v)
Creates a new ellipse having the specified points. The array should contain four elements, two (X,Y) pairs.

Parameters:
v - the vertex array
Method Detail

getX

public int getX()
Returns the X-coordinate of the top left corner.

Returns:
the X-coordinate of the top left corner.

getY

public int getY()
Returns the Y-coordinate of the top left corner.

Returns:
the Y-coordinate of the top left corner.

getWidth

public int getWidth()
Gets the width of this ellipse. This is the difference between the X-coordinates.

Returns:
the ellipse width.

getHeight

public int getHeight()
Gets the height of this ellipse. This is the difference between the Y-coordinates.

Returns:
the ellipse height.

setX

public void setX(int x)
Sets the X-coordinate of the top left corner.

Parameters:
x - the X-coordinate of the top left corner

setY

public void setY(int y)
Sets the Y-coordinate of the top left corner.

Parameters:
y - the Y-coordinate of the top left corner

setWidth

public void setWidth(int width)
Sets the ellipse width.

Parameters:
width - the new width
Throws:
IllegalArgumentException - if the width is negative.

setHeight

public void setHeight(int height)
Sets the ellipse height.

Parameters:
height - the new height
Throws:
IllegalArgumentException - if the height is negative.

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Shape
Returns:
a string representation of this object.

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.