org.apache.lucene.spatial.geometry.shape
Class Ellipse

java.lang.Object
  extended by org.apache.lucene.spatial.geometry.shape.Ellipse
All Implemented Interfaces:
Geometry2D

public class Ellipse
extends Object
implements Geometry2D

Ellipse shape. From C++ gl.

NOTE: This API is still in flux and might change in incompatible ways in the next release.


Constructor Summary
Ellipse()
           
Ellipse(Point2D p1, Point2D p2, double angle)
          Constructor given bounding rectangle and a rotation.
 
Method Summary
 double area()
          Return the area
 Point2D centroid()
          Return the centroid
 boolean contains(Point2D pt)
          Does the shape contain the given point
 int intersect(LineSegment seg, Point2D pt0, Point2D pt1)
          Determines if a line segment intersects the ellipse and if so finds the point(s) of intersection.
 IntersectCase intersect(Rectangle r)
          Returns information about how this shape intersects the given rectangle
 void translate(Vector2D v)
          Translate according to the vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ellipse

public Ellipse()

Ellipse

public Ellipse(Point2D p1,
               Point2D p2,
               double angle)
Constructor given bounding rectangle and a rotation.

Method Detail

intersect

public int intersect(LineSegment seg,
                     Point2D pt0,
                     Point2D pt1)
Determines if a line segment intersects the ellipse and if so finds the point(s) of intersection.

Parameters:
seg - Line segment to test for intersection
pt0 - OUT - intersection point (if it exists)
pt1 - OUT - second intersection point (if it exists)
Returns:
Returns the number of intersection points (0, 1, or 2).

intersect

public IntersectCase intersect(Rectangle r)
Description copied from interface: Geometry2D
Returns information about how this shape intersects the given rectangle

Specified by:
intersect in interface Geometry2D

area

public double area()
Description copied from interface: Geometry2D
Return the area

Specified by:
area in interface Geometry2D

centroid

public Point2D centroid()
Description copied from interface: Geometry2D
Return the centroid

Specified by:
centroid in interface Geometry2D

contains

public boolean contains(Point2D pt)
Description copied from interface: Geometry2D
Does the shape contain the given point

Specified by:
contains in interface Geometry2D

translate

public void translate(Vector2D v)
Description copied from interface: Geometry2D
Translate according to the vector

Specified by:
translate in interface Geometry2D


Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.