`OCADml.Plane`

Normalized cartesian plane operations facilitating conversion between 2d and 3d space.

Normalized cartesian equation of a plane.

The type `t`

contains the coefficients **A**, **B**, **C**, and **D**, which describe the cartesian equation of a plane where `Ax + By + Cz = D`

.

`val to_tup : t -> float * float * float * float`

`to_tup t`

Return the plane `t`

as a tuple of its coefficients.

`make p1 p2 p3`

Create a `t`

, which represents the normalized cartesian equation of a plane, with three points. Returns `(a, b, c, d)`

where `ax + by + cz = d`

is the equation of a plane. Throws `Invalid_argument`

if the points are colinear.

`of_normal ?point normal`

Create a normalized cartesian plane `t`

from a `normal`

vector, and a `point`

(defaulting to `(0., 0.)`

) located on the plane that the `normal`

is projecting off of.

`to_affine ~op t`

Compute an affine transformation matrix that moves 3d objects into (`~op:`Project`

) or out of (`~op:`Lift`

) the coordinate system of the plane `t`

from/to the base coordinate system (XY plane).

`project t p`

Project the 3d point `p`

onto the plane `t`

. On partial application of `t`

, a `Affine3.t`

is computed to perform the projection transform.

`lift t p`

Lift the 2d point `p`

onto the plane `t`

. On partial application of `t`

, a `Affine3.t`

is computed to perform the lift transform.

`val offset : t -> float`

`offset t`

Obtain the coefficient **d** of the normalized plane `t`

, or the scalar offset of the plane from the origin. The absolute value of this coefficient is the distance of the plane from the origin.

`normalize t`

Normalize the **a**, **b**, and **c** coefficients of the plane `t`

, such that their vector norm is equal to one.

`distance_to_point t p`

Calculate the distance to the point `p`

from the plane `t`

. A negative distance indicates that `p`

resides below `t`

.

`greatest_distance t ps`

Calculate the greatest absolute distance between the plane `t`

, and the 3d points `ps`

.

`are_points_on ?eps t ps`

Returns `true`

if all points `ps`

are within `eps`

distance of the plane `t`

.

`is_point_above ?eps t p`

Returns `true`

is point `p`

is `eps`

(default `1e-9`

) distance above the plane `t`

.

`line_angle t line`

Calculate the angle between the plane `t`

and a 3d `line`

. The resulting angle is positive if the line vector lies above the plane (on the same side as the normal vector of `t`

).

```
val line_intersection :
?eps:float ->
?bounds:(bool * bool) ->
t ->
V3.line ->
[ `OutOfBounds | `OnPlane of V3.line | `Parallel | `Point of V3.t * float ]
```

`line_intersection t line`

Find the intersection between a 3d `line`

and the plane `t`

(within `eps`

tolerance, default `1e-9`

), if it exists. `bounds`

indicates whether `line`

is capped at either (ray) or both (segment) of its ends (default is unbounded (`bounds = (false, false)`

).

`val to_string : t -> string`

`val xy : t`

`val xz : t`

`val yz : t`