MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / ViewProjMatrix

Method ViewProjMatrix

src/Base/ViewProj.cpp:81–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79//-----------------------------------------------------------------------------
80
81ViewProjMatrix::ViewProjMatrix(const Matrix4D& rclMtx)
82 : _clMtx(rclMtx)
83{
84 double m30 = _clMtx[3][0];
85 double m31 = _clMtx[3][1];
86 double m32 = _clMtx[3][2];
87 double m33 = _clMtx[3][3];
88 isOrthographic = (m30 == 0.0 && m31 == 0.0 && m32 == 0.0 && m33 == 1.0);
89
90 // Only for orthographic projection mode we can compute a single
91 // matrix performing all steps.
92 // For perspective projection the scaling and translation must
93 // be done afterwards because it depends on the input point.
94 if (isOrthographic) {
95 // Scale from [-1,1] to [0,1]
96 // As done in OpenInventor sources (see SbDPViewVolume::projectToScreen)
97 _clMtx.scale(0.5, 0.5, 0.5);
98 _clMtx.move(0.5, 0.5, 0.5);
99 }
100
101 _clMtxInv = _clMtx;
102 _clMtxInv.inverseGauss();
103}
104
105Matrix4D ViewProjMatrix::getProjectionMatrix() const
106{

Callers

nothing calls this directly

Calls 3

inverseGaussMethod · 0.80
scaleMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected