TABLE OF CONTENTS


::pwtk::scaleVec

SYNOPSIS

proc ::pwtk::scaleVec {args} {

USAGE

   ::pwtk::scaleVec scale_x ?scale_y? ?scale_z? vecs

PURPOSE

Scale (lattice) 3D vectors

ARGUMENTS

SOURCE

    if { [ llength $args] < 2 || [llength $args] > 4 } {
        ::pwtk::error "wrong number of arguments, must be:   pwtk::scaleVec scale_x ?scale_y? ?scale_z? vectors" 1
    }

    # parse args

    set nargs [llength $args]
    
    set scale(0) [lindex $args 0]
    set scale(1) $scale(0)
    set scale(2) $scale(0)

    for {set i 1} {$i < $nargs-1} {incr i} {
        set scale($i) [lindex $args $i]
    }
    
    set vec [lindex $args end]

    # scale vectors

    set nl {}
    set result {}
    foreach {x y z} $vec {
        append result "$nl[expr $scale(0) * $x]   [expr $scale(1) * $y]   [expr $scale(2) * $z]"
        set nl \n
    }
    
    return $result
}