math.geom2d.conic
Class Hyperbola2D
- java.lang.Object
-
- math.geom2d.curve.CurveArray2D<T>
-
- math.geom2d.domain.ContourArray2D<HyperbolaBranch2D>
-
- math.geom2d.conic.Hyperbola2D
-
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Iterable<HyperbolaBranch2D>, Conic2D, Curve2D, CurveSet2D<HyperbolaBranch2D>, Boundary2D, OrientedCurve2D, GeometricObject2D, Shape2D, ShapeSet2D<HyperbolaBranch2D>
public class Hyperbola2D extends ContourArray2D<HyperbolaBranch2D> implements Conic2D, java.lang.Cloneable
An Hyperbola, which is represented as a curve set of two boundary curves which are instances of HyperbolaBranch2D.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface math.geom2d.conic.Conic2D
Conic2D.Type
-
-
Constructor Summary
Constructors Constructor and Description 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 constructorHyperbola2D(Hyperbola2D hyp)Copy constructorHyperbola2D(Point2D center, double a, double b, double theta)Hyperbola2D(Point2D center, double a, double b, double theta, boolean d)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description booleanalmostEquals(GeometricObject2D obj, double eps)Checks if the two objects are similar up to a given threshold value.java.util.Collection<StraightLine2D>asymptotes()Returns the asymptotes of the hyperbola.Box2DboundingBox()Returns a bounding box with infinite bounds in every directionjava.util.Collection<HyperbolaBranch2D>branches()Hyperbola2Dclone()Deprecated.use copy constructor instead (0.11.2)double[]conicCoefficients()Returns the coefficient of the Cartesian representation of the conic.Conic2D.TypeconicType()booleancontains(double x, double y)Returns true if one of the curves contains the pointbooleancontains(Point2D point)Returns true if one of the curves contains the pointstatic Hyperbola2Dcreate(Point2D center, double a, double b, double theta)static Hyperbola2Dcreate(Point2D center, double a, double b, double theta, boolean d)voiddraw(java.awt.Graphics2D g)Throws an UnboundedShapeExceptiondoubleeccentricity()Returns the eccentricity of the conic.booleanequals(java.lang.Object obj)Tests whether this hyperbola equals another object.doublegetAngle()Returns the angle made by the first direction vector with the horizontal axis.Point2DgetCenter()Returns the center of the Hyperbola.Point2DgetFocus1()Returns the focus located on the positive side of the main hyperbola axis.Point2DgetFocus2()Returns the focus located on the negative side of the main hyperbola axis.doublegetLength1()Returns adoublegetLength2()Returns bVector2DgetVector1()Vector2DgetVector2()java.util.Collection<Point2D>intersections(LinearShape2D line)Returns the intersection points of the curve with the specified line.booleanisDirect()HyperbolaBranch2DnegativeBranch()HyperbolaBranch2DpositiveBranch()static Hyperbola2DreduceCentered(double[] coefs)Creates a new Hyperbola by reducing the conic coefficients, assuming conic type is Hyperbola, and hyperbola is centered.Hyperbola2Dreverse()Returns the curve with same trace on the plane with parameterization in reverse order.Point2DtoGlobal(Point2D point)Transforms a point in local coordinate (ie orthogonal centered hyberbola with a=b=1) to global coordinate system.Point2DtoLocal(Point2D point)Hyperbola2Dtransform(AffineTransform2D trans)Transforms this Hyperbola by an affine transform.static Hyperbola2DtransformCentered(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.ContourArray2D
clip, continuousCurves, create, domain, fill, isInside, signedDistance, signedDistance, subCurve, windingAngle
-
Methods inherited from class math.geom2d.curve.CurveArray2D
add, add, asAwtShape, childCurve, clear, contains, create, curveIndex, curves, distance, distance, firstCurve, firstPoint, get, getGeneralPath, getT0, getT1, globalPosition, indexOf, isBounded, isEmpty, isSingular, iterator, lastCurve, lastPoint, localPosition, point, position, project, remove, remove, singularPoints, size, t0, t1, vertices
-
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface math.geom2d.domain.Boundary2D
continuousCurves, domain, fill, isInside
-
Methods inherited from interface math.geom2d.domain.OrientedCurve2D
signedDistance, signedDistance, windingAngle
-
Methods inherited from interface math.geom2d.curve.Curve2D
asAwtShape, firstPoint, getT0, getT1, isSingular, lastPoint, point, position, project, singularPoints, subCurve, t0, t1, vertices
-
-
-
-
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(Hyperbola2D hyp)
Copy constructor- Parameters:
hyp- the hyperbola to copy
-
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 hyperbolatrans- an affine transform- Returns:
- the transformed hyperbola, centered around origin
-
toGlobal
public Point2D toGlobal(Point2D point)
Transforms a point in local coordinate (ie orthogonal centered hyberbola with a=b=1) to global coordinate system.
-
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.
-
positiveBranch
public HyperbolaBranch2D positiveBranch()
-
negativeBranch
public HyperbolaBranch2D negativeBranch()
-
branches
public java.util.Collection<HyperbolaBranch2D> branches()
-
asymptotes
public java.util.Collection<StraightLine2D> asymptotes()
Returns the asymptotes of the hyperbola.
-
conicCoefficients
public double[] conicCoefficients()
Description copied from interface:Conic2DReturns 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:
conicCoefficientsin interfaceConic2D
-
conicType
public Conic2D.Type conicType()
-
eccentricity
public double eccentricity()
Description copied from interface:Conic2DReturns the eccentricity of the conic.- Specified by:
eccentricityin interfaceConic2D
-
reverse
public Hyperbola2D reverse()
Description copied from interface:Curve2DReturns the curve with same trace on the plane with parameterization in reverse order.- Specified by:
reversein interfaceConic2D- Specified by:
reversein interfaceCurve2D- Specified by:
reversein interfaceBoundary2D- Specified by:
reversein interfaceOrientedCurve2D- Overrides:
reversein classContourArray2D<HyperbolaBranch2D>
-
intersections
public java.util.Collection<Point2D> intersections(LinearShape2D line)
Description copied from interface:Curve2DReturns the intersection points of the curve with the specified line. The length of the result array is the number of intersection points.- Specified by:
intersectionsin interfaceCurve2D- Overrides:
intersectionsin classCurveArray2D<HyperbolaBranch2D>
-
contains
public boolean contains(Point2D point)
Description copied from class:CurveArray2DReturns true if one of the curves contains the point- Specified by:
containsin interfaceShape2D- Overrides:
containsin classCurveArray2D<HyperbolaBranch2D>
-
contains
public boolean contains(double x, double y)Description copied from class:CurveArray2DReturns true if one of the curves contains the point- Specified by:
containsin interfaceShape2D- Overrides:
containsin classCurveArray2D<HyperbolaBranch2D>
-
transform
public Hyperbola2D transform(AffineTransform2D trans)
Transforms this Hyperbola by an affine transform.- Specified by:
transformin interfaceConic2D- Specified by:
transformin interfaceCurve2D- Specified by:
transformin interfaceCurveSet2D<HyperbolaBranch2D>- Specified by:
transformin interfaceBoundary2D- Specified by:
transformin interfaceOrientedCurve2D- Specified by:
transformin interfaceShape2D- Overrides:
transformin classContourArray2D<HyperbolaBranch2D>- Parameters:
trans- an affine transform- Returns:
- the transformed shape
-
boundingBox
public Box2D boundingBox()
Returns a bounding box with infinite bounds in every direction- Specified by:
boundingBoxin interfaceShape2D- Overrides:
boundingBoxin classCurveArray2D<HyperbolaBranch2D>- Returns:
- the bounding box of the shape.
-
draw
public void draw(java.awt.Graphics2D g)
Throws an UnboundedShapeException- Specified by:
drawin interfaceCurve2D- Specified by:
drawin interfaceShape2D- Overrides:
drawin classCurveArray2D<HyperbolaBranch2D>- Parameters:
g- the graphics to draw the curve in
-
almostEquals
public boolean almostEquals(GeometricObject2D obj, double eps)
Description copied from interface:GeometricObject2DChecks if the two objects are similar up to a given threshold value. This method can be used to compare the results of geometric computations, that introduce errors due to numerical computations.- Specified by:
almostEqualsin interfaceGeometricObject2D- Overrides:
almostEqualsin classCurveArray2D<HyperbolaBranch2D>- Parameters:
obj- the object to compareeps- a threshold value, for example the minimal coordinate difference- Returns:
- true if both object have the same value up to the threshold
-
equals
public boolean equals(java.lang.Object obj)
Tests whether this hyperbola equals another object.- Overrides:
equalsin classContourArray2D<HyperbolaBranch2D>
-
clone
@Deprecated public Hyperbola2D clone()
Deprecated. use copy constructor instead (0.11.2)- Specified by:
clonein interfaceCurve2D- Overrides:
clonein classCurveArray2D<HyperbolaBranch2D>
-
-
DMelt 3.0 © DataMelt by jWork.ORG