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

Function TriMatrixArcFromForward

trinity/TriMath.cpp:580–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578
579
580Matrix* TriMatrixArcFromForward(
581 Matrix* out,
582 const Vector3* v )
583{
584 Vector3 norm = Normalize( *v );
585 *out = IdentityMatrix();
586 if( norm.z < -0.99999f )
587 {
588 return out;
589 }
590 if( norm.z > 0.99999f )
591 {
592 out->_22 = -1.0f;
593 out->_33 = -1.0f;
594 return out;
595 }
596 const float h = ( 1.0f + norm.z ) / ( norm.x * norm.x + norm.y * norm.y );
597 out->_11 = h * norm.y * norm.y - norm.z;
598 out->_12 = -h * norm.x * norm.y;
599 out->_13 = norm.x;
600
601 out->_21 = out->_12;
602 out->_22 = h * norm.x * norm.x - norm.z;
603 out->_23 = norm.y;
604
605 out->_31 = -norm.x;
606 out->_32 = -norm.y;
607 out->_33 = -norm.z;
608 ;
609 //*out = tempMat;
610 return out;
611}
612
613Matrix* TriMatrixTranslate( Matrix* out, const Matrix* m, const Vector3* v )
614{

Callers 1

PrepareRenderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected