Module: Glitch3d::Duplication

Defined in:
lib/glitch3d/strategies/duplication.rb

Instance Method Summary collapse

Instance Method Details

#alter_faces(faces_objects_array, vertex_objects_array) ⇒ Object



8
9
10
# File 'lib/glitch3d/strategies/duplication.rb', line 8

def alter_faces(faces_objects_array, vertex_objects_array)
  faces_objects_array
end

#alter_vertices(vertices_objects_array) ⇒ Object



4
5
6
# File 'lib/glitch3d/strategies/duplication.rb', line 4

def alter_vertices(vertices_objects_array)
  shuffle_vertices(vertices_objects_array)
end

#shuffle_vertices(array) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/glitch3d/strategies/duplication.rb', line 12

def shuffle_vertices(array)
  rand(3).times do
    rand_index1 = rand(0..array.size - 1)
    rand_index2 = rand(0..array.size - 1)
    array[rand_index1], array[rand_index2] = array[rand_index2], array[rand_index1]
  end
  array
end