[ODE] Approximate Hydrodynamic Forces

Nate W coding at natew.com
Mon Apr 14 21:20:02 2003


On Tue, 15 Apr 2003, Ander Taylor wrote:

> I want to be able to get the speed that each face of a cube, say, is moving 
> along its own normal.  So I can apply an opposing force to each face 
> dependent on its area.  Is there an easy way to get this info?

I *think* (read as: someone correct me if I'm wrong...) that you can
derive that information from the cube's velocity vector and orientation
matrix.

Given:

Vtop, the vector of the normal of the top of the non-rotated cube
Mcube, the cube's orientation matrix 
Vvel, the cube's velocity vector

Solve for:

Vn, the normal of the rotated cube's top
Vn = MultiplyVectorByMatrix (Vtop, Mcube);

V, the result you want
V = Project (Vn, Vvel);

This assumes you have a "Project (Vector v1, Vector v2)" function that
projects v1 onto v2, e.g.:

VectorXYZ Project (VectorXYZ &vecProject, VectorXYZ &vecOnto)
{
	real rFactor = (DotProduct (vecProject, vecOnto)) / 
		(DotProduct (vecOnto, vecOnto));

	VectorXYZ vecResult = vecOnto * rFactor;

	return vecResult;
}


-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com