math.geom2d.conic
Class Hyperbola2D

Package class diagram package Hyperbola2D
java.lang.Object
  extended by math.geom2d.curve.CurveSet2D<T>
      extended by math.geom2d.curve.CurveArray2D<T>
          extended by math.geom2d.domain.BoundarySet2D<HyperbolaBranch2D>
              extended by math.geom2d.conic.Hyperbola2D
All Implemented Interfaces:
Serializable, Cloneable, Iterable<HyperbolaBranch2D>, Conic2D, Curve2D, Boundary2D, OrientedCurve2D, Shape2D

public class Hyperbola2D
extends BoundarySet2D<HyperbolaBranch2D>
implements Conic2D, Cloneable

An Hyperbola, which is represented as a curve set of two boundary curves which are instances of HyperbolaBranch2D.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface math.geom2d.conic.Conic2D
Conic2D.Type
 
Field Summary
protected  double a
          first focal parameter
protected  double b
          second focal parameter
protected  HyperbolaBranch2D branch1
          The negative branch of the hyperbola
protected  HyperbolaBranch2D branch2
          The positive branch of the hyperbola
protected  boolean direct
          a flag indicating whether the hyperbola is direct or not
protected  double theta
          angle of rotation of the hyperbola
protected  double xc
          Center of the hyperbola
protected  double yc
           
 
Fields inherited from class math.geom2d.curve.CurveSet2D
curves
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
Hyperbola2D()
          Assume centered hyperbola, with a = b = 1 (orthogonal hyperbola), theta=0 (hyperbola is oriented East-West), and direct orientation.
Hyperbola2D(double xc, double yc, double a, double b, double theta)
           
Hyperbola2D(double xc, double yc, double a, double b, double theta, boolean d)
          Main constructor
Hyperbola2D(Point2D center, double a, double b, double theta)
           
Hyperbola2D(Point2D center, double a, double b, double theta, boolean d)
           
 
Method Summary
 Hyperbola2D clone()
          Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.
 boolean contains(double x, double y)
          Returns true if one of the curves contains the point
 boolean contains(Point2D point)
          Returns true if one of the curves contains the point
static Hyperbola2D create(Point2D center, double a, double b, double theta)
           
static Hyperbola2D create(Point2D center, double a, double b, double theta, boolean d)
           
 void draw(Graphics2D g)
          Throws an UnboundedShapeException
 boolean equals(Object obj)
          Tests whether this hyperbola equals another object.
 double getAngle()
          Returns the angle made by the first direction vector with the horizontal axis.
 Collection<StraightLine2D> getAsymptotes()
          Returns the asymptotes of the hyperbola.
 Collection<HyperbolaBranch2D> getBranches()
           
 Point2D getCenter()
          Returns the center of the Hyperbola.
 double[] getConicCoefficients()
          Returns the coefficient of the Cartesian representation of the conic.
 Conic2D.Type getConicType()
           
 double getEccentricity()
          Returns the eccentricity of the conic.
 Point2D getFocus1()
          Returns the focus located on the positive side of the main hyperbola axis.
 Point2D getFocus2()
          Returns the focus located on the negative side of the main hyperbola axis.
 Collection<Point2D> getIntersections(LinearShape2D line)
          Returns the intersection points of the curve with the specified line.
 double getLength1()
          Returns a
 double getLength2()
          Returns b
 HyperbolaBranch2D getNegativeBranch()
           
 HyperbolaBranch2D getPositiveBranch()
           
 Hyperbola2D getReverseCurve()
          Returns the curve with same trace on the plane with parametrization in reverse order.
 Vector2D getVector1()
           
 Vector2D getVector2()
           
 boolean isDirect()
           
static Hyperbola2D reduceCentered(double[] coefs)
          Creates a new Hyperbola by reducing the conic coefficients, assuming conic type is Hyperbola, and hyperbola is centered.
 Point2D toGlobal(Point2D point)
          transform a point in local coordinate (ie orthogonal centered hyberbola with a=b=1) to global coordinate system.
 Point2D toLocal(Point2D point)
           
 Hyperbola2D transform(AffineTransform2D trans)
          Transforms this Hyperbola by an affine transform.
static Hyperbola2D transformCentered(Hyperbola2D hyper, AffineTransform2D trans)
          Transforms an hyperbola, by supposing both the hyperbola is centered and the transform has no translation part.
 
Methods inherited from class math.geom2d.domain.BoundarySet2D
clip, create, create, fill, getBoundaryCurves, getDomain, getSignedDistance, getSignedDistance, getSubCurve, getWindingAngle, isInside
 
Methods inherited from class math.geom2d.curve.CurveArray2D
addCurve, clearCurves, containsCurve, getAsAWTShape, getBoundingBox, getChildCurve, getContinuousCurves, getCurve, getCurveIndex, getCurveNumber, getCurves, getDistance, getDistance, getFirstCurve, getFirstPoint, getGeneralPath, getGlobalPosition, getLastCurve, getLastPoint, getLocalPosition, getPoint, getPosition, getSingularPoints, getT0, getT1, isBounded, isEmpty, isSingular, iterator, project, removeCurve
 
Methods inherited from class math.geom2d.curve.CurveSet2D
fromUnitSegment, toUnitSegment
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.conic.Conic2D
clip
 
Methods inherited from interface math.geom2d.domain.Boundary2D
fill, getBoundaryCurves, getDomain, isInside
 
Methods inherited from interface math.geom2d.domain.OrientedCurve2D
getSignedDistance, getSignedDistance, getWindingAngle
 
Methods inherited from interface math.geom2d.curve.Curve2D
getAsAWTShape, getContinuousCurves, getFirstPoint, getLastPoint, getPoint, getPosition, getSingularPoints, getSubCurve, getT0, getT1, isSingular, project
 
Methods inherited from interface math.geom2d.Shape2D
getBoundingBox, getDistance, getDistance, isBounded, isEmpty
 

Field Detail

xc

protected double xc
Center of the hyperbola


yc

protected double yc

a

protected double a
first focal parameter


b

protected double b
second focal parameter


theta

protected double theta
angle of rotation of the hyperbola


direct

protected boolean direct
a flag indicating whether the hyperbola is direct or not


branch1

protected HyperbolaBranch2D branch1
The negative branch of the hyperbola


branch2

protected HyperbolaBranch2D branch2
The positive branch of the hyperbola

Constructor Detail

Hyperbola2D

public Hyperbola2D()
Assume centered hyperbola, with a = b = 1 (orthogonal hyperbola), theta=0 (hyperbola is oriented East-West), and direct orientation.


Hyperbola2D

public Hyperbola2D(Point2D center,
                   double a,
                   double b,
                   double theta)

Hyperbola2D

public Hyperbola2D(Point2D center,
                   double a,
                   double b,
                   double theta,
                   boolean d)

Hyperbola2D

public Hyperbola2D(double xc,
                   double yc,
                   double a,
                   double b,
                   double theta)

Hyperbola2D

public Hyperbola2D(double xc,
                   double yc,
                   double a,
                   double b,
                   double theta,
                   boolean d)
Main constructor

Method Detail

create

public static Hyperbola2D create(Point2D center,
                                 double a,
                                 double b,
                                 double theta)

create

public static Hyperbola2D create(Point2D center,
                                 double a,
                                 double b,
                                 double theta,
                                 boolean d)

reduceCentered

public static Hyperbola2D reduceCentered(double[] coefs)
Creates a new Hyperbola by reducing the conic coefficients, assuming conic type is Hyperbola, and hyperbola is centered.

Parameters:
coefs - an array of double with at least 3 coefficients containing coefficients for x^2, xy, and y^2 factors. If the array is longer, remaining coefficients are ignored.
Returns:
the Hyperbola2D corresponding to given coefficients

transformCentered

public static Hyperbola2D transformCentered(Hyperbola2D hyper,
                                            AffineTransform2D trans)
Transforms an hyperbola, by supposing both the hyperbola is centered and the transform has no translation part.

Parameters:
hyper - an hyperbola
trans - an affine transform
Returns:
the transformed hyperbola, centered around origin

toGlobal

public Point2D toGlobal(Point2D point)
transform a point in local coordinate (ie orthogonal centered hyberbola with a=b=1) to global coordinate system.


toLocal

public Point2D toLocal(Point2D point)

getCenter

public Point2D getCenter()
Returns the center of the Hyperbola. This point does not belong to the Hyperbola.

Returns:
the center point of the Hyperbola.

getAngle

public double getAngle()
Returns the angle made by the first direction vector with the horizontal axis.


getLength1

public double getLength1()
Returns a


getLength2

public double getLength2()
Returns b


isDirect

public boolean isDirect()

getVector1

public Vector2D getVector1()

getVector2

public Vector2D getVector2()

getFocus1

public Point2D getFocus1()
Returns the focus located on the positive side of the main hyperbola axis.


getFocus2

public Point2D getFocus2()
Returns the focus located on the negative side of the main hyperbola axis.


getPositiveBranch

public HyperbolaBranch2D getPositiveBranch()

getNegativeBranch

public HyperbolaBranch2D getNegativeBranch()

getBranches

public Collection<HyperbolaBranch2D> getBranches()

getAsymptotes

public Collection<StraightLine2D> getAsymptotes()
Returns the asymptotes of the hyperbola.


getConicCoefficients

public double[] getConicCoefficients()
Description copied from interface: Conic2D
Returns the coefficient of the Cartesian representation of the conic. Cartesian equation has the form :

a*x^2 + b*x*y + c*y^2 + d*x + e*y + f

The length of the array is then of size 6.

Specified by:
getConicCoefficients in interface Conic2D

getConicType

public Conic2D.Type getConicType()
Specified by:
getConicType in interface Conic2D

getEccentricity

public double getEccentricity()
Description copied from interface: Conic2D
Returns the eccentricity of the conic.

Specified by:
getEccentricity in interface Conic2D

getReverseCurve

public Hyperbola2D getReverseCurve()
Description copied from interface: Curve2D
Returns the curve with same trace on the plane with parametrization in reverse order.

Specified by:
getReverseCurve in interface Conic2D
Specified by:
getReverseCurve in interface Curve2D
Specified by:
getReverseCurve in interface Boundary2D
Specified by:
getReverseCurve in interface OrientedCurve2D
Overrides:
getReverseCurve in class BoundarySet2D<HyperbolaBranch2D>

getIntersections

public Collection<Point2D> getIntersections(LinearShape2D line)
Description copied from interface: Curve2D
Returns the intersection points of the curve with the specified line. The length of the result array is the number of intersection points.

Specified by:
getIntersections in interface Curve2D
Overrides:
getIntersections in class CurveArray2D<HyperbolaBranch2D>

contains

public boolean contains(Point2D point)
Description copied from class: CurveArray2D
Returns true if one of the curves contains the point

Specified by:
contains in interface Shape2D
Overrides:
contains in class CurveArray2D<HyperbolaBranch2D>

contains

public boolean contains(double x,
                        double y)
Description copied from class: CurveArray2D
Returns true if one of the curves contains the point

Specified by:
contains in interface Shape2D
Overrides:
contains in class CurveArray2D<HyperbolaBranch2D>

transform

public Hyperbola2D transform(AffineTransform2D trans)
Transforms this Hyperbola by an affine transform.

Specified by:
transform in interface Conic2D
Specified by:
transform in interface Curve2D
Specified by:
transform in interface Boundary2D
Specified by:
transform in interface OrientedCurve2D
Specified by:
transform in interface Shape2D
Overrides:
transform in class BoundarySet2D<HyperbolaBranch2D>
Parameters:
trans - an affine transform
Returns:
the transformed shape

draw

public void draw(Graphics2D g)
Throws an UnboundedShapeException

Specified by:
draw in interface Curve2D
Specified by:
draw in interface Shape2D
Overrides:
draw in class CurveArray2D<HyperbolaBranch2D>
Parameters:
g - the graphics to draw the curve

equals

public boolean equals(Object obj)
Tests whether this hyperbola equals another object.

Overrides:
equals in class CurveArray2D<HyperbolaBranch2D>

clone

public Hyperbola2D clone()
Description copied from interface: Curve2D
Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.

Specified by:
clone in interface Curve2D
Overrides:
clone in class CurveArray2D<HyperbolaBranch2D>
Returns:
the cloned curve


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.