Module: Eymiha::ThreeDimensions

Included in:
Envelope3, Point3, Point3c, Point3s, Quaternion, Numeric
Defined in:
lib/eymiha/math3/math3.rb

Instance Method Summary collapse

Instance Method Details

#half_piObject

shorthand for pi/2.



43
44
45
# File 'lib/eymiha/math3/math3.rb', line 43

def half_pi
  Math::PI/2.0
end

#originObject

the origin of 3D space.



58
59
60
# File 'lib/eymiha/math3/math3.rb', line 58

def origin
  Point3.origin
end

#piObject

shorthand for pi.



38
39
40
# File 'lib/eymiha/math3/math3.rb', line 38

def pi
  Math::PI
end

#point3(x = 0, y = 0, z = 0) ⇒ Object

shorthand for creating a 3D point in cartesian coordinates.



63
64
65
# File 'lib/eymiha/math3/math3.rb', line 63

def point3(x=0, y=0, z=0)
  Point3.new(x,y,z)
end

#point3c(c_radius = 0, theta = 0, z = 0) ⇒ Object

shorthand for creating a 3D point in cylindrical coordinates.



73
74
75
# File 'lib/eymiha/math3/math3.rb', line 73

def point3c(c_radius=0, theta=0, z=0)
  Point3c.new(c_radius,theta,z)
end

#point3s(s_radius = 0, theta = 0, phi = 0) ⇒ Object

shorthand for creating a 3D point in spherical coordinates.



68
69
70
# File 'lib/eymiha/math3/math3.rb', line 68

def point3s(s_radius=0, theta=0, phi=0)
  Point3s.new(s_radius,theta,phi)
end

#quaternion(axis = origin, real = 0) ⇒ Object

shorthand for creating a quaternion.



78
79
80
# File 'lib/eymiha/math3/math3.rb', line 78

def quaternion(axis=origin,real=0)
  Quaternion.new(axis,real)
end

#sqrt2Object

shorthand for the square root of 2.



48
49
50
# File 'lib/eymiha/math3/math3.rb', line 48

def sqrt2
  Math.sqrt 2
end

#sqrt3Object

shorthand for the square root of 3.



53
54
55
# File 'lib/eymiha/math3/math3.rb', line 53

def sqrt3
  Math.sqrt 3
end

#two_piObject

shorthand for 2*pi.



33
34
35
# File 'lib/eymiha/math3/math3.rb', line 33

def two_pi
  2.0*Math::PI
end