ROOT
6.07/01
Reference Guide
|
16 component (4x4) transform matrix - column MAJOR as per GL.
Provides limited support for adjusting the translation, scale and rotation components.
This is part of collection of simple utility classes for GL only in TGLUtil.h/cxx. These provide const and non-const accessors Arr() & CArr() to a GL compatible internal field - so can be used directly with OpenGL C API calls - which TVector3 etc cannot (easily). They are not intended to be fully featured just provide minimum required.
Public Member Functions | |
TGLMatrix () | |
Construct default identity matrix: More... | |
TGLMatrix (Double_t x, Double_t y, Double_t z) | |
Construct matrix with translation components x,y,z: More... | |
TGLMatrix (const TGLVertex3 &translation) | |
Construct matrix with translation components x,y,z: More... | |
TGLMatrix (const TGLVertex3 &origin, const TGLVector3 &zAxis, const TGLVector3 &xAxis) | |
Construct matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'. More... | |
TGLMatrix (const TGLVertex3 &origin, const TGLVector3 &zAxis) | |
Construct matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'. More... | |
TGLMatrix (const Double_t vals[16]) | |
Construct matrix using the 16 Double_t 'vals' passed, ordering is maintained - i.e. More... | |
TGLMatrix (const TGLMatrix &other) | |
Construct matrix from 'other'. More... | |
virtual | ~TGLMatrix () |
Destroy matrix object. More... | |
TGLMatrix & | operator= (const TGLMatrix &rhs) |
Double_t & | operator[] (Int_t index) |
Double_t | operator[] (Int_t index) const |
void | MultRight (const TGLMatrix &rhs) |
Multiply with matrix rhs on right. More... | |
void | MultLeft (const TGLMatrix &lhs) |
Multiply with matrix lhs on left. More... | |
TGLMatrix & | operator*= (const TGLMatrix &rhs) |
void | Set (const TGLVertex3 &origin, const TGLVector3 &zAxis, const TGLVector3 &xAxis=0) |
Set matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'. More... | |
void | Set (const Double_t vals[16]) |
Set matrix using the 16 Double_t 'vals' passed, ordering is maintained - i.e. More... | |
void | SetIdentity () |
Set matrix to identity. More... | |
void | SetTranslation (Double_t x, Double_t y, Double_t z) |
Set matrix translation components x,y,z. More... | |
void | SetTranslation (const TGLVertex3 &translation) |
Set matrix translation components x,y,z. More... | |
void | Translate (const TGLVector3 &vect) |
Shift matrix translation components by 'vect' in parent frame. More... | |
void | MoveLF (Int_t ai, Double_t amount) |
Translate in local frame. More... | |
void | Move3LF (Double_t x, Double_t y, Double_t z) |
Translate in local frame along all base vectors simultaneously. More... | |
void | Scale (const TGLVector3 &scale) |
Set matrix axis scales to 'scale'. More... | |
void | Rotate (const TGLVertex3 &pivot, const TGLVector3 &axis, Double_t angle) |
Update matrix so resulting transform has been rotated about 'pivot' (in parent frame), round vector 'axis', through 'angle' (radians) Equivalent to glRotate function, but with addition of translation and compounded on top of existing. More... | |
void | RotateLF (Int_t i1, Int_t i2, Double_t amount) |
Rotate in local frame. More... | |
void | RotatePF (Int_t i1, Int_t i2, Double_t amount) |
Rotate in parent frame. Does optimised version of MultLeft. More... | |
void | TransformVertex (TGLVertex3 &vertex) const |
Transform passed 'vertex' by this matrix - converts local frame to parent. More... | |
void | Transpose3x3 () |
Transpose the top left 3x3 matrix component along major diagonal Supported as currently incompatibility between TGeo and GL matrix layouts for this 3x3 only. More... | |
Double_t | Invert () |
Invert the matrix, returns determinant. More... | |
TGLVector3 | GetTranslation () const |
Return the translation component of matrix. More... | |
TGLVector3 | GetScale () const |
Get local axis scaling factors. More... | |
Bool_t | IsScalingForRender () const |
Return true if matrix is to be considered a scaling matrix for rendering. More... | |
void | SetBaseVec (Int_t b, Double_t x, Double_t y, Double_t z) |
void | SetBaseVec (Int_t b, const TGLVector3 &v) |
void | SetBaseVec (Int_t b, Double_t *x) |
TGLVector3 | GetBaseVec (Int_t b) const |
void | GetBaseVec (Int_t b, TGLVector3 &v) const |
void | GetBaseVec (Int_t b, Double_t *x) const |
TGLVector3 | Multiply (const TGLVector3 &v, Double_t w=1) const |
Multiply vector. More... | |
TGLVector3 | Rotate (const TGLVector3 &v) const |
Rotate vector. Translation is not applied. More... | |
void | MultiplyIP (TGLVector3 &v, Double_t w=1) const |
Multiply vector in-place. More... | |
void | RotateIP (TGLVector3 &v) const |
Rotate vector in-place. Translation is not applied. More... | |
const Double_t * | CArr () const |
Double_t * | Arr () |
void | Dump () const |
Output 16 matrix components to std::cout. More... | |
ClassDef (TGLMatrix, 1) | |
Private Member Functions | |
Bool_t | ValidIndex (UInt_t index) const |
Private Attributes | |
Double_t | fVals [16] |
#include <TGLUtil.h>
TGLMatrix::TGLMatrix | ( | ) |
Construct default identity matrix:
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Definition at line 634 of file TGLUtil.cxx.
Construct matrix with translation components x,y,z:
1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1
Definition at line 647 of file TGLUtil.cxx.
TGLMatrix::TGLMatrix | ( | const TGLVertex3 & | translation | ) |
Construct matrix with translation components x,y,z:
1 0 0 translation.X() 0 1 0 translation.Y() 0 0 1 translation.Z() 0 0 0 1
Definition at line 661 of file TGLUtil.cxx.
TGLMatrix::TGLMatrix | ( | const TGLVertex3 & | origin, |
const TGLVector3 & | zAxis, | ||
const TGLVector3 & | xAxis | ||
) |
Construct matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'.
Both 'origin' and 'zAxisVec' are expressed in the parent frame
Definition at line 696 of file TGLUtil.cxx.
TGLMatrix::TGLMatrix | ( | const TGLVertex3 & | origin, |
const TGLVector3 & | zAxis | ||
) |
Construct matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'.
Both 'origin' and 'zAxisVec' are expressed in the parent frame
Definition at line 672 of file TGLUtil.cxx.
TGLMatrix::TGLMatrix | ( | const Double_t | vals[16] | ) |
Construct matrix using the 16 Double_t 'vals' passed, ordering is maintained - i.e.
should be column major as we are
Definition at line 707 of file TGLUtil.cxx.
TGLMatrix::TGLMatrix | ( | const TGLMatrix & | other | ) |
Construct matrix from 'other'.
Definition at line 715 of file TGLUtil.cxx.
|
virtual |
Destroy matrix object.
Definition at line 723 of file TGLUtil.cxx.
|
inline |
Definition at line 668 of file TGLUtil.h.
Referenced by TGLPerspectiveCamera::Apply(), TGLOrthoCamera::Apply(), TEveCaloLegoGL::DrawAxis2D(), TEveCaloLegoGL::DrawAxis3D(), TGLAxisPainterBox::DrawAxis3D(), TGLCamera::RotateRad(), and TGLCamera::UpdateCache().
|
inline |
Definition at line 667 of file TGLUtil.h.
Referenced by TEveArrowGL::DirectDraw(), TEveTextGL::DirectDraw(), TGLPhysicalShape::Draw(), TGLUtil::DrawLine(), TGLUtil::DrawRing(), TEveCaloLegoGL::SetAxis3DTitlePos(), TGLAxisPainterBox::SetAxis3DTitlePos(), TGLCamera::ViewportRect(), TGLCamera::ViewportToWorld(), and TGLCamera::WorldToViewport().
TGLMatrix::ClassDef | ( | TGLMatrix | , |
1 | |||
) |
void TGLMatrix::Dump | ( | ) | const |
Output 16 matrix components to std::cout.
0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
Definition at line 1160 of file TGLUtil.cxx.
|
inline |
Definition at line 757 of file TGLUtil.h.
Referenced by TGLPerspectiveCamera::Apply(), TGLOrthoCamera::Apply(), TEveCaloLegoGL::DirectDraw(), TGLCamera::GetTheta(), TGLCameraGuide::Render(), TGLCameraOverlay::RenderAxis(), TGLCameraOverlay::RenderBar(), TGLCameraOverlay::RenderPlaneIntersect(), TEveLegoEventHandler::Rotate(), TGLCamera::RotateArcBallRad(), TGLCamera::RotateRad(), TGLCameraOverlay::SetFrustum(), and TGLAutoRotator::Start().
|
inline |
TGLVector3 TGLMatrix::GetScale | ( | ) | const |
Get local axis scaling factors.
Definition at line 1127 of file TGLUtil.cxx.
Referenced by TGLPhysicalShape::GetScale().
TGLVector3 TGLMatrix::GetTranslation | ( | ) | const |
Return the translation component of matrix.
Definition at line 822 of file TGLUtil.cxx.
Referenced by TGLPerspectiveCamera::Apply(), TGLOrthoCamera::Apply(), TGLPhysicalShape::GetTranslation(), TGLViewer::ReinitializeCurrentCamera(), TGLCameraOverlay::RenderPlaneIntersect(), TEveLegoEventHandler::Rotate(), TGLCamera::RotateArcBallRad(), and TGLCamera::RotateRad().
Double_t TGLMatrix::Invert | ( | ) |
Invert the matrix, returns determinant.
Copied from TMatrixFCramerInv.
Definition at line 999 of file TGLUtil.cxx.
Referenced by TGLCamera::SetCenterVec(), and TGLCamera::SetExternalCenter().
Bool_t TGLMatrix::IsScalingForRender | ( | ) | const |
Return true if matrix is to be considered a scaling matrix for rendering.
Definition at line 1139 of file TGLUtil.cxx.
Referenced by TGLPhysicalShape::UpdateBoundingBox().
Translate in local frame along all base vectors simultaneously.
Definition at line 850 of file TGLUtil.cxx.
Translate in local frame.
i1, i2 are axes indices: 1 ~ x, 2 ~ y, 3 ~ z.
Definition at line 841 of file TGLUtil.cxx.
Referenced by TGLPerspectiveCamera::Configure(), TGLOrthoCamera::Configure(), TGLCamera::Dolly(), TGLPerspectiveCamera::Reset(), TGLOrthoCamera::Reset(), TGLCamera::RotateArcBallRad(), TGLCamera::RotateRad(), TGLPerspectiveCamera::TGLPerspectiveCamera(), TGLAutoRotator::Timeout(), and TGLCamera::Truck().
TGLVector3 TGLMatrix::Multiply | ( | const TGLVector3 & | v, |
Double_t | w = 1 |
||
) | const |
Multiply vector.
Definition at line 1077 of file TGLUtil.cxx.
void TGLMatrix::MultiplyIP | ( | TGLVector3 & | v, |
Double_t | w = 1 |
||
) | const |
Multiply vector in-place.
Definition at line 1103 of file TGLUtil.cxx.
Referenced by TGLLightSet::StdSetupLights().
Multiply with matrix lhs on left.
Definition at line 746 of file TGLUtil.cxx.
Multiply with matrix rhs on right.
Definition at line 730 of file TGLUtil.cxx.
Referenced by operator*=().
void TGLMatrix::Rotate | ( | const TGLVertex3 & | pivot, |
const TGLVector3 & | axis, | ||
Double_t | angle | ||
) |
Update matrix so resulting transform has been rotated about 'pivot' (in parent frame), round vector 'axis', through 'angle' (radians) Equivalent to glRotate function, but with addition of translation and compounded on top of existing.
Definition at line 898 of file TGLUtil.cxx.
Referenced by TGLPhysicalShape::Rotate().
TGLVector3 TGLMatrix::Rotate | ( | const TGLVector3 & | v | ) | const |
Rotate vector. Translation is not applied.
Definition at line 1090 of file TGLUtil.cxx.
void TGLMatrix::RotateIP | ( | TGLVector3 & | v | ) | const |
Rotate vector in-place. Translation is not applied.
Definition at line 1115 of file TGLUtil.cxx.
Referenced by TGLCamera::GetTheta(), and TGLCamera::RotateRad().
Rotate in local frame.
Does optimised version of MultRight. i1, i2 are axes indices: 1 ~ x, 2 ~ y, 3 ~ z.
Definition at line 925 of file TGLUtil.cxx.
Referenced by TGLScenePad::AddHistoPhysical(), TGLCamera::RotateArcBallRad(), and TGLCamera::RotateRad().
Rotate in parent frame. Does optimised version of MultLeft.
Definition at line 942 of file TGLUtil.cxx.
Referenced by TGLCamera::RotateRad().
void TGLMatrix::Scale | ( | const TGLVector3 & | scale | ) |
Set matrix axis scales to 'scale'.
Note - this really sets the overall (total) scaling for each axis - it does NOT apply compounded scale on top of existing one
Definition at line 862 of file TGLUtil.cxx.
Referenced by TGLScenePad::AddHistoPhysical(), and TGLPhysicalShape::Scale().
void TGLMatrix::Set | ( | const TGLVertex3 & | origin, |
const TGLVector3 & | zAxis, | ||
const TGLVector3 & | xAxis = 0 |
||
) |
Set matrix which when applied puts local origin at 'origin' and the local Z axis in direction 'z'.
Both 'origin' and 'z' are expressed in the parent frame
Definition at line 764 of file TGLUtil.cxx.
Referenced by operator=(), TGLViewer::ReinitializeCurrentCamera(), TGLPhysicalShape::SetTransform(), and TGLCamera::TGLCamera().
Set matrix using the 16 Double_t 'vals' passed, ordering is maintained - i.e.
should be column major.
Definition at line 783 of file TGLUtil.cxx.
Definition at line 736 of file TGLUtil.h.
Referenced by TGLCamera::SetCenterVec(), TGLCamera::SetCenterVecWarp(), and TGLCamera::SetExternalCenter().
|
inline |
void TGLMatrix::SetIdentity | ( | ) |
Set matrix to identity.
Definition at line 793 of file TGLUtil.cxx.
Referenced by TGLPerspectiveCamera::Reset(), and TGLOrthoCamera::Reset().
Set matrix translation components x,y,z.
Definition at line 804 of file TGLUtil.cxx.
Referenced by TGLPhysicalShape::SetTranslation().
void TGLMatrix::SetTranslation | ( | const TGLVertex3 & | translation | ) |
Set matrix translation components x,y,z.
Definition at line 812 of file TGLUtil.cxx.
void TGLMatrix::TransformVertex | ( | TGLVertex3 & | vertex | ) | const |
Transform passed 'vertex' by this matrix - converts local frame to parent.
Definition at line 961 of file TGLUtil.cxx.
Referenced by TGLBoundingBox::Transform().
void TGLMatrix::Translate | ( | const TGLVector3 & | vect | ) |
Shift matrix translation components by 'vect' in parent frame.
Definition at line 830 of file TGLUtil.cxx.
Referenced by TGLScenePad::AddHistoPhysical(), and TGLPhysicalShape::Translate().
void TGLMatrix::Transpose3x3 | ( | ) |
Transpose the top left 3x3 matrix component along major diagonal Supported as currently incompatibility between TGeo and GL matrix layouts for this 3x3 only.
To be resolved.
Definition at line 975 of file TGLUtil.cxx.
Referenced by TGLPhysicalShape::TGLPhysicalShape().
|
private |
Definition at line 604 of file TGLUtil.h.
Referenced by Arr(), CArr(), GetBaseVec(), MultLeft(), MultRight(), operator=(), operator[](), and SetBaseVec().