| Class | LiteLine |
| In: |
liteline.rb
|
| Parent: | FXGLObject |
| info | [RW] | interaction attributes |
| p0 | [RW] | ref attributes |
| p1 | [RW] | ref attributes |
| pointref | [RW] | |
| selected | [RW] | interaction attributes |
| visible | [RW] |
# File liteline.rb, line 115 def initialize(*args) super() @red,@green,@blue = 1.0, 0.0, 0.0 @selected = false @visible = false # # if independent line is created # LiteLine is created with LiteLine.new[InfoPoint,InfoPoint,@info] # LiteLine.new(p0, p1, parent, viewerobj, text) # if args.length == 5 && args[0].class == InfoPoint && args[1].class == InfoPoint @pointref = true @p0 = args[0] @p1 = args[1] @parent = args[2] @viewerobj = args[3] @text = args[4] @info = [@parent, @viewerobj, @text] # # when point input is just an array like: [x0, y0, z0] # LiteLine.new([x0,y0,z0], [x1,y1,z1], parent, (viewerobj), text) # elsif args.length == 5 && args[0].class == Array && args[1].class == Array @pointref = false @p0 = args[0] @p1 = args[1] @parent = args[2] @viewerobj = args[3] @text = args[4] @info = [@parent, @viewerobj, @text] else FXMessageBox.error(self,MBOX_OK,"Error", "Problem with creation of LiteLine.\nAbort current object creation") end end
Return the bounding box (an FXRangef instance) for this line.
# File liteline.rb, line 154 def bounds if @pointref FXRangef.new([@p0.pos[0][0], @p1.pos[0][0]].min, [@p0.pos[0][0], @p1.pos[0][0]].max, [@p0.pos[0][1], @p1.pos[0][1]].min, [@p0.pos[0][1], @p1.pos[0][1]].max, [@p0.pos[0][2], @p1.pos[0][2]].min, [@p0.pos[0][2], @p1.pos[0][2]].max) else FXRangef.new([@p0[0], @p1[0]].min, [@p0[0], @p1[0]].max, [@p0[1], @p1[1]].min, [@p0[1], @p1[1]].max, [@p0[2], @p1[2]].min, [@p0[2], @p1[2]].max) end end
Draw this line into viewer (an FXGLViewer instance).
# File liteline.rb, line 175 def draw(viewer) GL::Color(@red, @green, @blue) GL::PointSize(HANDLE_SIZE) GL::Begin(GL::LINES) if @pointref GL::Vertex(@p0.pos[0]) GL::Vertex(@p1.pos[0]) else GL::Vertex([@p0[0],@p0[1],@p0[2]]) GL::Vertex([@p1[0],@p1[1],@p1[2]]) end GL::End() end