vec_math
Class Ellipse

java.lang.Object
  extended by vec_math.Ellipse

public class Ellipse
extends Object

A tilted ellipse. Tilts by non-zero angles supported.


Field Summary
private  double a
          Ellipse is defined by it central point, major axis and excentricity.
private  Point2D center
          Ellipse is defined by it central point, major axis and excentricity.
private  double e
          Ellipse is defined by it central point, major axis and excentricity.
private  double theta
          Ellipse is defined by it central point, major axis and excentricity.
 
Constructor Summary
Ellipse()
           
 
Method Summary
private  double getBearing(Point2D p)
          We return the angle from the center to the stated point in degrees.
 Point2D getCenter()
           
 double getCentralRadius(double nu)
          Returns the radius of this ellipse as a function of the non-tilted angle ny.
private  double getCentralRadiusSq(double nu)
          Returns the square radius of this conic section as a function of the non-tilted angle ny.
 double getExcentricity()
          Returns the numerical excentricity.
 double getFocalRadius(double ny)
          Returns the radius of this conic section as a function of the non-tilted angle ny.
 double getMajorAxis()
           
 double getPerimeterDistance(Point2D p)
          Returns the distance of this point from the ellipse in radial direction.
private  double getPerimeterDistanceSq(Point2D p)
          Returns the distance of this point from the ellipse in radial direction.
 Point2D getPerimeterPoint(double phi)
          Returns the point at the given polar angle, counted from the center of the ellipse and corrected for ellipse tilt.
 double getTilt()
          Returns the tilt angle in degs.
 boolean isInside(Point2D p)
          We return true, if this point is within the ellipse.
static Ellipse parseEllipse(String p)
          Parses the ellipse from a string.
 void setCenter(Point2D p)
          Sets the center of the ellipse.
 void setExcentricity(double eps)
          Sets the numerical excentricity.
 void setMajorAxis(double major)
          Sets the major axis.
 void setTilt(double t)
          Sets the tile angle in degs.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

center

private Point2D center
Ellipse is defined by it central point, major axis and excentricity.


a

private double a
Ellipse is defined by it central point, major axis and excentricity.


e

private double e
Ellipse is defined by it central point, major axis and excentricity.


theta

private double theta
Ellipse is defined by it central point, major axis and excentricity.

Constructor Detail

Ellipse

public Ellipse()
Method Detail

getFocalRadius

public double getFocalRadius(double ny)
Returns the radius of this conic section as a function of the non-tilted angle ny. Center is the focal point.


getCentralRadius

public double getCentralRadius(double nu)
Returns the radius of this ellipse as a function of the non-tilted angle ny. Center is the center of the ellipse.


getCentralRadiusSq

private double getCentralRadiusSq(double nu)
Returns the square radius of this conic section as a function of the non-tilted angle ny. Center is the center of the ellipse.


setTilt

public void setTilt(double t)
Sets the tile angle in degs.


getTilt

public double getTilt()
Returns the tilt angle in degs.


setCenter

public void setCenter(Point2D p)
Sets the center of the ellipse.


getCenter

public Point2D getCenter()

setMajorAxis

public void setMajorAxis(double major)
Sets the major axis.


getMajorAxis

public double getMajorAxis()

setExcentricity

public void setExcentricity(double eps)
Sets the numerical excentricity.


getExcentricity

public double getExcentricity()
Returns the numerical excentricity.


parseEllipse

public static Ellipse parseEllipse(String p)
                            throws ParseException
Parses the ellipse from a string. We follow the format of providing the center of the ellipse, followed by the major axis and the excentricity. The last item, if stated, is the tilt angle. All values are separated by commas, angles are in degrees.

Throws:
ParseException

isInside

public boolean isInside(Point2D p)
We return true, if this point is within the ellipse.


getBearing

private double getBearing(Point2D p)
We return the angle from the center to the stated point in degrees.


getPerimeterPoint

public Point2D getPerimeterPoint(double phi)
Returns the point at the given polar angle, counted from the center of the ellipse and corrected for ellipse tilt.


getPerimeterDistanceSq

private double getPerimeterDistanceSq(Point2D p)
Returns the distance of this point from the ellipse in radial direction. If the point is inside the ellipse, we return a negative value.


getPerimeterDistance

public double getPerimeterDistance(Point2D p)
Returns the distance of this point from the ellipse in radial direction. If the point is inside the ellipse, we return a negative value.


toString

public String toString()
Overrides:
toString in class Object