本文整理汇总了C++中Vec3::Assume方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec3::Assume方法的具体用法?C++ Vec3::Assume怎么用?C++ Vec3::Assume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vec3
的用法示例。
在下文中一共展示了Vec3::Assume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CrossProduct
//
// LookAtRH
//
bool Mat4::LookAtRH( const Vec3<float>& Eye, const Vec3<float>& At, const Vec3<float>& _Up )
{
#ifdef _DEBUG
_Up.Assume();
#endif
Vec3<float> Dir = Eye - At; // RHS
Dir.Normalize();
Vec3<float> Side = CrossProduct( _Up, Dir );
Side.Normalize();
Vec3<float> Up = CrossProduct( Dir, Side );
m[ 0 ][ 0 ] = Side.x;
m[ 1 ][ 0 ] = Side.y;
m[ 2 ][ 0 ] = Side.z;
m[ 3 ][ 0 ] = -DotProduct( Side, Eye );
m[ 0 ][ 1 ] = Up.x;
m[ 1 ][ 1 ] = Up.y;
m[ 2 ][ 1 ] = Up.z;
m[ 3 ][ 1 ] = -DotProduct( Up, Eye );
m[ 0 ][ 2 ] = Dir.x;
m[ 1 ][ 2 ] = Dir.y;
m[ 2 ][ 2 ] = Dir.z;
m[ 3 ][ 2 ] = -DotProduct( Dir, Eye );
m[ 0 ][ 3 ] = 0.0f;
m[ 1 ][ 3 ] = 0.0f;
m[ 2 ][ 3 ] = 0.0f;
m[ 3 ][ 3 ] = 1.0f;
return true;
}
示例2: Radians
//
// RotationAroundAxis
//
void Mat4::RotationAroundAxis( const Vec3<float>& Axis, float Angle )
{
// x^2 + (1 - x^2) * cos(a) => x^2 + cos(a) - x^2 * cos(a) =>
// x^2 * (1 - cos(a)) + cos(a)
#ifdef _DEBUG
Axis.Assume();
#endif
float Rad = Radians( Angle );
float s = Sin( Rad );
float c = Cos( Rad );
float d = 1.0f - c;
float xs = Axis.x * s;
float ys = Axis.y * s;
float zs = Axis.z * s;
float xyd = Axis.x * Axis.y * d;
float xzd = Axis.x * Axis.z * d;
float yzd = Axis.y * Axis.z * d;
m[ 0 ].x = Axis.x * Axis.x * d + c;
m[ 0 ].y = xyd + zs;
m[ 0 ].z = xzd - ys;
m[ 0 ].w = 0.0f;
m[ 1 ].x = xyd - zs;
m[ 1 ].y = Axis.y * Axis.y * d + c;
m[ 1 ].z = yzd + xs;
m[ 1 ].w = 0.0f;
m[ 2 ].x = xzd + ys;
m[ 2 ].y = yzd - xs;
m[ 2 ].z = Axis.z * Axis.z * d + c;
m[ 2 ].w = 0.0f;
m[ 3 ].x = 0.0f;
m[ 3 ].y = 0.0f;
m[ 3 ].z = 0.0f;
m[ 3 ].w = 1.0f;
}