Class: Disp3D::NodeCone

Inherits:
NodeLeaf show all
Defined in:
lib/node/node_cone.rb

Instance Attribute Summary

Attributes inherited from Node

#instance_id, #name, #parents

Instance Method Summary collapse

Methods inherited from NodeLeaf

#draw, #update_for_display

Methods inherited from Node

#ancestors, #post_draw, #pre_draw

Constructor Details

#initialize(geom = nil, name = nil) ⇒ NodeCone

Returns a new instance of NodeCone.



10
11
12
13
14
15
16
17
18
# File 'lib/node/node_cone.rb', line 10

def initialize(geom=nil, name=nil)
  super
  @radius = 1.0
  @height = 3.0
  @slices = 10
  @stacks = 10
  @base_point = Vector3.new()
  @direction = Vector3.new(0,0,1)
end

Instance Method Details

#boxObject



20
21
22
23
24
25
26
27
# File 'lib/node/node_cone.rb', line 20

def box
  rtn_box = Box.new(Vector3.new(-@radius,-@radius,0), Vector3.new(@radius,@radius,@height))
  rtn_box = box_transform(rtn_box)
  rot = calc_rotate_from_direction
  rtn_box = rtn_box.rotate(rot) if(!rot.nil?)
  rtn_box = rtn_box.translate(@base_point)
  return rtn_box
end