109 :
TGeoTube(param[1],param[3],param[0])
146 Error(
"ComputeBBox",
"Shape %s hyperbolic surfaces are malformed: rin=%g, stin=%g, rout=%g, stout=%g",
161 Double_t rsq = point[0]*point[0]+point[1]*point[1];
169 if (i==0 || r<1.
E-10) {
170 norm[0] = norm[1] = 0.;
185 if (norm[0]*dir[0]+norm[1]*dir[1]+norm[2]*dir[2]<0) {
198 Double_t r2 = point[0]*point[0]+point[1]*point[1];
200 if (r2>routsq)
return kFALSE;
203 if (r2<rinsq)
return kFALSE;
221 if (iact<3 && safe) {
230 sz = (
fDz-point[2])/dir[2];
231 if (sz<=0.)
return 0.;
234 sz = -(
fDz+point[2])/dir[2];
235 if (sz<=0.)
return 0.;
248 if (npos) srin = s[0];
250 if (npos) srout = s[0];
261 if (iact<3 && safe) {
275 if ((point[2]*dir[2]) < 0) {
279 xi = point[0]+sz*dir[0];
280 yi = point[1]+sz*dir[1];
285 if (r2 <= rmax2)
return sz;
296 zi = point[2] + s[0]*dir[2];
299 zi = point[2] + s[1]*dir[2];
305 zi = point[2] + s[0]*dir[2];
308 zi = point[2] + s[1]*dir[2];
330 Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - t0*dir[2]*dir[2];
331 Double_t b = t0*point[2]*dir[2] - point[0]*dir[0] - point[1]*dir[1];
332 Double_t c = point[0]*point[0] + point[1]*point[1] - t0*point[2]*point[2] - r0*r0;
337 if (snext < 0.)
return 0;
345 if (delta < 0.)
return 0;
350 snext = (b + i*sone*delta)*ainv;
352 if (snext<0)
continue;
359 if (inner) ndotd *= -1;
361 if (ndotd<0) s[npos++] =
snext;
362 }
else s[npos++] =
snext;
373 Error(
"Divide",
"Hyperboloids cannot be divided. Division volume %s not created", divname);
412 param[0] *= param[0];
414 param[1] *= param[1];
431 if (zmax<0)
return 0;
434 Error(
"GetMakeRuntimeShape",
"Shape %s does not have negative Z range",
GetName());
446 printf(
"*** Shape %s: TGeoHype ***\n",
GetName());
447 printf(
" Rin = %11.5f\n",
fRmin);
448 printf(
" sin = %11.5f\n",
fStIn);
449 printf(
" Rout = %11.5f\n",
fRmax);
450 printf(
" sout = %11.5f\n",
fStOut);
451 printf(
" dz = %11.5f\n",
fDz);
453 printf(
" Bounding box:\n");
465 Int_t nbPnts = (hasRmin)?(2*n*n):(n*n+2);
466 Int_t nbSegs = (hasRmin)?(4*n*n):(n*(2*n+1));
467 Int_t nbPols = (hasRmin)?(2*n*n):(n*(n+1));
470 nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols);
490 Int_t irout = (hasRmin)?(n*n):2;
523 Int_t isgenin = (hasRmin)?(isin+n*n):0;
524 Int_t isout = (hasRmin)?(isgenin+n*(n-1)):0;
525 Int_t isgenout = isout+n*
n;
526 Int_t islo = isgenout+n*(n-1);
532 for (i=0; i<
n; i++) {
533 for (j=0; j<
n; j++) {
534 npt = 3*(isin+n*i+j);
536 buff.
fSegs[npt+1] = irin+n*i+j;
537 buff.
fSegs[npt+2] = irin+n*i+((j+1)%n);
541 for (i=0; i<n-1; i++) {
542 for (j=0; j<
n; j++) {
543 npt = 3*(isgenin+n*i+j);
545 buff.
fSegs[npt+1] = irin+n*i+j;
546 buff.
fSegs[npt+2] = irin+n*(i+1)+j;
551 for (i=0; i<
n; i++) {
552 for (j=0; j<
n; j++) {
553 npt = 3*(isout + n*i+j);
555 buff.
fSegs[npt+1] = irout+n*i+j;
556 buff.
fSegs[npt+2] = irout+n*i+((j+1)%n);
560 for (i=0; i<n-1; i++) {
561 for (j=0; j<
n; j++) {
562 npt = 3*(isgenout+n*i+j);
564 buff.
fSegs[npt+1] = irout+n*i+j;
565 buff.
fSegs[npt+2] = irout+n*(i+1)+j;
569 for (j=0; j<
n; j++) {
572 buff.
fSegs[npt+1] = irin;
573 if (hasRmin) buff.
fSegs[npt+1] += j;
574 buff.
fSegs[npt+2] = irout + j;
577 for (j=0; j<
n; j++) {
580 buff.
fSegs[npt+1] = irin+1;
581 if (hasRmin) buff.
fSegs[npt+1] += n*(n-1)+j-1;
582 buff.
fSegs[npt+2] = irout + n*(n-1)+j;
608 Int_t ipout = (hasRmin)?(ipin+n*(n-1)):0;
609 Int_t iplo = ipout+n*(n-1);
613 for (i=0; i<n-1; i++) {
614 for (j=0; j<
n; j++) {
615 npt = 6*(ipin+n*i+j);
617 buff.
fPols[npt+1] = 4;
618 buff.
fPols[npt+2] = isin+n*i+j;
619 buff.
fPols[npt+3] = isgenin+i*n+((j+1)%n);
620 buff.
fPols[npt+4] = isin+n*(i+1)+j;
621 buff.
fPols[npt+5] = isgenin+i*n+j;
626 for (i=0; i<n-1; i++) {
627 for (j=0; j<
n; j++) {
628 npt = 6*(ipout+n*i+j);
630 buff.
fPols[npt+1] = 4;
631 buff.
fPols[npt+2] = isout+n*i+j;
632 buff.
fPols[npt+3] = isgenout+i*n+j;
633 buff.
fPols[npt+4] = isout+n*(i+1)+j;
634 buff.
fPols[npt+5] = isgenout+i*n+((j+1)%n);
639 for (j=0; j<
n; j++) {
641 buff.
fPols[npt] = c+1;
642 buff.
fPols[npt+1] = 4;
643 buff.
fPols[npt+2] = isin+j;
644 buff.
fPols[npt+3] = islo+j;
645 buff.
fPols[npt+4] = isout+j;
646 buff.
fPols[npt+5] = islo+((j+1)%n);
648 for (j=0; j<
n; j++) {
650 buff.
fPols[npt] = c+2;
651 buff.
fPols[npt+1] = 4;
652 buff.
fPols[npt+2] = isin+n*(n-1)+j;
653 buff.
fPols[npt+3] = ishi+((j+1)%n);
654 buff.
fPols[npt+4] = isout+n*(n-1)+j;
655 buff.
fPols[npt+5] = ishi+j;
658 for (j=0; j<
n; j++) {
660 buff.
fPols[npt] = c+1;
661 buff.
fPols[npt+1] = 3;
662 buff.
fPols[npt+2] = isout+j;
663 buff.
fPols[npt+3] = islo+((j+1)%n);
664 buff.
fPols[npt+4] = islo+j;
666 for (j=0; j<
n; j++) {
667 npt = 6*iplo+5*(n+j);
668 buff.
fPols[npt] = c+2;
669 buff.
fPols[npt+1] = 3;
670 buff.
fPols[npt+2] = isout+n*(n-1)+j;
671 buff.
fPols[npt+3] = ishi+j;
672 buff.
fPols[npt+4] = ishi+((j+1)%n);
690 return (r0*r0+tsq*z*z);
707 return ((r*r-r0*r0)/tsq);
720 if (safrmin < safe) safe = safrmin;
722 if (safrmax < safe) safe = safrmax;
726 if (safrmin > safe) safe = safrmin;
728 if (safrmax > safe) safe = safrmax;
741 rsq = point[0]*point[0]+point[1]*point[1];
777 out <<
" rin = " <<
fRmin <<
";" << std::endl;
778 out <<
" stin = " <<
fStIn <<
";" << std::endl;
779 out <<
" rout = " <<
fRmax <<
";" << std::endl;
780 out <<
" stout = " <<
fStOut <<
";" << std::endl;
781 out <<
" dz = " <<
fDz <<
";" << std::endl;
782 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoHype(\"" <<
GetName() <<
"\",rin,stin,rout,stout,dz);" << std::endl;
839 for (i=0; i<
n; i++) {
842 for (j=0; j<
n; j++) {
852 points[indx++] = -
fDz;
855 points[indx++] =
fDz;
858 for (i=0; i<
n; i++) {
861 for (j=0; j<
n; j++) {
887 for (i=0; i<
n; i++) {
890 for (j=0; j<
n; j++) {
900 points[indx++] = -
fDz;
903 points[indx++] =
fDz;
906 for (i=0; i<
n; i++) {
909 for (j=0; j<
n; j++) {
925 nvert = (hasRmin)?(2*n*n):(n*n+2);
926 nsegs = (hasRmin)?(4*n*n):(n*(2*n+1));
927 npols = (hasRmin)?(2*n*n):(n*(n+1));
959 Int_t nbPnts = (hasRmin)?(2*n*n):(n*n+2);
960 Int_t nbSegs = (hasRmin)?(4*n*n):(n*(2*n+1));
961 Int_t nbPols = (hasRmin)?(2*n*n):(n*(n+1));
962 if (buffer.
SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPols, 6*nbPols)) {
986 for (
Int_t i=0; i<vecsize; i++) inside[i] =
Contains(&points[3*i]);
1004 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
1012 for (
Int_t i=0; i<vecsize; i++) dists[i] =
DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
1022 for (
Int_t i=0; i<vecsize; i++) safe[i] =
Safety(&points[3*i], inside[i]);
virtual ~TGeoHype()
destructor
Double_t ZHypeSq(Double_t r, Bool_t inner) const
Compute z^2 at a given r^2, for either inner or outer hyperbolas.
Int_t DistToHype(const Double_t *point, const Double_t *dir, Double_t *s, Bool_t inner, Bool_t in) const
Compute distance from an arbitrary point to inner/outer surface of hyperboloid.
#define snext(osub1, osub2)
Geometrical transformation package.
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
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...
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
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.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Short_t Min(Short_t a, Short_t b)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void InspectShape() const
Prints shape parameters.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static Double_t Tolerance()
virtual void ComputeBBox()
Compute bounding box of the hyperboloid.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetHypeDimensions(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Set dimensions of the hyperboloid.
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.
constexpr Double_t DegToRad()
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
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 hyperboloid.
Double_t ATan2(Double_t, Double_t)
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Cannot divide hyperboloids.
void SetSectionsValid(UInt_t mask)
virtual void Sizeof3D() const
fill size of this 3-D object
const char * GetPointerName() const
Provide a pointer name containing uid.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
virtual const char * GetName() const
Get the shape name.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Double_t SafetyToHype(const Double_t *point, Bool_t inner, Bool_t in) const
Compute an underestimate of the closest distance from a point to inner or outer infinite hyperbolas...
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 void SetDimensions(Double_t *param)
Set dimensions of the hyperboloid starting from an array.
Double_t RadiusHypeSq(Double_t z, Bool_t inner) const
Compute r^2 = x^2 + y^2 at a given z coordinate, for either inner or outer hyperbolas.
Hyperboloid class defined by 5 parameters.
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
#define isin(address, start, length)
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 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.
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 TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
TGeoHype()
Default constructor.
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.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
Bool_t TestShapeBit(UInt_t f) const
static constexpr double s
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
virtual void SetPoints(Double_t *points) const
create tube mesh points
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
you should not use this method at all Int_t Int_t z
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 Double_t Capacity() const
Computes capacity of the shape in [length^3].
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 GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
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 void InspectShape() const
print shape parameters
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...
Double_t Sqrt(Double_t x)
Long64_t LocMin(Long64_t n, const T *a)
static constexpr double sr
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...
Int_t GetBasicColor() const
Get the basic color (0-7).
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this tube
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 hyperboloid.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.