pwu::Vector3 affine s vec1 vec2 |
Return a vector that is the affine combination of two vectors
Parameters
s | the affine scalar |
vec1 | the first vector |
vec2 | the second vector |
Returns
A linearly interpolated point along the directed line from vec1 to vec2. An s of 0.0 returns vec1 and and s of 1.0 returns vec2. Values of s less than 0.0 and greater than 1.0 are valid. When s is less than 0.0, the point returned would be before vec1. When s is greater than 1.0, the point returned would be after vec2.
Example
Code
# Capture extents of all database entities
lassign [pw::Database getExtents] minExt maxExt
# Compute extents centroid
set centroidPt [pwu::Vector3 affine 0.5 $minExt $maxExt]
# Enlarge extents diagonal by 10%
set minExt10 [pwu::Vector3 affine -0.1 $minExt $maxExt]
set maxExt10 [pwu::Vector3 affine 1.1 $minExt $maxExt]
puts "minExt : [list $minExt]"
puts "maxExt : [list $maxExt]"
puts "centroidPt : [list $centroidPt]"
puts "minExt10 : [list $minExt10]"
puts "maxExt10 : [list $maxExt10]"
Output
minExt : {10.000170704427509 -14.405848937908303 -9.049999999999983}
maxExt : {40.0 65.59615106209186 50.95000000000002}
centroidPt : {25.000085352213755 25.59515106209178 20.950000000000017}
minExt10 : {7.000187774870261 -22.40604893790832 -15.049999999999985}
maxExt10 : {42.99998292955725 73.59635106209188 56.950000000000024}