| 12 | { |
| 13 | |
| 14 | Matrix LineTransform( const Vector3& start, const Vector3& end ) |
| 15 | { |
| 16 | Matrix transform = IdentityMatrix(); |
| 17 | transform.GetY() = XMVector3Normalize( ( end - start ) * 0.5 ); |
| 18 | if( std::abs( transform.GetY().x ) > 0.9f ) |
| 19 | { |
| 20 | transform.GetX() = Vector3( 0, 0, 1 ); |
| 21 | } |
| 22 | else |
| 23 | { |
| 24 | transform.GetX() = Vector3( 1, 0, 0 ); |
| 25 | } |
| 26 | transform.GetZ() = XMVector3Normalize( XMVector3Cross( transform.GetX(), transform.GetY() ) ); |
| 27 | transform.GetX() = XMVector3Cross( transform.GetY(), transform.GetZ() ); |
| 28 | transform.GetTranslation() = ( start + end ) * 0.5; |
| 29 | return transform; |
| 30 | } |
| 31 | |
| 32 | Vector2 LineNormal( const Vector2& p0, const Vector2& p1 ) |
| 33 | { |
no test coverage detected