gl3n.plane

  • Declaration

    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)

    • pt

      Declaration

      alias pt = type;

      Holds the internal type of the plane.

    • Declaration

      alias vec3 = Vector!(pt, 3);

      Convenience alias to the corresponding vector type.

    • a

      Declaration

      pt a;

      normal.x

    • b

      Declaration

      pt b;

      normal.y

    • c

      Declaration

      pt c;

      normal.z

    • Declaration

      vec3 normal;

      Holds the planes normal.

    • d

      Declaration

      pt d;

      Holds the planes "constant" (HNF).

    • Declaration

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

      Constructs the plane, from either four scalars of type pt

      Discussion

      or from a 3-dimensional vector (= normal) and a scalar.

    • Declaration

      void normalize();

      Normalizes the plane inplace.

    • Declaration

      const @property PlaneT normalized();

      Returns a normalized copy of the plane.

    • Declaration

      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.

    • Declaration

      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.