class Fox::FXGLLine
OpenGL line object
Attributes
Starting point for line [FXGLPoint]
End point for line [FXGLPoint]
Public Class Methods
Source
# File lib/fox16/glshapes.rb, line 91 def initialize(*args) super() if args.length == 0 @fm = FXGLPoint.new(-0.5, 0.0, 0.0) @to = FXGLPoint.new( 0.5, 0.0, 0.0) elsif args.length == 1 @fm = args[0].fm @to = args[0].to else @fm = FXGLPoint.new(args[0], args[1], args[2]) @to = FXGLPoint.new(args[3], args[4], args[5]) end end
Return an initialized FXGLLine instance.
If no arguments are passed to new, the initial starting and ending points for the line are (-0.5, 0.0, 0.0) and (0.5, 0.0, 0.0), respectively. You can specify different initial start and end points by passing in another FXGLLine instance from which to copy the start and end point values, e.g.
aLine = FXGLLine.new(anotherLine)
or by passing in the x, y and z coordinates individually:
aLine = FXGLLine.new(x0, y0, z0, x1, y1, z1)
Calls superclass method
Fox::FXGLObject::new
Public Instance Methods
Source
# File lib/fox16/glshapes.rb, line 108 def bounds FXRangef.new([@fm.pos[0], @to.pos[0]].min, [@fm.pos[0], @to.pos[0]].max, [@fm.pos[1], @to.pos[1]].min, [@fm.pos[1], @to.pos[1]].max, [@fm.pos[2], @to.pos[2]].min, [@fm.pos[2], @to.pos[2]].max) end
Return the bounding box (an FXRangef instance) for this line.
Source
# File lib/fox16/glshapes.rb, line 120 def draw(viewer) GL.Color3d(1.0, 0.0, 0.0) GL.PointSize(HANDLE_SIZE) GL.Begin(GL::LINES) GL.Vertex3d(*@fm.pos) GL.Vertex3d(*@to.pos) GL.End() end
Draw this line into viewer (an FXGLViewer instance).
Source
# File lib/fox16/glshapes.rb, line 132 def hit(viewer) GL.Begin(GL::LINES) GL.Vertex3d(*@fm.pos) GL.Vertex3d(*@to.pos) GL.End() end
Perform hit-test for this line in viewer (an FXGLViewer instance).