ianmackenzie / elm-geometry / 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


type alias Ellipse2d units coordinates =
Geometry.Types.Ellipse2d units coordinates

Constructors

with : { centerPoint : Point2d units coordinates, xDirection : Direction2d coordinates, xRadius : Quantity Basics.Float units, yRadius : Quantity Basics.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 Basics.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 Basics.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 Basics.Float (Quantity.Squared units)

Get the area of an ellipse.

Ellipse2d.area exampleEllipse
--> Area.squareMeters 47.1239

Conversion

toEllipticalArc : Ellipse2d units coordinates -> Geometry.Types.EllipticalArc2d units coordinates

Convert an ellipse to a 360 degree elliptical arc.

Bounds

boundingBox : Ellipse2d units coordinates -> BoundingBox2d units coordinates

Get the minimal bounding box containing a given ellipse.

signedDistanceAlong : Axis2d units coordinates -> Ellipse2d units coordinates -> Quantity.Interval.Interval Basics.Float units

Project an ellipse onto an axis, returning the range of projected distances along that axis.

Transformations

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

scaleAbout : Point2d units coordinates -> Basics.Float -> Ellipse2d units coordinates -> Ellipse2d units coordinates

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

rotateAround : Point2d units coordinates -> Angle -> Ellipse2d units coordinates -> Ellipse2d units coordinates

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

translateBy : Vector2d units coordinates -> Ellipse2d units coordinates -> Ellipse2d units coordinates

Translate an ellipse by a given displacement.

translateIn : Direction2d coordinates -> Quantity Basics.Float units -> Ellipse2d units coordinates -> Ellipse2d units coordinates

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

mirrorAcross : 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 Basics.Float (Quantity.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 Basics.Float (Quantity.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

relativeTo : 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.

placeIn : 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.