132 norm[0] = norm[1] = 0;
137 norm[0] = point[0]*b*
b;
138 norm[1] = point[1]*a*
a;
159 const Int_t numPoints=4*
n;
173 if (iact<3 && safe) {
180 Double_t d1=(x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);
181 Double_t d2=(x2-x0)*(x2-x0)+(y2-y0)*(y2-y0);
186 for (
Int_t i=0; i<8; i++) {
197 d2=(x2-x0)*(x2-x0)+(y2-y0)*(y2-y0);
201 d1=(x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);
215 if (dir[2]<0) snxt=-safz2/dir[2];
220 if ((xz*xz/a2+yz*yz/b2)<=1)
return snxt;
223 Double_t u=dir[0]*dir[0]*b2+dir[1]*dir[1]*a2;
224 Double_t v=point[0]*dir[0]*b2+point[1]*dir[1]*a2;
225 Double_t w=point[0]*point[0]*b2+point[1]*point[1]*a2-a2*b2;
231 if (snxt<0)
return tolerance;
243 if (iact<3 && safe) {
247 if ((x0*x0/a2+y0*y0/b2)>=1) {
252 for (
Int_t i=0; i<10; i++) {
253 phi3=(phi1+phi2)*0.5;
256 d=y3*a2*(x0-
x3)-x3*b2*(y0-y3);
260 *safe=
TMath::Sqrt((x0-x3)*(x0-x3)+(y0-y3)*(y0-y3));
278 zi = (point[2] > 0) ?
fDz : -
fDz;
280 tau = (zi-point[2])/dir[2];
284 if ((xz*xz/a2+yz*yz/b2)<1)
return tau;
290 Double_t u=dir[0]*dir[0]*b2+dir[1]*dir[1]*a2;
292 Double_t v=point[0]*dir[0]*b2+point[1]*dir[1]*a2;
293 Double_t w=point[0]*point[0]*b2+point[1]*point[1]*a2-a2*b2;
303 zi=point[2]+tau*dir[2];
307 if (tau < 0)
return 0.;
318 Error(
"Divide",
"Elliptical tubes divisions not implemented");
330 param[1] *= param[1];
343 Error(
"GetMakeRuntimeShape",
"invalid mother");
364 printf(
"*** Shape %s: TGeoEltu ***\n",
GetName());
365 printf(
" A = %11.5f\n",
fRmin);
366 printf(
" B = %11.5f\n",
fRmax);
367 printf(
" dz = %11.5f\n",
fDz);
368 printf(
" Bounding box:\n");
387 if (sqdist>onepls) in =
kFALSE;
388 else if (sqdist<onemin) in =
kTRUE;
416 safr = (dx*bct+dy*ast)/d;
430 out <<
" a = " <<
fRmin <<
";" << std::endl;
431 out <<
" b = " <<
fRmax <<
";" << std::endl;
432 out <<
" dz = " <<
fDz <<
";" << std::endl;
433 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoEltu(\"" <<
GetName() <<
"\",a,b,dz);" << std::endl;
442 if ((a<=0) || (b<0) || (dz<0)) {
481 for (j = 0; j <
n; j++) {
482 points[indx+6*
n] = points[indx] = 0;
484 points[indx+6*
n] = points[indx] = 0;
486 points[indx+6*
n] = dz;
490 for (j = 0; j <
n; j++) {
494 r2=(a2*b2)/(b2+(a2-b2)*sph*sph);
496 points[indx+6*
n] = points[indx] = r*cph;
498 points[indx+6*
n] = points[indx] = r*sph;
500 points[indx+6*
n]= dz;
543 for (j = 0; j <
n; j++) {
544 points[indx+6*
n] = points[indx] = 0;
546 points[indx+6*
n] = points[indx] = 0;
548 points[indx+6*
n] = dz;
552 for (j = 0; j <
n; j++) {
556 r2=(a2*b2)/(b2+(a2-b2)*sph*sph);
558 points[indx+6*
n] = points[indx] = r*cph;
560 points[indx+6*
n] = points[indx] = r*sph;
562 points[indx+6*
n]= dz;
582 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
605 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
623 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
631 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
641 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
virtual void SetDimensions(Double_t *param)
Set shape dimensions starting from an array.
virtual void InspectShape() const
print shape parameters
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual void SetPoints(Double_t *points) const
Create elliptical tube mesh points.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
Geometrical transformation package.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
Bool_t TestBit(UInt_t f) const
virtual void SetName(const char *name)
Set the name of the TNamed.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
virtual ~TGeoEltu()
destructor
Short_t Min(Short_t a, Short_t b)
virtual void GetBoundingCylinder(Double_t *param) const
— Fill vector param[4] with the bounding cylinder parameters.
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
in case shape has some negative parameters, these has to be computed in order to fit the mother ...
virtual void InspectShape() const
Prints shape parameters.
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
TGeoEltu()
Dummy constructor.
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static Double_t Tolerance()
static const double x2[5]
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t tau
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
compute distance from outside point to surface of the tube and safe distance
void SetSectionsValid(UInt_t mask)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
const char * GetPointerName() const
Provide a pointer name containing uid.
virtual const char * GetName() const
Get the shape name.
Int_t GetNsegments() const
Get number of segments approximating circles.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
Bool_t SectionsValid(UInt_t mask) const
Base abstract class for all shapes.
virtual Bool_t Contains(const Double_t *point) const
test if point is inside the elliptical tube
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide the shape along one axis.
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
void SetEltuDimensions(Double_t a, Double_t b, Double_t dz)
Set dimensions of the elliptical tube.
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Generic 3D primitive description class.
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
static const double x1[5]
R__EXTERN TGeoManager * gGeoManager
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
Bool_t TestShapeBit(UInt_t f) const
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each vertex
Short_t Max(Short_t a, Short_t b)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
compute distance from inside point to surface of the tube
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
virtual Int_t GetNmeshVertices() const
Returns the number of vertices on the mesh.
virtual void ComputeBBox()
compute bounding box of the tube
Double_t Sqrt(Double_t x)
double norm(double *x, double *p)
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
unsigned int r2[N_CITIES]
static const double x3[11]