Пример #1
0
	//判读点是否在线上面(各种线的特性需要考虑)
	Bool HawkLine3D::IsPointOnLine(const HawkVector3D& oVec) const
	{
		HawkVector3D oTmp = oVec - Point;
		oTmp.Normalize();

		return (oTmp == Direction) || (oTmp == -Direction);
	}
Пример #2
0
	void HawkQuaternion::GetAsAxisAngle(HawkVector3D& vAxis,Float& fRadian) const
	{
		//cos(A/2)+sin(A/2)*(x*i+y*j+z*k)

		Float fSqrLength = X*X+Y*Y+Z*Z;
		if (fSqrLength > 0.0f)
		{
			fRadian = 2.0f*HawkMath::Acos(W);
			Float fInvLength = HawkMath::Invsqrt(fSqrLength);
			vAxis.X = X*fInvLength;
			vAxis.Y = Y*fInvLength;
			vAxis.Z = Z*fInvLength;
		}
		else
		{
			fRadian  = 0.0f;
			vAxis.X  = 1.0f;
			vAxis.Y  = 0.0f;
			vAxis.Z  = 0.0f;
		}

		vAxis.Normalize();
	}