Class: Numerix::Plane

Inherits:
Structure show all
Defined in:
lib/numerix/plane.rb

Overview

A structure encapsulating a 3D Plane.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Structure

#[], #[]=, #address, #dup, #each, #pack, #ptr, size, unpack

Constructor Details

#initializePlane #initialize(vector) ⇒ Plane #initialize(normal, distance) ⇒ Plane #initialize(x, y, z, distance) ⇒ Plane

Returns a new instance of Plane.

Overloads:

  • #initializePlane

    Creates a new plane will all values default to 0.0.

  • #initialize(vector) ⇒ Plane

    Constructs a Plane from the given Vector4.

    Parameters:

    • vector (Vector4)

      A vector whose first 3 elements describe the normal vector, and whose W component defines the distance along that normal from the origin.

  • #initialize(normal, distance) ⇒ Plane

    Constructs a Plane from the given normal and distance along the normal from the origin.

    Parameters:

    • normal (Vector3)

      The normal vector of the plane.

    • distance (Float)

      The distance of the plane along its normal from the origin.

  • #initialize(x, y, z, distance) ⇒ Plane

    Constructs a plane from the X, Y, and Z components of its normal, and its distance from the origin on that normal.

    Parameters:

    • x (Float)

      The normal X component.

    • y (Float)

      The normal Y component.

    • z (Float)

      The normal Z component.

    • distance (Float)

      The distance of the Plane along its normal from the origin.



44
45
# File 'lib/numerix/plane.rb', line 44

def initialize(*args)
end

Instance Attribute Details

#distanceFloat

Returns the distance of the plane along its normal from the origin.

Returns:

  • (Float)

    the distance of the plane along its normal from the origin.



14
15
16
# File 'lib/numerix/plane.rb', line 14

def distance
  @distance
end

#normalVector3

Returns the normal vector of the plane.

Returns:

  • (Vector3)

    the normal vector of the plane.



9
10
11
# File 'lib/numerix/plane.rb', line 9

def normal
  @normal
end

Class Method Details

.from_vertices(pnt1, pnt2, pnt3) ⇒ Plane

Creates a Plane that contains the three given points.

Parameters:

  • pnt1 (Vector3)

    The first point defining the plane.

  • pnt2 (Vector3)

    The second point defining the plane.

  • pnt3 (Vector3)

    The third point defining the plane.

Returns:

  • (Plane)

    the plane containing the three points.



150
151
# File 'lib/numerix/plane.rb', line 150

def from_vertices(pnt1, pnt2, pnt3)
end

Instance Method Details

#dot(other) ⇒ Float

Calculates the dot product of a plane and Vector4.

Parameters:

  • other (Vector4)

    The vector to compute.

Returns:

  • (Float)

    the dot product.



97
98
# File 'lib/numerix/plane.rb', line 97

def dot(other)
end

#dot_coord(other) ⇒ Float

Returns the dot product of a specified Vector3 and the normal vector of this Plane plus the distance value of the plane.

Parameters:

  • other (Vector3)

    The vector to compute.

Returns:

  • (Float)

    the dot product.



107
108
# File 'lib/numerix/plane.rb', line 107

def dot_coord(other)
end

#dot_norm(other) ⇒ Float

Returns the dot product of a specified Vector3 and the normal vector of this plane.

Parameters:

  • other (Vector3)

    The vector to compute.

Returns:

  • (Float)


117
118
# File 'lib/numerix/plane.rb', line 117

def dot_norm(other)
end

#normalizePlane

Creates a new plane whose normal vector is the source plane's normal vector normalized.

Returns:

  • (Plane)

    newly created normalized plane.



125
126
# File 'lib/numerix/plane.rb', line 125

def normalize
end

#normalize!self

Normalizes this plane's normal vector.

Returns:

  • (self)


132
133
# File 'lib/numerix/plane.rb', line 132

def normalize!
end

#to_sString

Returns a String representation of this instance.

Returns:

  • (String)

    a String representation of this instance.



137
138
# File 'lib/numerix/plane.rb', line 137

def to_s
end

#transform(matrix) ⇒ Plane #transform(rotation) ⇒ Plane

Note:

This plane must already be normalized, so that its normal vector is of unit length, before this method is called.

Applies a transformation to the plane.

Overloads:

  • #transform(matrix) ⇒ Plane

    Transforms a normalized plane by a matrix.

    Parameters:

    • matrix (Matrix4x4)

      The transformation matrix.

    Returns:

    • (Plane)

      the transformed plane.

  • #transform(rotation) ⇒ Plane

    Transforms a normalized plane by a quaternion rotation.

    Parameters:

    • rotation (Quaternion)

      The rotation to apply.

Returns:

  • (Plane)

    A new plane that results from applying the rotation.



67
68
# File 'lib/numerix/plane.rb', line 67

def transform(other)
end

#transform!(matrix) ⇒ self #transform!(rotation) ⇒ self

Note:

This plane must already be normalized, so that its normal vector is of unit length, before this method is called.

Applies a transformation to the plane.

Overloads:

  • #transform!(matrix) ⇒ self

    Transforms a normalized plane by a matrix.

    Parameters:

    • matrix (Matrix4x4)

      The transformation matrix.

  • #transform!(rotation) ⇒ self

    Transforms a normalized plane by a quaternion rotation.

    Parameters:

    • rotation (Quaternion)

      The rotation to apply.

Returns:

  • (self)


88
89
# File 'lib/numerix/plane.rb', line 88

def transform!(other)
end