Math.Geometry


Builders

For the builder functions, these points are defined to make the examples shorter.

let p1: Point2D<Meters, Cartesian> = Point2D.meters 1. 3.

let p2: Point2D<Meters, Cartesian> = Point2D.meters 4. 5.

let p3: Point2D<Meters, Cartesian> = Point2D.meters 7. 8.
Triangle2D.from p1 p2 p3
Triangle2D.fromVertices (p1, p2, p3)

Accessors

let triangle = Triangle2D.from p1 p2 p3
Triangle2D.vertices triangle
No value returned by any evaluator
Triangle2D.edges triangle
No value returned by any evaluator
Triangle2D.centroid triangle
No value returned by any evaluator
Triangle2D.circumcircle triangle
No value returned by any evaluator

Modifiers

let referencePoint = Point2D.meters 1. 1.
Triangle2D.scaleAbout referencePoint 2. triangle
No value returned by any evaluator
Triangle2D.rotateAround referencePoint Angle.halfPi triangle
No value returned by any evaluator
Triangle2D.translateBy (Vector2D.meters 4. 4.) triangle
No value returned by any evaluator
Triangle2D.translateIn (Direction2D.degrees 30.) (Length.meters 2.) triangle
No value returned by any evaluator
Triangle2D.mirrorAcross Axis2D.x triangle
No value returned by any evaluator
Triangle2D.placeIn

Queries

Triangle2D.contains (Point2D.meters 2. 2.) triangle
No value returned by any evaluator
Triangle2D.contains (Point2D.meters 4. 5.) triangle
No value returned by any evaluator

Get the signed area of the triangle. The value is positive is the triangles vertices are in counterclockwise order.

Triangle2D.counterclockwiseArea triangle
No value returned by any evaluator

Get the signed area of the triangle. The value is positive is the triangles vertices are in clockwise order.

Triangle2D.clockwiseArea triangle
No value returned by any evaluator

Get the area of the triangle. This value is always positive.

Triangle2D.area triangle
No value returned by any evaluator
namespace Math
namespace Math.Geometry
namespace Math.Units
Multiple items
union case Cartesian.Cartesian: Cartesian

--------------------
type Cartesian = | Cartesian
val p1 : Point2D<Meters,Cartesian>
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 ...
Multiple items
union case Meters.Meters: Meters

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

--------------------
[<Struct>] type Triangle2D<'Units,'Coordinates> = { P1: Point2D<'Units,'Coordinates> P2: Point2D<'Units,'Coordinates> P3: Point2D<'Units,'Coordinates> } interface IGeometry<'Coordinates> override Equals : obj:obj -> bool override GetHashCode : unit -> int
val from : p1:Point2D<'Units,'Coordinates> -> p2:Point2D<'Units,'Coordinates> -> p3:Point2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Construct a triangle from the first point, to the second, to the third. </summary>
val fromVertices : Point2D<'Units,'Coordinates> * Point2D<'Units,'Coordinates> * Point2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Construct a triangle from its three vertices. </summary>
val triangle : Triangle2D<Meters,Cartesian>
val vertices : triangle:Triangle2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates> * Point2D<'Units,'Coordinates> * Point2D<'Units,'Coordinates>
<summary> Get the three vertices of the triangle </summary>
val edges : triangle:Triangle2D<'Units,'Coordinates> -> LineSegment2D<'Units,'Coordinates> * LineSegment2D<'Units,'Coordinates> * LineSegment2D<'Units,'Coordinates>
<summary> Get the edges of a triangle: from the first vertex to the second, from the second to the third, and from the third back to the first. </summary>
val centroid : triangle:Triangle2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates>
<summary> Get the centroid (center of mass) of a triangle. </summary>
val circumcircle : triangle:Triangle2D<'Units,'Coordinates> -> Circle2D<'Units,'Coordinates> option
<summary> Attempt to find the circumcircle of a triangle, a circle that passes through each of the triangle's vertices; If the triangle is degenerate (its three vertices are collinear), returns `None`. </summary>
val referencePoint : Point2D<Meters,Cartesian>
val scaleAbout : point:Point2D<'Units,'Coordinates> -> scale:float -> triangle:Triangle2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Scale a triangle about a given point by a given scale. Note that scaling by a negative value will result in the 'winding direction' of the triangle being flipped - if the triangle's vertices were in counterclockwise order before the negative scaling, they will be in clockwise order afterwards and vice versa. </summary>
val rotateAround : centerPoint:Point2D<'Units,'Coordinates> -> angle:Angle -> triangle:Triangle2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Rotate a triangle around a given point by a given angle. </summary>
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 translateBy : vector:Vector2D<'Units,'Coordinates> -> triangle:Triangle2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Translate a triangle by a given displacement. </summary>
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 translateIn : direction:Direction2D<'Coordinates> -> distance:Quantity<'Units> -> triangle:Triangle2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Translate a triangle in a given direction by a given distance. </summary>
Multiple items
module Direction2D from Math.Geometry

--------------------
type Direction2D<'Coordinates> = { X: float Y: float } interface IComparable interface IComparable<Direction2D<'Coordinates>> interface IGeometry<'Coordinates> member Comparison : other:Direction2D<'Coordinates> -> int override Equals : obj:obj -> bool + 1 overload override GetHashCode : unit -> int member LessThan : other:Direction2D<'Coordinates> -> bool static member xy : x:float -> y:float -> Direction2D<'Coordinates> option
val degrees : d:float -> Direction2D<'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 mirrorAcross : axis:Axis2D<'Units,'Coordinates> -> triangle:Triangle2D<'Units,'Coordinates> -> Triangle2D<'Units,'Coordinates>
<summary> Mirror a triangle across a given axis. Note that mirroring a triangle will result in its 'winding direction' being flipped - if the triangle's vertices were in counterclockwise order before mirroring, they will be in clockwise order afterwards and vice versa. </summary>
Multiple items
module Axis2D from Math.Geometry

--------------------
[<Struct>] type Axis2D<'Units,'Coordinates> = { Origin: Point2D<'Units,'Coordinates> Direction: Direction2D<'Coordinates> } interface IGeometry<'Coordinates> override Equals : obj:obj -> bool override GetHashCode : unit -> int
val x<'Units,'Coordinates> : Axis2D<'Units,'Coordinates>
val placeIn : frame:Frame2D<'Units,'GlobalCoordinates,'LocalCoordinates> -> triangle:Triangle2D<'Units,'LocalCoordinates> -> Triangle2D<'Units,'GlobalCoordinates>
<summary> Take a triangle considered to be defined in local coordinates relative to a given reference frame, and return that triangle expressed in global coordinates. </summary>
val contains : point:Point2D<'Units,'Coordinates> -> triangle:Triangle2D<'Units,'Coordinates> -> bool
<summary> Check whether a given point is inside a given triangle. It does not matter whether the triangle's vertices are in clockwise or counterclockwise order. </summary>
val counterclockwiseArea : triangle:Triangle2D<'Units,'Coordinates> -> Quantity<Squared<'Units>>
<summary> Get the signed area of a triangle, returning a positive value if the triangle's vertices are in counterclockwise order and a negative value otherwise. </summary>
val clockwiseArea : triangle:Triangle2D<'Units,'Coordinates> -> Quantity<Squared<'Units>>
<summary> Get the signed area of a triangle, returning a positive value if the triangle's vertices are in clockwise order and a negative value otherwise. </summary>
val area : triangle:Triangle2D<'Units,'Coordinates> -> Quantity<Squared<'Units>>
<summary> Get the area of a triangle. The result will always be positive regardless of whether the triangle's vertices are in clockwise or counterclockwise order. </summary>