TABLE OF CONTENTS


::pwtk::scaleCoor

SYNOPSIS

proc ::pwtk::scaleCoor {args} {

USAGE

   ::pwtk::scaleCoor scale_x ?scale_y? ?scale_z? coor

PURPOSE

Scale the coordinates.

ARGUMENTS

SOURCE

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

    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 coor [lindex $args end]

    set result ""
    foreach line [split $coor \n] {     
        if { [llength $line] == 4 } {   
            lassign $line sym x y z
            # we multiply by 1.0 to force the use of floating-point arithmetics (scale can be expression such as 1/2) 
            append result [format $::pwtk::fmt_coor(4) \
                               $sym [expr 1.0*$x*$scale(0)] [expr 1.0*$y*$scale(1)] [expr 1.0*$z*$scale(2)]]
        }
    }
    return $result
}