本文整理汇总了C++中IVP_U_Float_Point::inline_calc_cross_product方法的典型用法代码示例。如果您正苦于以下问题:C++ IVP_U_Float_Point::inline_calc_cross_product方法的具体用法?C++ IVP_U_Float_Point::inline_calc_cross_product怎么用?C++ IVP_U_Float_Point::inline_calc_cross_product使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVP_U_Float_Point
的用法示例。
在下文中一共展示了IVP_U_Float_Point::inline_calc_cross_product方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SweepHitsSphereOS
bool CTraceSolverSweptObject::SweepHitsSphereOS( IVP_U_Float_Point *sphereCenter, float radius )
{
// the ray is actually a line-swept-sphere with sweep object's radius
radius += m_sweepObject->Radius();
IVP_DOUBLE qrad_sum = m_rayLengthOS * 0.5f + radius;
qrad_sum *= qrad_sum;
IVP_U_Float_Point delta_vec; // quick check for ends of ray
delta_vec.subtract(sphereCenter, &m_rayCenterOS);
IVP_DOUBLE quad_center_dist = delta_vec.quad_length();
// Could a ray in any direction away from the ray center intersect this sphere?
if ( quad_center_dist >= qrad_sum )
{
return false;
}
// Is the sphere close enough to the ray at the center?
IVP_DOUBLE qsphere_rad = radius * radius;
if ( quad_center_dist < qsphere_rad )
{
return true;
}
// If this is a 0 length ray, then the conservative test is 100% accurate
if ( m_rayLengthOS > 0 )
{
// Calculate the perpendicular distance to the sphere
// The perpendicular forms a right triangle with the vector between the ray/sphere centers
// and the ray direction vector. Calculate the projection of the hypoteneuse along the perpendicular
IVP_U_Float_Point h;
h.inline_calc_cross_product(&m_rayDirOS, &delta_vec);
IVP_FLOAT quad_dist = (IVP_FLOAT)h.quad_length();
if( quad_dist < qsphere_rad )
return true;
}
return false;
}
示例2: GetVelocityAtPoint
void CPhysicsObject::GetVelocityAtPoint( const Vector &worldPosition, Vector &velocity )
{
IVP_Core *core = m_pObject->get_core();
IVP_U_Point pos;
ConvertPositionToIVP( worldPosition, pos );
IVP_U_Float_Point rotSpeed;
rotSpeed.add( &core->rot_speed, &core->rot_speed_change );
IVP_U_Float_Point av_ws;
core->get_m_world_f_core_PSI()->vmult3( &rotSpeed, &av_ws);
IVP_U_Float_Point pos_rel;
pos_rel.subtract( &pos, core->get_position_PSI());
IVP_U_Float_Point cross;
cross.inline_calc_cross_product(&av_ws,&pos_rel);
IVP_U_Float_Point speed;
speed.add(&core->speed, &cross);
speed.add(&core->speed_change);
ConvertPositionToHL( speed, velocity );
}