MCPcopy Create free account
hub / github.com/carbonengine/trinity / LineTransform

Function LineTransform

trinity/Tr2DebugRenderer.cpp:14–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12{
13
14Matrix 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
32Vector2 LineNormal( const Vector2& p0, const Vector2& p1 )
33{

Callers 6

DrawCylinderMethod · 0.85
DrawConeMethod · 0.85
DrawCapsuleMethod · 0.85
DrawArrowMethod · 0.85
DrawDoubleArrowMethod · 0.85
DrawSphereArrowMethod · 0.85

Calls 5

GetTranslationMethod · 0.80
Vector3Class · 0.70
GetYMethod · 0.45
GetXMethod · 0.45
GetZMethod · 0.45

Tested by

no test coverage detected