Math.Geometry


Constructors

Points can be created from the x and y components.

Point2D.xy (Length.meters 3.) (Length.meters 4.)

You can use either rTheta or polar when using polar coordinates.

Point2D.rTheta (Length.meters 5.) Angle.halfPi

Point2D.polar (Length.meters 5.) Angle.halfPi

Operators

Operators are provided for more concise syntax when dealing with points. All of these symbol operators have a corresponding function that you can use as well. These are often used when using functions like List.map or when used in piping operations (|>). Pay attention to the order of the arguments! Because these functions are intended to be used in pipes the order goes like Point2D.add rhs lhs.

The following three statements are equivalent. \[Point2D + Point2D = Point2D\]

Point2D.translate vec point

point |> Point2D.plus vec

point + vec
No value returned by any evaluator

\[ Point2D - Vector2D = Point2D \]

point - vec
No value returned by any evaluator

\[ Point2D - Point2D = Vector2D \]

(secondPoint - point) = vec
No value returned by any evaluator

The following table is the complete list of operators that can be used on point objects.

Operator

Lhs

Rhs

Return Type

Example

Function

-

Point

Point

-vec

Point2D.neg

+

Point

Point

Point

lhs + rhs

Point2D.plus

-

Point

Point

Point

lhs - rhs

Point2D.minus

*

Point

float

Point

lhs * 0.5

Point2D.times & Point2D.scaleBy

*

float

Point

Point

0.5 * rhs

None

/

Point

float

Point

lhs / 4.

Point2D.dividedBy

namespace Math
namespace Math.Geometry
namespace Math.Units
Multiple items
module Point2D from Math.Geometry

--------------------
[<Struct>] type Point2D<'Units,'Coordinates> = { X: Quantity<'Units> Y: Quantity<'Units> } interface IComparable interface IComparable<Point2D<'Units,'Coordinates>> interface IGeometry<'Coordinates> member Comparison : other:Point2D<'Units,'Coordinates> -> int override Equals : obj:obj -> bool + 1 overload override GetHashCode : unit -> int member LessThan : other:Point2D<'Units,'Coordinates> -> bool static member ( * ) : lhs:Point2D<'Units,'Coordinates> * rhs:float -> Point2D<'Units,'Coordinates> + 1 overload static member ( + ) : lhs:Point2D<'Units,'Coordinates> * rhs:Vector2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates> static member ( - ) : lhs:Point2D<'Units,'Coordinates> * rhs:Point2D<'Units,'Coordinates> -> Vector2D<'Units,'Coordinates> + 1 overload ...
val xy : x:Quantity<'Units> -> y:Quantity<'Units> -> Point2D<'Units,'Coordinates>
Multiple items
module Length from Math.Units
<category>Module: Unit System</category>
<summary> A <c>Length</c> represents a length in meters, feet, centimeters, miles etc. It is stored as a number of meters. </summary>


--------------------
type Length = Quantity<Meters>
<category>Unit System</category>
val meters : m:float -> Length
<category index="2">Metric</category>
val rTheta : r:Quantity<'Units> -> theta:Angle -> Point2D<'Units,'Coordinates>
Multiple items
module Angle from Math.Units
<category>Module: Unit System</category>
<summary> An <c>Angle</c> represents an angle in degrees, radians, or turns. It is stored as a number of radians. </summary>
<note> Angles are sometimes measured in degrees, minutes, and seconds, where 1 minute = 1/60th of a degree and 1 second = 1/60th of a minute. </note>
<example> You can construct an angle from your unit scheme. All of the following are equivalent. <code> Angle.radians Math.PI Angle.degrees 180. Angle.turns 0.5 </code></example>


--------------------
type Angle = Quantity<Radians>
<category>Unit System</category>
val halfPi : Angle
<summary> π/2. Alias for <see cref="M:Math.Units.Angle.piOverTwo" />. </summary>
<category>Constants</category>
val polar : r:Quantity<'a> -> theta:Angle -> Point2D<'a,'b>
Multiple items
union case Cartesian.Cartesian: Cartesian

--------------------
type Cartesian = | Cartesian
val point : Point2D<Meters,Cartesian>
Multiple items
union case Meters.Meters: Meters

--------------------
type Meters = | Meters
<category>Unit</category>
val meters : x:float -> y:float -> Point2D<Meters,'Coordinates>
val secondPoint : Point2D<Meters,Cartesian>
val vec : Vector2D<Meters,Cartesian>
Multiple items
module Vector2D from Math.Geometry

--------------------
[<Struct>] type Vector2D<'Units,'Coordinates> = { X: Quantity<'Units> Y: Quantity<'Units> } interface IComparable interface IComparable<Vector2D<'Units,'Coordinates>> interface IGeometry<'Coordinates> member Comparison : other:Vector2D<'Units,'Coordinates> -> int override Equals : obj:obj -> bool + 1 overload override GetHashCode : unit -> int member LessThan : other:Vector2D<'Units,'Coordinates> -> bool static member ( * ) : vector:Vector2D<'Units,'Coordinates> * scale:float -> Vector2D<'Units,'Coordinates> + 1 overload static member ( + ) : lhs:Vector2D<'Units,'Coordinates> * rhs:Vector2D<'Units,'Coordinates> -> Vector2D<'Units,'Coordinates> static member ( - ) : lhs:Vector2D<'Units,'Coordinates> * rhs:Vector2D<'Units,'Coordinates> -> Vector2D<'Units,'Coordinates> ...
val meters : x:float -> y:float -> Vector2D<Meters,'Coordinates>
val translate : v:Vector2D<'Units,'Coordinates> -> p:Point2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates>
val plus : rhs:Vector2D<'Units,'Coordinates> -> lhs:Point2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates>
<summary> This function is designed to be used in piping operators. </summary>