ianmackenzie/elm-geometry/3.3.0

NOTE: the latest version is 4.0.0

Ellipse2d

An ellipse is defined by a center point, X and Y radius, and X and Y axes (which will always be perpendicular to each other). Ellipses are symmetric about their X and Y axes. This module includes functionality for

  • Constructing ellipses
  • Scaling, rotating and translating ellipses
  • Converting ellipses between different coordinate systems
type alias Ellipse2d units coordinates =
Ellipse2d units coordinates

Constructors

{ centerPoint : Point2d units coordinates
, xDirection : Direction2d coordinates
, xRadius : Quantity Float units
, yRadius : Quantity Float units
}
-> Ellipse2d units coordinates

Construct an ellipse from its center point, X direction, and X and Y radii. If you pass a negative radius, the absolute value will be used.

exampleEllipse =
    Ellipse2d.with
        { centerPoint = Point2d.meters 10 10
        , xDirection = Direction2d.degrees 30
        , xRadius = Length.meters 5
        , yRadius = Length.meters 3
        }

Properties

centerPoint : Ellipse2d units coordinates -> Point2d units coordinates

Get the center point of an ellipse.

axes : Ellipse2d units coordinates -> Frame2d units coordinates defines

Get the X and Y axes of an ellipse as a Frame2d.

Ellipse2d.axes exampleEllipse
--> Frame2d.withXDirection (Direction2d.degrees 30)
-->     (Point2d.meters 10 10)
xAxis : Ellipse2d units coordinates -> Axis2d units coordinates

Get the X axis of an ellipse.

yAxis : Ellipse2d units coordinates -> Axis2d units coordinates

Get the Y axis of an ellipse.

xDirection : Ellipse2d units coordinates -> Direction2d coordinates

Get the direction of the ellipse's X axis.

yDirection : Ellipse2d units coordinates -> Direction2d coordinates

Get the direction of an ellipse's Y axis.

xRadius : Ellipse2d units coordinates -> Quantity Float units

Get the radius of an ellipse along its X axis. This may be either the minimum or maximum radius.

Ellipse2d.xRadius exampleEllipse
--> Length.meters 5
yRadius : Ellipse2d units coordinates -> Quantity Float units

Get the radius of an ellipse along its Y axis. This may be either the minimum or maximum radius.

Ellipse2d.yRadius exampleEllipse
--> Length.meters 3
area : Ellipse2d units coordinates -> Quantity Float (Squared units)

Get the area of an ellipse.

Ellipse2d.area exampleEllipse
--> Area.squareMeters 47.1239

Conversion

toEllipticalArc : Ellipse2d units coordinates -> EllipticalArc2d units coordinates

Convert an ellipse to a 360 degree elliptical arc.

Transformations

These transformations generally behave just like the ones in the Point2d module.

Point2d units coordinates
-> Float
-> Ellipse2d units coordinates
-> Ellipse2d units coordinates

Scale an ellipse about a given point by a given scale.

Point2d units coordinates
-> Angle
-> Ellipse2d units coordinates
-> Ellipse2d units coordinates

Rotate an ellipse around a given point by a given angle.

Vector2d units coordinates
-> Ellipse2d units coordinates
-> Ellipse2d units coordinates

Translate an ellipse by a given displacement.

Direction2d coordinates
-> Quantity Float units
-> Ellipse2d units coordinates
-> Ellipse2d units coordinates

Translate an ellipse in a given direction by a given distance.

Axis2d units coordinates
-> Ellipse2d units coordinates
-> Ellipse2d units coordinates

Mirror an ellipse across a given axis. Note that if the axes of the original ellipse form a right-handed frame, then the axes of the mirrored ellipse will form a left-handed frame (and vice versa).

Unit conversions

at :
Quantity Float (Rate units2 units1)
-> Ellipse2d units1 coordinates
-> Ellipse2d units2 coordinates

Convert an ellipse from one units type to another, by providing a conversion factor given as a rate of change of destination units with respect to source units.

at_ :
Quantity Float (Rate units1 units2)
-> Ellipse2d units1 coordinates
-> Ellipse2d units2 coordinates

Convert an ellipse from one units type to another, by providing an 'inverse' conversion factor given as a rate of change of source units with respect to destination units.

Coordinate conversions

Frame2d units globalCoordinates { defines : localCoordinates }
-> Ellipse2d units globalCoordinates
-> Ellipse2d units localCoordinates

Take an ellipse defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.

Frame2d units globalCoordinates { defines : localCoordinates }
-> Ellipse2d units localCoordinates
-> Ellipse2d units globalCoordinates

Take an ellipse considered to be defined in local coordinates relative to a given reference frame, and return that circle expressed in global coordinates.