Base: [skip ci] add class ViewOrthoProjMatrix for orthogonal projections in 3d
This commit is contained in:
@@ -191,3 +191,41 @@ Vector3d ViewProjMatrix::inverse (const Vector3d& src) const
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ViewOrthoProjMatrix::ViewOrthoProjMatrix (const Matrix4D &rclMtx)
|
||||
: _clMtx(rclMtx)
|
||||
{
|
||||
_clMtxInv = _clMtx;
|
||||
_clMtxInv.inverse();
|
||||
}
|
||||
|
||||
ViewOrthoProjMatrix::~ViewOrthoProjMatrix()
|
||||
{
|
||||
}
|
||||
|
||||
Matrix4D ViewOrthoProjMatrix::getProjectionMatrix (void) const
|
||||
{
|
||||
return _clMtx;
|
||||
}
|
||||
|
||||
Vector3f ViewOrthoProjMatrix::operator()(const Vector3f &rclPt) const
|
||||
{
|
||||
return Vector3f(_clMtx * rclPt);
|
||||
}
|
||||
|
||||
Vector3d ViewOrthoProjMatrix::operator()(const Vector3d &rclPt) const
|
||||
{
|
||||
return Vector3d(_clMtx * rclPt);
|
||||
}
|
||||
|
||||
Vector3f ViewOrthoProjMatrix::inverse (const Vector3f &rclPt) const
|
||||
{
|
||||
return Vector3f(_clMtxInv * rclPt);
|
||||
}
|
||||
|
||||
Vector3d ViewOrthoProjMatrix::inverse (const Vector3d &rclPt) const
|
||||
{
|
||||
return Vector3d(_clMtxInv * rclPt);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,29 @@ protected:
|
||||
Matrix4D _clMtx, _clMtxInv;
|
||||
};
|
||||
|
||||
/**
|
||||
* The ViewOrthoProjMatrix class returns the result of the multiplication
|
||||
* of the 3D vector and the transformation matrix.
|
||||
* Unlike ViewProjMatrix this class is not supposed to project points onto
|
||||
* a viewport but project points onto a plane in 3D.
|
||||
*/
|
||||
class BaseExport ViewOrthoProjMatrix : public ViewProjMethod
|
||||
{
|
||||
public:
|
||||
ViewOrthoProjMatrix (const Matrix4D &rclMtx);
|
||||
virtual ~ViewOrthoProjMatrix();
|
||||
|
||||
Vector3f operator()(const Vector3f &rclPt) const;
|
||||
Vector3d operator()(const Vector3d &rclPt) const;
|
||||
Vector3f inverse (const Vector3f &rclPt) const;
|
||||
Vector3d inverse (const Vector3d &rclPt) const;
|
||||
|
||||
Matrix4D getProjectionMatrix (void) const;
|
||||
|
||||
protected:
|
||||
Matrix4D _clMtx, _clMtxInv;
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
|
||||
#endif // BASE_VIEWPROJ_H
|
||||
|
||||
Reference in New Issue
Block a user