opensolid/geometry/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

OpenSolid.Geometry.Types

This module contains the definitions of the core OpenSolid data types. Each type also has a corresponding module providing related functionality. Suggested practice is to import this module exposing everything, and import all other necessary modules using as, for example:

import OpenSolid.Geometry.Types exposing (..)
import OpenSolid.Vector2d as Vector2d
import OpenSolid.Plane3d as Plane3d

Vectors

Vectors represent quantities such as displacements or velocities. For positions, Point2d or Point3d should be used instead.

= Vector2d ( Float, Float )

Vector2d

A vector in 2D, defined by its X and Y components. See the Vector2d module for details.

= Vector3d ( Float, Float, Float )

Vector3d

A vector in 3D, defined by its X, Y and Z components. See the Vector3d module for details.

Directions

A direction is effectively a vector with a length of one, used to represent quantities like the direction of an axis or the normal direction of a plane.

= Direction2d ( Float, Float )

Direction2d

A direction in 2D, defined by its X and Y components. See the Direction2d module for details.

= Direction3d ( Float, Float, Float )

Direction3d

A direction in 3D, defined by its X, Y and Z components. See the Direction3d module for details.

Points

Points represent positions in space. They are distinct from vectors but interact with them in well-defined ways; you can translate a point by a vector to result in a new point, or you can compute the vector from one point to another, but you cannot 'add' two points like you can add two vectors.

type Point2d
= Point2d ( Float, Float )

Point2d

A point in 2D, defined by its X and Y coordinates. See the Point2d module for details.

type Point3d
= Point3d ( Float, Float, Float )

Point3d

A point in 3D, defined by its X, Y and Z coordinates. See the Point3d module for details.

Datums

Axes and planes are used extensively within OpenSolid to define different types of transformations. For instance, rotation in 3D is defined by a rotation axis and mirroring in 3D is defined by a mirror plane.

type Axis2d
= Axis2d
{ originPoint : Point2d
, direction : Direction2d
}

Axis2d

An axis in 2D, defined by its origin point and direction. See the Axis2d module for details.

type Axis3d
= Axis3d
{ originPoint : Point3d
, direction : Direction3d
}

Axis3d

An axis in 3D, defined by its origin point and direction. See the Axis3d module for details.

type Plane3d
= Plane3d
{ originPoint : Point3d
, normalDirection : Direction3d
}

Plane3d

A plane in 3D, defined by its origin point and normal direction. See the Plane3d module for details.

Frames

Frames represent local coordinate systems, and allow for conversions between local and global coordinates. They are also a common source of datums used in transformations, for example rotating around the Z axis of a 3D frame or mirroring across its XY plane.

type Frame2d
= Frame2d
{ originPoint : Point2d
, xDirection : Direction2d
, yDirection : Direction2d
}

Frame2d

A coordinate system in 2D space, defined by its origin point and X and Y directions. See the Frame2d module for details.

type Frame3d
= Frame3d
{ originPoint : Point3d
, xDirection : Direction3d
, yDirection : Direction3d
, zDirection : Direction3d
}

Frame3d

A coordinate system in 3D space, defined by its origin point and X, Y and Z directions. See the Frame3d module for details.

Sketch planes

= SketchPlane3d
{ originPoint : Point3d
, xDirection : Direction3d
, yDirection : Direction3d
}

SketchPlane3d

A 2D planar coordinate system embedded in 3D space, defined by its origin point and X and Y directions. Used for operations such as projecting 3D geometry into a 2D coordinate system or placing 2D geometry in 3D. See the SketchPlane3d module for details.

Line segments

= LineSegment2d ( Point2d, Point2d )

LineSegment2d

A line segment in 2D, defined by its start and end points. See the LineSegment2d module for details.

= LineSegment3d ( Point3d, Point3d )

LineSegment3d

A line segment in 3D, defined by its start and end points. See the LineSegment3d module for details.

Triangles

= Triangle2d ( Point2d, Point2d, Point2d )

Triangle2d

A triangle in 2D, defined by its three vertices. See the Triangle2d module for details.

= Triangle3d ( Point3d, Point3d, Point3d )

Triangle3d

A triangle in 3D, defined by its three vertices. See the Triangle3d module for details.

Bounding boxes

These types represent bounding boxes around other geometric objects, and are useful for tasks such as fast spatial searching or culling non-visible objects during 3D rendering.

= BoundingBox2d
{ minX : Float
, maxX : Float
, minY : Float
, maxY : Float
}

BoundingBox2d

A bounding box in 2D, defined by its minimum and maximum X and Y values. See the BoundingBox2d module for details.

= BoundingBox3d
{ minX : Float
, maxX : Float
, minY : Float
, maxY : Float
, minZ : Float
, maxZ : Float
}

BoundingBox3d

A bounding box in 3D, defined by its minimum and maximum X, Y and Z values. See the BoundingBox3d module for details.

Polylines

= Polyline2d (List Point2d)

Polyline2d

A polyline in 2D, defined by a list of vertices. See the Polyline2d module for details.

= Polyline3d (List Point3d)

Polyline3d

A polyline in 3D, defined by a list of vertices. See the Polyline3d module for details.

Polygons

= Polygon2d (List Point2d)

Polygon2d

A polygon in 2D, defined by a list of vertices. Very similar to a Polyline2d but the last point is implicitly considered to connect back to the first point. See the Polygon2d module for details.

Circles

= Circle2d
{ centerPoint : Point2d
, radius : Float
}

Circle2d

A circle in 2D, defined by its center point and radius. See the Circle2d module for details.