ROOT logo
//*-- Author : M. Sanchez
//*-- Modified : 07.03.2001

#include "hgeommatrix.h"

//_HADES_CLASS_DESCRIPTION 
////////////////////////////////////////////////////////
// HGeomMatrix
//
//   Simple 3D matrix interface for use with HGeomVector.
//   
//   Note:
//     This class is completely incomplete. Features will be
//     added as needed
/////////////////////////////////////////////////////////


HGeomMatrix::HGeomMatrix(void) {
  // Initializes the matrix to 0
  for (Int_t i=0;i<9;i++) fM[i]=0.0;
}

HGeomMatrix::~HGeomMatrix(void) {
}

Double_t HGeomMatrix::det(void) {
  // Computes de determinat of the 3D matrix
  return (fM[0] * fM[4] * fM[8] + fM[1] * fM[5] * fM[6] + fM[3] *fM[7] * fM[2] -
	  fM[2] * fM[4] * fM[6] - fM[1] * fM[3] * fM[8] - fM[5] *fM[7] * fM[0]);
}

HGeomVector HGeomMatrix::operator*(HGeomVector &v) {
  // Matrix multiplication
  HGeomVector vo;
  vo.setX(fM[0] * v.getX() + fM[1] * v.getY() + fM[2] * v.getZ());
  vo.setY(fM[3] * v.getX() + fM[4] * v.getY() + fM[5] * v.getZ());
  vo.setZ(fM[6] * v.getX() + fM[7] * v.getY() + fM[8] * v.getZ());
  return vo;
}

HGeomMatrix &HGeomMatrix::operator/=(Double_t d) {
  // Matrix division by a constant. Divides each element on the
  //matrix by the constant "d"
  for (Int_t i=0;i<9;i++) fM[i]/=d;
  return *this;
}

ClassImp(HGeomMatrix)
 hgeommatrix.cc:1
 hgeommatrix.cc:2
 hgeommatrix.cc:3
 hgeommatrix.cc:4
 hgeommatrix.cc:5
 hgeommatrix.cc:6
 hgeommatrix.cc:7
 hgeommatrix.cc:8
 hgeommatrix.cc:9
 hgeommatrix.cc:10
 hgeommatrix.cc:11
 hgeommatrix.cc:12
 hgeommatrix.cc:13
 hgeommatrix.cc:14
 hgeommatrix.cc:15
 hgeommatrix.cc:16
 hgeommatrix.cc:17
 hgeommatrix.cc:18
 hgeommatrix.cc:19
 hgeommatrix.cc:20
 hgeommatrix.cc:21
 hgeommatrix.cc:22
 hgeommatrix.cc:23
 hgeommatrix.cc:24
 hgeommatrix.cc:25
 hgeommatrix.cc:26
 hgeommatrix.cc:27
 hgeommatrix.cc:28
 hgeommatrix.cc:29
 hgeommatrix.cc:30
 hgeommatrix.cc:31
 hgeommatrix.cc:32
 hgeommatrix.cc:33
 hgeommatrix.cc:34
 hgeommatrix.cc:35
 hgeommatrix.cc:36
 hgeommatrix.cc:37
 hgeommatrix.cc:38
 hgeommatrix.cc:39
 hgeommatrix.cc:40
 hgeommatrix.cc:41
 hgeommatrix.cc:42
 hgeommatrix.cc:43
 hgeommatrix.cc:44
 hgeommatrix.cc:45
 hgeommatrix.cc:46
 hgeommatrix.cc:47
 hgeommatrix.cc:48