Package pygeodesy :: Module ellipses :: Class Ellipse
[frames] | no frames]

Class Ellipse

  object --+        
           |        
named._Named --+    
               |    
named._NamedBase --+
                   |
                  Ellipse

Class to compute various attributes of a 2-D ellipse.

Instance Methods
 
__init__(self, a, b, **name)
New Ellipse with semi-axes a and b.
 
arc(self, deg2, deg1=0)
Compute the length of elliptic arc (deg2 - deg1), both counter-clockwise from semi-axis a to b of the ellipse.
 
arc_(self, rad2, rad1=0)
Compute the length of elliptic arc (rad2 - rad1), both counter-clockwise from semi-axis a to b of the ellipse.
 
hartzell4(self, x, y, los=False)
Compute the intersection of this ellipse with a Line-Of-Sight from Point-Of-View (x, y) outside this ellipse.
 
height4(self, x, y, **normal_eps)
Compute the projection on and distance to this ellipse from a point (x, y) in- or outside this ellipse.
 
normal3d(self, deg_x, y=None, **length)
Get a 3-D vector perpendicular to this ellipse from point (x, y) on this ellipse or at deg degrees along this ellipse.
 
normal4(self, deg_x, y=None, **height_normal)
Compute a point at height above or below this ellipse point (x, y) on this ellipse or at deg degrees along this ellipse.
 
point(self, deg_x, y=None)
Return the point on this ellipse at deg or atan2d(y, x) degrees along this ellipse.
 
points(self, np, nq=4, ccw=False, ended=False, eps=2.220446049250313e-16)
Yield up to np points along this ellipse, each a 2-tuple (x, y), starting at semi-axis +a, in (counter-)clockwise order and distributed evenly along the minor semi-axis.
 
polar2d(self, deg_x, y=None)
For a point at deg or atan2d(y, x) degrees along this ellipse, return 2-tuple (radius, angle) with the polar radius from the center (meter, conventionally) and angle in degrees.
 
Roc(self, deg_x, y=None, eps=None)
Compute the radius of curvature at a point deg or atan2d(y, x) degrees along this ellipse.
 
Roc_(self, rad_x, y=None, eps=None)
Compute the radius of curvature at a point rad or atan2(y, x) radians along this ellipse.
 
sideOf(self, x, y, eps=2.220446049250313e-16)
Return a positive, negative or 0 fraction if point (x, y) is outside, inside respectively on this ellipse.
 
slope(self, deg_x, y=None, eps=None)
Compute the tangent slope at a point deg or atan2d(y, x) degrees along this ellipse.
 
slope_(self, rad_x, y=None, eps=None)
Compute the tangent slope at a point rad or atan2(y, x) radians along this ellipse.
 
toEllipsoid(self, **Ellipsoid_and_kwds)
Return an Ellipsoid from this ellipse' a and b semi-axes.
 
toStr(self, prec=8, terse=2, **sep_name)
Return this ellipse as a text string.
 
toTriaxial_(self, c=2.220446049250313e-16, **Triaxial_and_kwds)
Return a Triaxial_ from this ellipse' semi-axes.

Inherited from named._NamedBase: __repr__, __str__, others, toRepr

Inherited from named._Named: __format__, __imatmul__, __matmul__, __rmatmul__, attrs, classof, copy, dup, methodname, rename, renamed, toStr2

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties
  a
Get semi-axis a of this ellipse (meter, conventionally).
  apses2
Get 2-tuple (apoapsis, periapsis) with the apo- and periapsis of this ellipse, both meter.
  area
Get the area of this ellipse (meter**2, conventionally).
  b
Get semi-axis b of this ellipse (meter, conventionally).
  c
Get the linear eccentricity c, unsigned (meter, conventionally).
  e
Get the eccentricity (scalar, 0 <= e <= 1).
  e2
Get the eccentricity squared (scalar, 0 <= e2 <= 1).
  foci
Get the linear eccentricity, signed (meter, conventionally), positive if this ellipse is oblate, negative if prolate or 0 if circular.
  isCircular
Is this ellipse circular? (bool)
  isFlat
Is this ellipse "flat", too pro-/oblate? (bool)
  isOblate
Is this ellipse oblate (foci on semi-axis a)? (bool)
  isProlate
Is this ellipse prolate (foci on semi-axis b)? (bool)
  lati
Get the semi-latus rectum, signed (meter, conventionally), positive if this ellipse is oblate or circular, 0 if "flat" and oblate, negative if prolate or NEG0 if "flat" and prolate.
  p
Get the semi-latus rectum p (aka 𝓁, script-small-l), unsigned (meter, conventionally).
  perimeterAGM
Compute the perimeter of this ellipse using the Arithmetic-Geometric Mean formula (meter, conventionally).
  perimeter4Arc3
Compute the perimeter (and arcs) of this ellipse using the 4-Arc (aka 4-Center) approximation as a 3-Tuple (P, Ra, Rb) with perimeter P, arc radii Ra and Rb at the respective semi-axes (all in meter, conventionally).
  perimeterCR
Compute the perimeter of this ellipse using Rackauckas' approximation, also here and here (meter, conventionally).
  perimeterGK
Compute the perimeter of this ellipse using the Gauss-Kummer series, b / a > 0.75 (meter, conventionally).
  perimeterHGK
Compute the perimeter of this ellipse using the Hypergeometric Gauss-Kummer series (meter, conventionally).
  perimeter2k
Compute the perimeter of this ellipse using the complete integral of the 2nd kind, Elliptic.cE (meter, conventionally).
  perimeter2k_
Compute the perimeter of this ellipse using SciPy's ellipe function if available, otherwise use property perimeter2k (meter, conventionally).
  perimeter2R
Compute the perimeter of this ellipse using Ramanujan's 2nd approximation, b / a > 0.9 (meter, conventionally).
  perimeter2RC
Compute the perimeter of this ellipse using Cantrell Ramanujan's 2nd approximation, b / a > 0.9 (meter, conventionally).
  R1
Get this ellipse' arithmetic mean radius, (2 * a + b) / 3 (meter, conventionally).
  R2
Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).
  Rgeometric
Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).
  Rauthalic
Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).
  Rrectifying
Get this ellipse' rectifying radius, perimeter2k_ / PI2 (meter, conventionally).

Inherited from named._Named: classname, classnaming, iteration, name, named, named2, named3, named4, sizeof, typename

Inherited from object: __class__

Method Details

__init__ (self, a, b, **name)
(Constructor)

 

New Ellipse with semi-axes a and b.

The ellipse is oblate if a > b, prolate if a < b, circular if a == b and "flat" if min(a, b) <<< max(a, b).

Arguments:
  • a - X semi-axis length (meter, conventionally).
  • b - Y semi-axis length (meter, conventionally).
Raises:
  • ValueError - Invalid a or b.
Overrides: object.__init__

See Also: Ellipse.

arc (self, deg2, deg1=0)

 

Compute the length of elliptic arc (deg2 - deg1), both counter-clockwise from semi-axis a to b of the ellipse.

Arguments:
  • deg2 - End angle of the elliptic arc (degrees).
  • deg1 - Start angle of the elliptic arc (degrees).
Returns:
Arc length, signed (meter, conventionally).

arc_ (self, rad2, rad1=0)

 

Compute the length of elliptic arc (rad2 - rad1), both counter-clockwise from semi-axis a to b of the ellipse.

Arguments:
  • rad2 - End angle of the elliptic arc (radians).
  • rad1 - Start angle of the elliptic arc (radians).
Returns:
Arc length, signed (meter, conventionally).

hartzell4 (self, x, y, los=False)

 

Compute the intersection of this ellipse with a Line-Of-Sight from Point-Of-View (x, y) outside this ellipse.

Arguments:
  • los - Line-Of-Sight, direction to the ellipse (Los, Vector3d, Vector2Tuple or 2-tuple (dx, dy)) or True for the normal, perpendicular, plumb to this ellipse or False or None to point to its center.
Returns:
Vector4Tuple(x, y, z, h) with coordinates x, y and z=0 of the intersection and h the distance to "Point-Of-View" (x, y) along the los, all in meter, conventionally.
Raises:
  • EllipseError - Invalid x, y or los or los points outside or away from this ellipse.

See Also: Function hartzell4 for further details.

height4 (self, x, y, **normal_eps)

 

Compute the projection on and distance to this ellipse from a point (x, y) in- or outside this ellipse.

Arguments:
  • normal_eps - With default normal=True the projection is perpendicular, plumb to this ellipse, otherwise radially to its center (bool). Tolerance eps=EPS for root finding and validation (scalar), use a negative value to skip validation.
Returns:
Vector4Tuple(x, y, z, h) with coordinates x, y and z=0 of the projection on or the intersection with the ellipse and h the signed, normal distance to the ellipse in meter, conventionally. Positive h indicates, x and/or y are outside the ellipse, negative h means inside.
Raises:
  • EllipseError - Invalid x, y or eps, no convergence in root finding or validation failed.

See Also: Methods Ellipse.normal3d, Ellipse.normal4 and function height4.

normal3d (self, deg_x, y=None, **length)

 

Get a 3-D vector perpendicular to this ellipse from point (x, y) on this ellipse or at deg degrees along this ellipse.

Arguments:
  • length - Optional, signed length=1 in out-/inward direction (scalar).
Returns:
A Vector3d(x_, y_, z_=0) normalized to length, pointing out- or inward for postive respectively negative length.
Raises:

See Also: Methods Ellipse.height4, Ellipse.normal4, Ellipse.sideOf and Triaxial_.normal3d.

normal4 (self, deg_x, y=None, **height_normal)

 

Compute a point at height above or below this ellipse point (x, y) on this ellipse or at deg degrees along this ellipse.

Arguments:
  • height_normal - The desired distance height=0 in- or outside this ellipse (meter, conventionally) and normal=True, If normal=True, the height is perpendicular, plumb to this ellipse, otherwise radially to its center (bool).
Returns:
Vector4Tuple(x, y, z, h) with coordinates x, y and z=0 and h the signed, normal distance to the ellipse in meter, conventionally. Positive h indicates, x and/or y are outside the ellipse, negative h means inside.
Raises:

See Also: Methods Ellipse.height4, Ellipse.normal3d, Ellipse.sideOf and Triaxial_.normal4.

point (self, deg_x, y=None)

 

Return the point on this ellipse at deg or atan2d(y, x) degrees along this ellipse.

Returns:
A 2-tuple (x, y).

points (self, np, nq=4, ccw=False, ended=False, eps=2.220446049250313e-16)

 

Yield up to np points along this ellipse, each a 2-tuple (x, y), starting at semi-axis +a, in (counter-)clockwise order and distributed evenly along the minor semi-axis.

Arguments:
  • np - Number of points to generate (int).
  • nq - Number of quarters to cover (int, 1..4).
  • ccw - Use ccw=True for counter-clockwise order (bool).
  • ended - If True, include the last quadrant's end point (bool).
  • eps - Tolerance for duplicate points (meter, conventionally).

See Also: Directrix.

Roc (self, deg_x, y=None, eps=None)

 

Compute the radius of curvature at a point deg or atan2d(y, x) degrees along this ellipse.

See Also: Method Roc_ for ruther details.

Roc_ (self, rad_x, y=None, eps=None)

 

Compute the radius of curvature at a point rad or atan2(y, x) radians along this ellipse.

Arguments:
  • eps - See method sideOf, use eps=0 to permit any points.
Returns:
Curvature (meter, conventionally).
Raises:
  • ValueError - Point (x, y) off this ellipse, unless eps=0.

slope (self, deg_x, y=None, eps=None)

 

Compute the tangent slope at a point deg or atan2d(y, x) degrees along this ellipse.

Returns:
Slope (degrees), negative for 0 <= deg < 90.

See Also: Method slope_ for further details.

slope_ (self, rad_x, y=None, eps=None)

 

Compute the tangent slope at a point rad or atan2(y, x) radians along this ellipse.

Arguments:
  • eps - See method sideOf, use eps=0 to permit any points.
Returns:
Slope (radians), negative for 0 <= rad < PI/2.
Raises:
  • ValueError - (x, y) off this ellipse, unless eps=0.

toEllipsoid (self, **Ellipsoid_and_kwds)

 

Return an Ellipsoid from this ellipse' a and b semi-axes.

Arguments:
  • Ellipsoid_and_kwds - Optional Ellipsoid=Ellipsoid class and additional Ellipsoid keyword arguments.

toStr (self, prec=8, terse=2, **sep_name)

 

Return this ellipse as a text string.

Arguments:
  • prec - Number of decimal digits, unstripped (int).
  • terse - Limit the number of items (int, 0...9), use terse=0 or =None for all.
  • sep_name - Optional name=NN (str) or None to exclude this ellipse' name and separator sep=", " to join the items (str).
Returns:
This Ellipse' attributes (str).
Overrides: named._Named.toStr

toTriaxial_ (self, c=2.220446049250313e-16, **Triaxial_and_kwds)

 

Return a Triaxial_ from this ellipse' semi-axes.

Arguments:
  • c - Near-zero, minor semi-axis (meter, conventionally).
  • Triaxial_and_kwds - Optional Triaxial=Triaxial_ class and additional Triaxial keyword arguments.

Property Details

a

Get semi-axis a of this ellipse (meter, conventionally).

Get method:
a(self) - Get semi-axis a of this ellipse (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

apses2

Get 2-tuple (apoapsis, periapsis) with the apo- and periapsis of this ellipse, both meter.

Get method:
apses2(self) - Get 2-tuple (apoapsis, periapsis) with the apo- and periapsis of this ellipse, both meter.
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

area

Get the area of this ellipse (meter**2, conventionally).

Get method:
area(self) - Get the area of this ellipse (meter**2, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

b

Get semi-axis b of this ellipse (meter, conventionally).

Get method:
b(self) - Get semi-axis b of this ellipse (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

c

Get the linear eccentricity c, unsigned (meter, conventionally).

Get method:
c(self) - Get the linear eccentricity c, unsigned (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

e

Get the eccentricity (scalar, 0 <= e <= 1).

Get method:
e(self) - Get the eccentricity (scalar, 0 <= e <= 1).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

e2

Get the eccentricity squared (scalar, 0 <= e2 <= 1).

Get method:
e2(self) - Get the eccentricity squared (scalar, 0 <= e2 <= 1).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

foci

Get the linear eccentricity, signed (meter, conventionally), positive if this ellipse is oblate, negative if prolate or 0 if circular. See also property Ellipse.c.

Get method:
foci(self) - Get the linear eccentricity, signed (meter, conventionally), positive if this ellipse is oblate, negative if prolate or 0 if circular.
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

isCircular

Is this ellipse circular? (bool)

Get method:
isCircular(self) - Is this ellipse circular? (bool)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

isFlat

Is this ellipse "flat", too pro-/oblate? (bool)

Get method:
isFlat(self) - Is this ellipse "flat", too pro-/oblate? (bool)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

isOblate

Is this ellipse oblate (foci on semi-axis a)? (bool)

Get method:
isOblate(self) - Is this ellipse oblate (foci on semi-axis a)? (bool)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

isProlate

Is this ellipse prolate (foci on semi-axis b)? (bool)

Get method:
isProlate(self) - Is this ellipse prolate (foci on semi-axis b)? (bool)
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

lati

Get the semi-latus rectum, signed (meter, conventionally), positive if this ellipse is oblate or circular, 0 if "flat" and oblate, negative if prolate or NEG0 if "flat" and prolate. See also property Ellipse.p.

Get method:
lati(self) - Get the semi-latus rectum, signed (meter, conventionally), positive if this ellipse is oblate or circular, 0 if "flat" and oblate, negative if prolate or NEG0 if "flat" and prolate.
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

p

Get the semi-latus rectum p (aka 𝓁, script-small-l), unsigned (meter, conventionally).

Get method:
p(self) - Get the semi-latus rectum p (aka 𝓁, script-small-l), unsigned (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeterAGM

Compute the perimeter of this ellipse using the Arithmetic-Geometric Mean formula (meter, conventionally).

Get method:
perimeterAGM(self) - Compute the perimeter of this ellipse using the Arithmetic-Geometric Mean formula (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeter4Arc3

Compute the perimeter (and arcs) of this ellipse using the 4-Arc (aka 4-Center) approximation as a 3-Tuple (P, Ra, Rb) with perimeter P, arc radii Ra and Rb at the respective semi-axes (all in meter, conventionally).

Get method:
perimeter4Arc3(self) - Compute the perimeter (and arcs) of this ellipse using the 4-Arc (aka 4-Center) approximation as a 3-Tuple (P, Ra, Rb) with perimeter P, arc radii Ra and Rb at the respective semi-axes (all in meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeterCR

Compute the perimeter of this ellipse using Rackauckas' approximation, also here and here (meter, conventionally).

Get method:
perimeterCR(self) - Compute the perimeter of this ellipse using Rackauckas' approximation, also here and here (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeterGK

Compute the perimeter of this ellipse using the Gauss-Kummer series, b / a > 0.75 (meter, conventionally).

Get method:
perimeterGK(self) - Compute the perimeter of this ellipse using the Gauss-Kummer series, b / a > 0.75 (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeterHGK

Compute the perimeter of this ellipse using the Hypergeometric Gauss-Kummer series (meter, conventionally).

Get method:
perimeterHGK(self) - Compute the perimeter of this ellipse using the Hypergeometric Gauss-Kummer series (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeter2k

Compute the perimeter of this ellipse using the complete integral of the 2nd kind, Elliptic.cE (meter, conventionally).

Get method:
perimeter2k(self) - Compute the perimeter of this ellipse using the complete integral of the 2nd kind, Elliptic.cE (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeter2k_

Compute the perimeter of this ellipse using SciPy's ellipe function if available, otherwise use property perimeter2k (meter, conventionally).

Get method:
perimeter2k_(self) - Compute the perimeter of this ellipse using SciPy's ellipe function if available, otherwise use property perimeter2k (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeter2R

Compute the perimeter of this ellipse using Ramanujan's 2nd approximation, b / a > 0.9 (meter, conventionally).

Get method:
perimeter2R(self) - Compute the perimeter of this ellipse using Ramanujan's 2nd approximation, b / a > 0.9 (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

perimeter2RC

Compute the perimeter of this ellipse using Cantrell Ramanujan's 2nd approximation, b / a > 0.9 (meter, conventionally).

Get method:
perimeter2RC(self) - Compute the perimeter of this ellipse using Cantrell Ramanujan's 2nd approximation, b / a > 0.9 (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

R1

Get this ellipse' arithmetic mean radius, (2 * a + b) / 3 (meter, conventionally).

Get method:
R1(self) - Get this ellipse' arithmetic mean radius, (2 * a + b) / 3 (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

R2

Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).

Get method:
R2(self) - Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

Rgeometric

Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).

Get method:
R2(self) - Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

Rauthalic

Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).

Get method:
R2(self) - Get this ellipse' authalic radius, sqrt(a * b) (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.

Rrectifying

Get this ellipse' rectifying radius, perimeter2k_ / PI2 (meter, conventionally).

Get method:
Rrectifying(self) - Get this ellipse' rectifying radius, perimeter2k_ / PI2 (meter, conventionally).
Set method:
_fset_error(inst, val) - Throws an AttributeError, always.
Delete Method:
_fdel(inst) - Zap the cached/memoized property value.