Hyperplane

public struct Hyperplane<Vector> : GeometricType, CustomStringConvertible where Vector : VectorFloatingPoint
extension Hyperplane: PlaneType
extension Hyperplane: PointProjectablePlaneType
extension Hyperplane: LineIntersectablePlaneType
extension Hyperplane: ConvexType
extension Hyperplane: VolumetricType
extension Hyperplane: Equatable where Vector: Equatable
extension Hyperplane: Hashable where Vector: Hashable

Represents a hyperplane with a point and a normal.

The dimensions of the surface of the hyperplane have a codimension of 1 with respect to its ambient space; in 2D, a hyperplane equates to a line, in 3D it equates to a flat 2D plane, in 4D to a 3D volume, etc.

Hyperplanes divides the space it is contained within, producing an infinitely-spanning volume of space bound at a specific point and angle relative to its ambient space.

  • Convenience for Vector.Scalar

    Declaration

    Swift

    public typealias Scalar = Vector.Scalar
  • Declaration

    Swift

    public var description: String { get }
  • A point on this plane.

    Declaration

    Swift

    public var point: Vector
  • The normal of the plane’s surface.

    Declaration

    Swift

    @UnitVector
    public var normal: Vector { get set }
  • Declaration

    Swift

    public init(point: Vector, normal: Vector)
  • Creates a PointNormalPlane that wraps the given plane object.

    Declaration

    Swift

    public init<Plane>(_ plane: Plane) where Vector == Plane.Vector, Plane : PlaneType
  • Returns a PointNormal value initialized with this plane’s parameters.

    Declaration

    Swift

    var asPointNormal: PointNormal<Vector> { get }
  • Declaration

    Swift

    public var pointOnPlane: Vector { get }
  • Returns the result of a line intersection against this hyperplane.

    Note that hyperplanes are infinitely bounded, thus intersections with lines will consist of at most one point.

    Declaration

    Swift

    public func intersection<Line: LineFloatingPoint>(
        with line: Line
    ) -> ConvexLineIntersection<Vector> where Line.Vector == Vector
  • Returns true if a given vector is contained within the enclosed space of this hyperplane.

    Points laying exactly on top of the plane’s limit (signed distance == 0) are considered to be part of the hyperplane (a closed half-space).

    Declaration

    Swift

    public func contains(_ vector: Vector) -> Bool