Class: Three::SphereGeometry

Inherits:
BufferGeometry show all
Defined in:
lib/three/geometries/sphere_geometry.rb

Instance Attribute Summary collapse

Attributes inherited from BufferGeometry

#attributes, #bounding_box, #bounding_sphere, #draw_range, #groups, #id, #index, #name, #type, #user_data, #uuid

Instance Method Summary collapse

Methods inherited from BufferGeometry

#add_group, allocate_id, #clear_groups, #compute_bounding_box, #compute_bounding_sphere, #delete_attribute, #dispose, #get_attribute, #get_index, #has_attribute?, #set_attribute, #set_draw_range, #set_index, #to_h

Methods included from Dirty

#add_dirty_dependent, #dirty?, #dirty_dependents, #dirty_field?, #dirty_fields, #mark_clean!, #mark_dirty!, #remove_dirty_dependent

Methods inherited from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener?, #remove_event_listener

Constructor Details

#initialize(radius = 1, width_segments: 32, height_segments: 16, phi_start: 0, phi_length: Math::PI * 2, theta_start: 0, theta_length: Math::PI) ⇒ SphereGeometry

Returns a new instance of SphereGeometry.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/three/geometries/sphere_geometry.rb', line 10

def initialize(radius = 1, width_segments: 32, height_segments: 16, phi_start: 0, phi_length: Math::PI * 2, theta_start: 0, theta_length: Math::PI)
  super()
  @type = "SphereGeometry"
  @parameters = {
    radius: radius,
    width_segments: width_segments,
    height_segments: height_segments,
    phi_start: phi_start,
    phi_length: phi_length,
    theta_start: theta_start,
    theta_length: theta_length
  }

  build(
    radius,
    [3, width_segments.floor].max,
    [2, height_segments.floor].max,
    phi_start,
    phi_length,
    theta_start,
    theta_length
  )
end

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



8
9
10
# File 'lib/three/geometries/sphere_geometry.rb', line 8

def parameters
  @parameters
end