Пример #1
0
Wml::Vector2f ExpMapGenerator::ComputeSurfaceVector( ExpMapParticle * pCenterParticle, 
																 ExpMapParticle * pNbrParticle,
																 ExtPlane3f & vTangentPlane, 
																 Frame3f & vCenterWorldFrame, 
																 Wml::Matrix2f & matFrameRotate )
{
	// special case...
	if ( (pNbrParticle->Position() - pCenterParticle->Position()).Length() < Wml::Mathf::EPSILON )
		return pCenterParticle->SurfaceVector();

	// project point into plane
	Wml::Vector3f vPlanePoint = vTangentPlane.RotatePointIntoPlane( pNbrParticle->Position() );

	// project point into coord system of frame
	vPlanePoint -= pCenterParticle->Position();
	vCenterWorldFrame.ToFrameLocal(vPlanePoint);

	// now we can project into surface frame simply by dropping z (which should be 0 anyway,
	//   since the vector lies in the plane!)
	Wml::Vector2f vSurfaceFrame( vPlanePoint.X(), vPlanePoint.Y() );

	// reverse vector so it points back to current particle
	vSurfaceFrame *= -1.0f;

	// transform local vector into coord system of initial surface reference frame
	//  and add accumulated surface vector
	return pCenterParticle->SurfaceVector() + (matFrameRotate * vSurfaceFrame);
}
Пример #2
0
Wml::Vector3d rms::VectorCastfd( const Wml::Vector3f & vec )
{
	return Wml::Vector3d( (double)vec.X(), (double)vec.Y(), (double)vec.Z() );
}