using namespace std;
#include "hgeombasicshape.h"
#include "hgeomvolume.h"
#include "hgeomvector.h"
#include <iostream>
#include <iomanip>
ClassImp(HGeomBasicShape)
HGeomBasicShape::HGeomBasicShape() {
nPoints=0;
nParam=0;
param=0;
center=new HGeomTransform();
position=new HGeomTransform();
}
HGeomBasicShape::~HGeomBasicShape() {
if (param) {
delete param;
param=0;
}
if (center) {
delete center;
center=0;
}
if (position) {
delete position;
position=0;
}
}
Int_t HGeomBasicShape::readPoints(fstream* pFile,HGeomVolume* volu) {
if (!pFile) return 0;
if (volu->getNumPoints()!=nPoints) volu->createPoints(nPoints);
Double_t x,y,z;
const Int_t maxbuf=155;
Text_t buf[maxbuf];
for(Int_t i=0;i<nPoints;i++) {
pFile->getline(buf,maxbuf);
sscanf(buf,"%lf%lf%lf",&x,&y,&z);
volu->setPoint(i,x,y,z);
}
return nPoints;
}
Bool_t HGeomBasicShape::writePoints(fstream* pFile,HGeomVolume* volu) {
if (!pFile) return kFALSE;
Text_t buf[155];
for(Int_t i=0;i<volu->getNumPoints();i++) {
HGeomVector& v=*(volu->getPoint(i));
sprintf(buf,"%9.3f%10.3f%10.3f\n",v(0),v(1),v(2));
pFile->write(buf,strlen(buf));
}
return kTRUE;
}
void HGeomBasicShape::printPoints(HGeomVolume* volu) {
for(Int_t i=0;i<volu->getNumPoints();i++) {
HGeomVector& v=*(volu->getPoint(i));
printf("%9.3f%10.3f%10.3f\n",v(0),v(1),v(2));
}
}
void HGeomBasicShape::calcVoluPosition(HGeomVolume* volu,
const HGeomTransform& mTR) {
HGeomTransform& dTC=volu->getTransform();
calcVoluPosition(volu,dTC,mTR);
}
void HGeomBasicShape::posInMother(const HGeomTransform& dTC,
const HGeomTransform& mTR) {
position->setRotMatrix(center->getRotMatrix());
position->setTransVector(center->getTransVector());
position->transFrom(dTC);
position->transTo(mTR);
HGeomVector t(position->getTransVector());
position->setTransVector(t*=0.1);
}
void HGeomBasicShape::printParam() {
if (param) {
for (Int_t i=0;i<nParam;i++) cout<<param->At(i)<<" ";
cout<<'\n';
}
}
Last change: Sat May 22 12:56:10 2010
Last generated: 2010-05-22 12:56
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.