Ellipse

Kind of class:public class
Package:org.casalib.math.geom
Inherits from:none
Version:04/13/08
Author:Aaron Clinger, Mike Creighton
Classpath:org.casalib.math.geom.Ellipse
File last modified:Wednesday, 31 December 2008, 20:18:28
Stores position and size of an ellipse (circle or oval).

Summary


Constructor
  • Ellipse (x:Number, y:Number, width:Number, height:Number)
    • Creates new Ellipse object.
Instance properties
  • x : Number
    • The horizontal coordinate of the point.
  • y : Number
    • The vertical coordinate of the point.
  • width : Number
    • The width of the ellipse.
  • height : Number
    • The height of the rectangle.
  • center : Point
    • The center of the ellipse.
  • size : Point
    • The size of the ellipse, expressed as a Point object with the values of the width and height properties.
  • perimeter : Number
    • The circumference of the ellipse.
  • area : Number
    • The area of the ellipse.
Instance methods
  • getPointOfDegree (degree:Number) : Point
    • Finds the x, y position of the degree along the circumference of the ellipse.
  • containsPoint (point:Point) : Boolean
    • Finds if point is contained inside the ellipse perimeter.
  • equals (ellipse:Ellipse) : Boolean
    • Determines if the Ellipse specified in the ellipse parameter is equal to this Ellipse object.
  • clone : Ellipse

Constructor

Ellipse

public function Ellipse (
x:Number, y:Number, width:Number, height:Number)

Creates new Ellipse object.
Parameters:
x :
The horizontal position of the ellipse.
y :
The vertical position of the ellipse.
width :
Width of the ellipse at its widest horizontal point.
height:
Height of the ellipse at its tallest point.

Instance properties

area

public area:Number
(read)

The area of the ellipse.

center

public center:Point
(read,write)

The center of the ellipse.

height

public height:Number
(read,write)

The height of the rectangle.

perimeter

public perimeter:Number
(read)

The circumference of the ellipse.
Usage note:
  • Calculating the circumference of an ellipse is difficult; this is an approximation but should be fine for most cases.

size

public size:Point
(read)

The size of the ellipse, expressed as a Point object with the values of the width and height properties.

width

public width:Number
(read,write)

The width of the ellipse.

x

public x:Number
(read,write)

The horizontal coordinate of the point.

y

public y:Number
(read,write)

The vertical coordinate of the point.

Instance methods

clone

public function clone (

Returns:
  • A new Ellipse object with the same values as this Ellipse.

containsPoint

public function containsPoint (
point:Point) : Boolean

Finds if point is contained inside the ellipse perimeter.
Parameters:
point:
A Point object.
Returns:
  • Returns true if shape's area contains point; otherwise false.

equals

public function equals (
ellipse:Ellipse) : Boolean

Determines if the Ellipse specified in the ellipse parameter is equal to this Ellipse object.
Parameters:
ellipse:
An Ellipse object.
Returns:
  • Returns true if object is equal to this Ellipse; otherwise false.

getPointOfDegree

public function getPointOfDegree (
degree:Number) : Point

Finds the x, y position of the degree along the circumference of the ellipse.
Parameters:
degree:
Number representing a degree on the ellipse.
Returns:
  • A Point object.
Usage note:
  • degree can be over 360 or even negitive numbers; minding 0 = 360 = 720, 540 = 180, -90 = 270, etc.