Basic operations for 2-dimensional geometric data. Contains two substructures,
Geometry.Vector and Geometry.Point.
type point = real * realA point is a tuple (x,y).
val toString: point -> stringConversion to a string. For example toString (1.0, 2.0) = "(1.0,2.0)".
val distance: point * point -> realStandard euclidean distance between two points.
type t = real * realA vector is a tuple (x,y).
val toString: t -> stringConvert to a string.
val add: t * t -> t
val sub: t * t -> t
val dot: t * t -> t
val cross: t * t -> tSome basic operations on vectors.
val length: t -> realEuclidean length (magnitude) of a vector.
val angle: t * t -> realangle (u, v) is the rotation (in radians) of
v with respect to u. This is a value between -π and π.
Positive rotation is counter-clockwise, negative is clockwise.
For example, angle ((1.0,0.0),(0.0,1.0)) is approximately π/2,
and angle ((1.0,0.0),(~1.0,~1.0)) is approximately -3π/4
val scaleBy: real -> t -> tMultiply the length (magnitude) of a vector by some scalar.
type t = pointA point is a tuple (x,y).
val add: t * t -> t
val sub: t * t -> tBasic operations on points.
val minCoords: t * t -> t
val maxCoords: t * t -> tminCoords computes the lower-left point of the bounding box of two points.
Similarly, maxCoords computes the upper-right point of the bounding box.
val triArea: t * t * t -> tThe (signed) area of a triangle between three points. The orientation of the triangle determines the sign: from left to right, if the points are in counter-clockwise order, the area is positive. If they are in clockwise order, the area is negative.
val counterClockwise: t * t * t -> boolTest if the three points are in counter-clockwise order, from left to right.
val triAngle: t * t * t -> realtriAngle (a,b,c) is the angle (in radians) of the triangle inside vertex b.
val inCircle: t * t * t -> t -> boolinCircle (a,b,c) x tests whether or not the point x is within the
circumcircle of the triangle (a,b,c).