谁能帮我解释一下(300)

  • 主题发起人 主题发起人 deaddeadbbs
  • 开始时间 开始时间
D

deaddeadbbs

Unregistered / Unconfirmed
GUEST, unregistred user!
inline float SignedTriangleArea2D( const VECTOR2& a, const VECTOR2& b, const VECTOR2& c ){ //(+ve: cclockwise, -ve: clockwise, 0: degenerate[collinear or coincident]) return ( ( a.x - c.x ) * ( b.y - c.y ) - ( a.y - c.y ) * ( b.x - c.x ) );}inline int TestSegmentSegment2D( const VECTOR2& a, const VECTOR2& b, const VECTOR2& c, const VECTOR2& d, float& isect_coeff, VECTOR2& isect_point ){// check segment(a,b) isect against segment(c,d), coeff_ab is isect_value along ab float abd = SignedTriangleArea2D( a, b, d ), abc = SignedTriangleArea2D( a, b, c ); if ( abc * abd < EPSILON ) // abc & abd have different signs >> isect { float cda = SignedTriangleArea2D( c, d, a ), // constant area: abd - abc = cda - cdb //cdb = SignedTriangleArea2D( c, d, b ), cdb = cda + abc - abd; if ( cda * cdb < EPSILON ) // cda & cdb have different signs >> isect {// segments intersect isect_coeff = cda / ( cda - cdb ); isect_point = a + isect_coeff * ( b - a ); return 1; } } return 0; // segment not intersecting}急,盼
 
没人会吗?有开发过游戏的高手吗,帮帮忙!小弟先谢谢了!
 
没人会的,给分吧!
 
接受答案了.
 
后退
顶部