gl3n



struct PlaneT(type = float) if (isFloatingPoint!(type));

Base template for all plane-types.

Parameters
type all values get stored as this type (must be floating point)

alias pt = type;

Holds the internal type of the plane.


alias vec3 = Vector!(pt, 3);

Convenience alias to the corresponding vector type.


pt a;

normal.x


pt b;

normal.y


pt c;

normal.z


vec3 normal;

Holds the planes normal.


pt d;

Holds the planes "constant" (HNF).


this(pt a, pt b, pt c, pt d);
this(vec3 normal, pt d);

Constructs the plane, from either four scalars of type pt or from a 3-dimensional vector (= normal) and a scalar.


void normalize();

Normalizes the plane inplace.


const PlaneT normalized();

Returns a normalized copy of the plane.


const pt distance(vec3 point);

Returns the distance from a point to the plane.

Note:
the plane must be normalized, the result can be negative.

const pt ndistance(vec3 point);

Returns the distance from a point to the plane.

Note:
the plane does not have to be normalized, the result can be negative.