home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2006 April / SGP.iso / dema / Keepsake-Demo-en-li-v1.0.exe / res / bin / common / math.tcl < prev    next >
Text File  |  2005-10-29  |  486b  |  22 lines

  1. proc wizClamp { t min max } {
  2.   if { $t < $min } { 
  3.     set t $min
  4.   } elseif { $t > $max } { 
  5.     set t $max
  6.   }
  7.   return $t
  8. }
  9.  
  10. proc wizRelative { t p1 q1 p2 q2 } {
  11.   return [expr (($q2 - $p2)/($q1 - $p1)) * ($t - $p1) + $p2]
  12. }
  13.  
  14. proc wizMinPosition { p d } {
  15.   set o [wizEntityGetPosition Lydia]
  16.   if { [getPlayerDistFrom [lindex $p 0] [lindex $p 1] [lindex $p 2]] < [expr $d + 1] } {
  17.     return $o
  18.   }
  19.   return [vector::vexpr {$p - (normalize($p - $o) * $d)}]
  20. }
  21.  
  22.