POV-Ray : Newsgroups : povray.off-topic : Vector math question.. : Re: Vector math question.. Server Time
7 Sep 2024 09:25:35 EDT (-0400)
  Re: Vector math question..  
From: Patrick Elliott
Date: 25 Aug 2008 22:11:16
Message: <48b36644$1@news.povray.org>
scott wrote:
> This should work, it totally negates the direction of the wind force if 
> hitting the "front" of the object.
> 
> objnorm = VecNorm(GetRot);
> dot = wind.x * objnorm.x + wind.y * objnorm.y + + wind.z * objnorm.z;
> if dot < 0
>   wind = -wind;
> SetForce (wind);
> 
> Or did you want only the component of the wind perpendicular to the wall 
> to be negated?
> 
> if dot < 0
>   Wind = wind - 2 * dot * objnorm;
> 
> Or did you want the component of wind perpendicular to the wall to be 
> zero (as I think John explained)?
> 
> if dot < 0
>   Wind = wind - dot * objnorm;
> 
Actually, these are helpful, especially since they explain where I got 
something wrong about what the dot product does... Nimrods on the 
explanation pages for their system describe * as the dot product 
function, but then show you doing stuff like <0.54,0.0,0.0,-0.3> * 
<1,2,3> and still ending up with a 4 argument vector, not a single 
float... Real confusing if you don't know how dumb it is.

As for what I would like to do. Either a) make the component 
perpendicular to the wall zero, *OR* a better option, since such things 
still billow and move when blow on directly too, "reverse" the part 
perpendicular to the wall, so it acts as though the wind was blowing 
from the opposite direction. Thus, either one of your last two solution 
is the right one. Well, except for the lame ass fact that I am not sure 
I can multiply a vector and a number and get a vector, instead of the 
engine whining about invalid types.. However, I think that only happens, 
absurdly enough, when multiplying two non-rotation vectors (i.e., those 
not yet converted to quaternions. A conversion that, ironically, would 
render the information worthless in the context I need to use it, since 
the force vector isn't a rotation... :p)

Anyway. Thanks. I kind of figured that doubling the value would reverse 
it, rather than just zeroing it, but the two contradictory definitions 
of what the frack dot product meant was throwing me off. Now that I 
think of what it actually does, its bloody obvious.

-- 
void main () {

     if version = "Vista" {
       call slow_by_half();
       call DRM_everything();
     }
     call functional_code();
   }
   else
     call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models, 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.