Class: Object

Inherits:
BasicObject
Defined in:
lib/eymiha_math3.rb

Overview

These modifications to objects add 3D point duck classifying.

Instance Method Summary collapse

Instance Method Details

#point3_like?Boolean

Returns true if the instance has 3D cartesian coordinates, ie. responds to x, y and z.

Returns:

  • (Boolean)


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

def point3_like?
  (respond_to? :x)&&(respond_to? :y)&&(respond_to? :z)
end

#point3c_like?Boolean

Returns true if the instance has 3D cylindrical coordinates, ie responds to c_radius, theta and z.

Returns:

  • (Boolean)


21
22
23
# File 'lib/eymiha_math3.rb', line 21

def point3c_like?
  (respond_to? :c_radius)&&(respond_to? :theta)&&(respond_to? :z)
end

#point3s_like?Boolean

Returns true if the instance has 3D spherical coordinates, ie. responds to s_radius, theta and phi.

Returns:

  • (Boolean)


15
16
17
# File 'lib/eymiha_math3.rb', line 15

def point3s_like?
  (respond_to? :s_radius)&&(respond_to? :theta)&&(respond_to? :phi)
end