Plane
A plane in Hessian normal form.
struct PlaneA plane in Hessian normal form.
struct Planeimport SwiftGodotFramework to write Godot Game Extensions using the Swift Programming Language.
var normal: Vector3The normal of the plane, typically a unit vector. Shouldn’t be a zero vector as Plane with such normal does not represent a valid plane.
var d: FloatThe distance from the origin to the plane, expressed in terms of normal (according to its direction and magnitude). Actual absolute distance from the origin to the plane can be calculated as abs(d) / normal.length() (if normal has zero length then this Plane does not represent a valid plane).
protocol CopyableA type whose values can be implicitly or explicitly copied.
protocol EquatableA type that can be compared for value equality.
protocol Escapableprotocol Hashable : EquatableA type that can be hashed into a Hasher to produce an integer hash value.
protocol SelfVariantRepresentable : VariantRepresentable where Self == Self.VariantContentStructs and scalar types use their own layout for storage.
protocol VariantRepresentable : VariantStorableTypes that conform to VariantRepresentable can be stored directly in Variant with no conversion. These include all of the Variant types from Godot (for example GString, Rect, Plane), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.
protocol VariantStorableTypes that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
init() Constructs a default-initialized Plane with all components set to 0.
init(a: Float, b: Float, c: Float, d: Float) Creates a plane from the four parameters. The three components of the resulting plane’s normal are a, b and c, and the plane has a distance of d from the origin.
init(from: Plane) Constructs a Plane as a copy of the given Plane.
init(normal: Vector3) Creates a plane from the normal vector. The plane will intersect the origin.
init(normal: Vector3, d: Float) Creates a plane from the normal vector and the plane’s distance from the origin.
init(normal: Vector3, point: Vector3) Creates a plane from the normal vector and a point on the plane.
init(point1: Vector3, point2: Vector3, point3: Vector3) Creates a plane from the three points, given in clockwise order.
static var godotType: Variant.GType { get }static let planeXy: PlaneA plane that extends in the X and Y axes (normal vector points +Z).
static let planeXz: PlaneA plane that extends in the X and Z axes (normal vector points +Y).
static let planeYz: PlaneA plane that extends in the Y and Z axes (normal vector points +X).
static func != (lhs: Plane, rhs: Plane) -> Bool Returns true if the planes are not equal.
static func * (lhs: Plane, rhs: Transform3D) -> Plane Inversely transforms (multiplies) the Plane by the given Transform3D transformation matrix.
static func - (p: `Self`) -> Plane Returns the negative value of the Plane. This is the same as writing Plane(-p.normal, -p.d). This operation flips the direction of the normal vector and also flips the distance value, resulting in a Plane that is in the same place, but facing the opposite direction.
static func == (lhs: Plane, rhs: Plane) -> Bool Returns true if the planes are exactly equal.
func distanceTo(point: Vector3) -> Double Returns the shortest distance from the plane to the position point. If the point is above the plane, the distance will be positive. If below, the distance will be negative.
func getCenter() -> Vector3 Returns the center of the plane.
func hasPoint(_ point: Vector3, tolerance: Double = 1e-05) -> Bool Returns true if point is inside the plane. Comparison uses a custom minimum tolerance threshold.
func intersect3(b: Plane, c: Plane) -> Variant Returns the intersection point of the three planes b, c and this plane. If no intersection is found, null is returned.
func intersectsRay(from: Vector3, dir: Vector3) -> Variant Returns the intersection point of a ray consisting of the position from and the direction normal dir with this plane. If no intersection is found, null is returned.
func intersectsSegment(from: Vector3, to: Vector3) -> Variant Returns the intersection point of a segment from position from to position to with this plane. If no intersection is found, null is returned.
func isEqualApprox(toPlane: Plane) -> Bool Returns true if this plane and toPlane are approximately equal, by running @GlobalScope.is_equal_approx on each component.
func isFinite() -> Bool Returns true if this plane is finite, by calling @GlobalScope.is_finite on each component.
func isPointOver(point: Vector3) -> Bool Returns true if point is located above the plane.
func normalized() -> Plane Returns a copy of the plane, with normalized normal (so it’s a unit vector). Returns Plane(0, 0, 0, 0) if normal can’t be normalized (it has zero length).
func project(point: Vector3) -> Vector3 Returns the orthogonal projection of point into a point in the plane.
init?(_ variant: Variant) static func makeOrUnwrap(_ variant: Variant) -> Self? where Self : Object Unwraps an object from a variant.
static func makeOrUnwrap(_ variant: Variant) -> Self? Unwraps an object from a variant. This is useful when you want one method to call that will return the unwrapped Variant, regardless of whether it is a SwiftGodot.Object or not.
var content: VariantContent { get }static func != (lhs: Self, rhs: Self) -> Bool Returns a Boolean value indicating whether two values are not equal.
func toVariantRepresentable() -> Self