Example #1
0
XYZf* v3fNormalize(XYZf &v)
{
	float norm;

	if ((norm=v3fModule(v))!=0)
	{
		v.x/=norm;
		v.y/=norm;
		v.z/=norm;
	}
	return(&v);
}
Example #2
0
void Piece::rotation(float theta, XYZf axe){
	this->movePiece();
	// Normalisation du vecteur directeur de l'axe
	axe = axe / v3fModule(axe);

	float passage[16];
	XYZf axe2;
	Invert44f(passage, pivot.GetRotMatrix());
	Matrix44Mul31f(&axe2, passage, &axe);

	// Axes à modifier
	XYZf view = this->pivot.GetdView();
	XYZf normale = this->pivot.GetdNorm();

	// Rotation des axes
	v3fRotate(view, axe2, theta);
	v3fRotate(normale, axe2, theta);

	// Nouvelle orientation
	this->pivot.SetOrientation(view, normale);
}
Example #3
0
double v3fCosAngle(const XYZf &v1,const XYZf &v2)
{
	return(v3fScal(v1,v2)/(v3fModule(v1)*v3fModule(v2)));
}
Example #4
0
double v3fSinAngle(const XYZf &v1,const XYZf &v2)
{
	XYZf r;
	return(v3fModule(*v3fCrossProd(v1,v2,r))/(v3fModule(v1)*v3fModule(v2)));
}