src/jwm_draw_framing/draw_framing.rb
##------------------
## Add a translation vector to a transformation
Add a translation vector to a transformation
Add a translation vector to a transformation
def translate( *args ) 
    trans = args[0]
    if args.length == 2
        vec = args[1]
        r = vec[0]; g = vec[1]; b = vec[2] 
    else
        r = args[1]; g = args[2]; b = args[3] 
    end
    arr = trans.to_a()
    arr[12] += r; arr[13] += g; arr[14] += b 
    return Geom::Transformation.new( arr )
	end
def translate ( * args ) trans = args [ 0 ] if args . length == 2 vec = args [ 1 ] r = vec [ 0 ] ; g = vec [ 1 ] ; b = vec [ 2 ] else r = args [ 1 ] ; g = args [ 2 ] ; b = args [ 3 ] end arr = trans . to_a ( ) arr [ 12 ] += r ; arr [ 13 ] += g ; arr [ 14 ] += b return Geom :: Transformation . new ( arr ) end
Add a translation vector to a transformation
Add a translation vector to a transformation
## From Martin Rinehart 'Edges to Rubies' chapter 15 ## May be called with a transformation and a vector,  ## or with a transformation and r, g, b values.
args
<not_specific>