Class Fox::FXHVec

In: | FXHVec.rb
Parent: | Object

FXHVec is a 3-D homogenous vector.

Methods

* + - -@ / == [] []= cross dot hi len lo new new new new normalize to_a to_s

Public Class methods

new()

Returns a new, uninitialized FXHVec instance.

new(other)

Returns a new FXHVec instance with contents initialized from other, where other is either an FXVec or FXHVec instance.

new(x, y, z, w=1.0)

Returns a new FXHVec instance with initial components (x, y, z and w).

new(color)

Initialize with color

Public Instance methods

==(other)

Returns `true` if this vector is equal to other.

-@()

Returns the negation of this

[](i)

Returns the ith element of this vector.

[]=(i, x)

Set the ith element of this vector to x.

+(other)

Returns the sum of this vector and another vector

-(other)

Returns the difference, this vector minus another vector

*(x)

Returns the product of this vector and the scalar x.

/(x)

Returns the quotient, this vector divided by the scalar x.

dot(other)

Returns the dot product of this vector and other.

cross(other)

Returns the cross product of this vector and other.

len()

Returns the length of this vector

normalize()

Returns the normalized version of this vector.

lo(other)

Returns a new FXHVec, each of whose components is equal to the smaller of this vector’s and other’s components, i.e.

      self.lo(other) === FXHVec.new( [self[0], other[0]].min,
                                     [self[1], other[1]].min,
                                     [self[2], other[2]].min,
                                     [self[3], other[3]].min )

hi(other)

Returns a new FXHVec, each of whose components is equal to the greater of this vector’s and other’s components, i.e.

      self.lo(other) === FXHVec.new( [self[0], other[0]].max,
                                     [self[1], other[1]].max,
                                     [self[2], other[2]].max,
                                     [self[3], other[3]].max )

to_s()

Returns a stringified version of this vector

to_a()

Convert to an array