lib/mittsu/extras/geometries/cylinder_geometry.rb in mittsu-0.3.2 vs lib/mittsu/extras/geometries/cylinder_geometry.rb in mittsu-0.3.3

- old
+ new

@@ -1,11 +1,11 @@ require 'mittsu/core' require 'mittsu/math' module Mittsu class CylinderGeometry < Geometry - def initialize(radius_top = 20.0, radius_bottom = 20.0, height = 100.0, radial_segments = 8, height_segments = 1, open_ended = false, theta_start = 0.0, theta_length = (Math::PI * 2.0)) + def initialize(radius_top = 20.0, radius_bottom = 20.0, height = 100.0, radial_segments = 8, height_segments = 1, open_ended = false, theta_start = 0.0, theta_length = (::Math::PI * 2.0)) super() @type = 'CylinderGeometry' @parameters = { @@ -33,13 +33,13 @@ for x in 0..radial_segments do u = x.to_f / radial_segments vertex = Vector3.new - vertex.x = radius * Math.sin(u * theta_length + theta_start) + vertex.x = radius * ::Math.sin(u * theta_length + theta_start) vertex.y = -v * height + height_half - vertex.z = radius * Math.cos(u * theta_length + theta_start) + vertex.z = radius * ::Math.cos(u * theta_length + theta_start) @vertices << vertex index_row << (vertices.length - 1) uv_row << Vector2.new(u, 1.0 - v) @@ -61,13 +61,13 @@ else na = @vertices[index_rows[1][x]].clone nb = @vertices[index_rows[1][x + 1]].clone end - na.y = Math.sqrt(na.x * na.x + na.z * na.z) * tan_theta + na.y = ::Math.sqrt(na.x * na.x + na.z * na.z) * tan_theta na.normalize - nb.y = Math.sqrt(nb.x * nb.x + nb.z * nb.z) * tan_theta + nb.y = ::Math.sqrt(nb.x * nb.x + nb.z * nb.z) * tan_theta nb.normalize for y in 0...height_segments do v1 = index_rows[y][x] v2 = index_rows[y + 1][x]