170 Error(
"ComputeBBox",
"Shape %s hyperbolic surfaces are malformed: rin=%g, stin=%g, rout=%g, stout=%g",
GetName(),
185 Double_t rsq = point[0] * point[0] + point[1] * point[1];
193 if (i == 0 ||
r < 1.E-10) {
194 norm[0] = norm[1] = 0.;
210 if (norm[0] * dir[0] + norm[1] * dir[1] + norm[2] * dir[2] < 0) {
224 Double_t r2 = point[0] * point[0] + point[1] * point[1];
251 if (iact < 3 && safe) {
255 if ((iact == 1) && (*safe > step))
262 sz = (
fDz - point[2]) / dir[2];
267 sz = -(
fDz + point[2]) / dir[2];
296 if (iact < 3 && safe) {
300 if ((iact == 1) && (step <= *safe))
312 if ((point[2] * dir[2]) < 0) {
316 xi = point[0] + sz * dir[0];
317 yi = point[1] + sz * dir[1];
334 zi = point[2] + s[0] * dir[2];
337 else if (npos == 2) {
338 zi = point[2] + s[1] * dir[2];
345 zi = point[2] + s[0] * dir[2];
348 else if (npos == 2) {
349 zi = point[2] + s[1] * dir[2];
373 Double_t a = dir[0] * dir[0] + dir[1] * dir[1] - t0 * dir[2] * dir[2];
374 Double_t b = t0 * point[2] * dir[2] - point[0] * dir[0] - point[1] * dir[1];
375 Double_t c = point[0] * point[0] + point[1] * point[1] - t0 * point[2] * point[2] - r0 * r0;
396 snext = (
b + i * sone * delta) * ainv;
424 Error(
"Divide",
"Hyperboloids cannot be divided. Division volume %s not created", divname);
463 param[0] *= param[0];
465 param[1] *= param[1];
486 Error(
"GetMakeRuntimeShape",
"Shape %s does not have negative Z range",
GetName());
498 printf(
"*** Shape %s: TGeoHype ***\n",
GetName());
499 printf(
" Rin = %11.5f\n",
fRmin);
500 printf(
" sin = %11.5f\n",
fStIn);
501 printf(
" Rout = %11.5f\n",
fRmax);
502 printf(
" sout = %11.5f\n",
fStOut);
503 printf(
" dz = %11.5f\n",
fDz);
505 printf(
" Bounding box:\n");
517 Int_t nbPnts = (hasRmin) ? (2 *
n *
n) : (
n *
n + 2);
518 Int_t nbSegs = (hasRmin) ? (4 *
n *
n) : (
n * (2 *
n + 1));
519 Int_t nbPols = (hasRmin) ? (2 *
n *
n) : (
n * (
n + 1));
541 Int_t irout = (hasRmin) ? (
n *
n) : 2;
575 Int_t isout = (hasRmin) ? (isgenin +
n * (
n - 1)) : 0;
576 Int_t isgenout = isout +
n *
n;
577 Int_t islo = isgenout +
n * (
n - 1);
583 for (i = 0; i <
n; i++) {
584 for (j = 0; j <
n; j++) {
585 npt = 3 * (
isin +
n * i + j);
587 buff.
fSegs[npt + 1] = irin +
n * i + j;
588 buff.
fSegs[npt + 2] = irin +
n * i + ((j + 1) %
n);
592 for (i = 0; i <
n - 1; i++) {
593 for (j = 0; j <
n; j++) {
594 npt = 3 * (isgenin +
n * i + j);
596 buff.
fSegs[npt + 1] = irin +
n * i + j;
597 buff.
fSegs[npt + 2] = irin +
n * (i + 1) + j;
602 for (i = 0; i <
n; i++) {
603 for (j = 0; j <
n; j++) {
604 npt = 3 * (isout +
n * i + j);
606 buff.
fSegs[npt + 1] = irout +
n * i + j;
607 buff.
fSegs[npt + 2] = irout +
n * i + ((j + 1) %
n);
611 for (i = 0; i <
n - 1; i++) {
612 for (j = 0; j <
n; j++) {
613 npt = 3 * (isgenout +
n * i + j);
615 buff.
fSegs[npt + 1] = irout +
n * i + j;
616 buff.
fSegs[npt + 2] = irout +
n * (i + 1) + j;
620 for (j = 0; j <
n; j++) {
621 npt = 3 * (islo + j);
623 buff.
fSegs[npt + 1] = irin;
625 buff.
fSegs[npt + 1] += j;
626 buff.
fSegs[npt + 2] = irout + j;
629 for (j = 0; j <
n; j++) {
630 npt = 3 * (ishi + j);
632 buff.
fSegs[npt + 1] = irin + 1;
634 buff.
fSegs[npt + 1] +=
n * (
n - 1) + j - 1;
635 buff.
fSegs[npt + 2] = irout +
n * (
n - 1) + j;
661 Int_t ipout = (hasRmin) ? (ipin +
n * (
n - 1)) : 0;
662 Int_t iplo = ipout +
n * (
n - 1);
666 for (i = 0; i <
n - 1; i++) {
667 for (j = 0; j <
n; j++) {
668 npt = 6 * (ipin +
n * i + j);
670 buff.
fPols[npt + 1] = 4;
672 buff.
fPols[npt + 3] = isgenin + i *
n + ((j + 1) %
n);
674 buff.
fPols[npt + 5] = isgenin + i *
n + j;
679 for (i = 0; i <
n - 1; i++) {
680 for (j = 0; j <
n; j++) {
681 npt = 6 * (ipout +
n * i + j);
683 buff.
fPols[npt + 1] = 4;
684 buff.
fPols[npt + 2] = isout +
n * i + j;
685 buff.
fPols[npt + 3] = isgenout + i *
n + j;
686 buff.
fPols[npt + 4] = isout +
n * (i + 1) + j;
687 buff.
fPols[npt + 5] = isgenout + i *
n + ((j + 1) %
n);
692 for (j = 0; j <
n; j++) {
693 npt = 6 * (iplo + j);
695 buff.
fPols[npt + 1] = 4;
697 buff.
fPols[npt + 3] = islo + j;
698 buff.
fPols[npt + 4] = isout + j;
699 buff.
fPols[npt + 5] = islo + ((j + 1) %
n);
701 for (j = 0; j <
n; j++) {
702 npt = 6 * (ipup + j);
704 buff.
fPols[npt + 1] = 4;
706 buff.
fPols[npt + 3] = ishi + ((j + 1) %
n);
707 buff.
fPols[npt + 4] = isout +
n * (
n - 1) + j;
708 buff.
fPols[npt + 5] = ishi + j;
711 for (j = 0; j <
n; j++) {
712 npt = 6 * iplo + 5 * j;
714 buff.
fPols[npt + 1] = 3;
715 buff.
fPols[npt + 2] = isout + j;
716 buff.
fPols[npt + 3] = islo + ((j + 1) %
n);
717 buff.
fPols[npt + 4] = islo + j;
719 for (j = 0; j <
n; j++) {
720 npt = 6 * iplo + 5 * (
n + j);
722 buff.
fPols[npt + 1] = 3;
723 buff.
fPols[npt + 2] = isout +
n * (
n - 1) + j;
724 buff.
fPols[npt + 3] = ishi + j;
725 buff.
fPols[npt + 4] = ishi + ((j + 1) %
n);
743 return (r0 * r0 + tsq * z * z);
761 return ((
r *
r - r0 * r0) / tsq);
800 rsq = point[0] * point[0] + point[1] * point[1];
843 out <<
" rin = " <<
fRmin <<
";" << std::endl;
844 out <<
" stin = " <<
fStIn <<
";" << std::endl;
845 out <<
" rout = " <<
fRmax <<
";" << std::endl;
846 out <<
" stout = " <<
fStOut <<
";" << std::endl;
847 out <<
" dz = " <<
fDz <<
";" << std::endl;
848 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoHype(\"" <<
GetName() <<
"\",rin,stin,rout,stout,dz);"
903 dz = 2. *
fDz / (
n - 1);
909 for (i = 0; i <
n; i++) {
912 for (j = 0; j <
n; j++) {
928 for (i = 0; i <
n; i++) {
931 for (j = 0; j <
n; j++) {
952 dz = 2. *
fDz / (
n - 1);
958 for (i = 0; i <
n; i++) {
961 for (j = 0; j <
n; j++) {
977 for (i = 0; i <
n; i++) {
980 for (j = 0; j <
n; j++) {
996 nvert = (hasRmin) ? (2 *
n *
n) : (
n *
n + 2);
997 nsegs = (hasRmin) ? (4 *
n *
n) : (
n * (2 *
n + 1));
998 npols = (hasRmin) ? (2 *
n *
n) : (
n * (
n + 1));
1028 Int_t nbPnts = (hasRmin) ? (2 *
n *
n) : (
n *
n + 2);
1029 Int_t nbSegs = (hasRmin) ? (4 *
n *
n) : (
n * (2 *
n + 1));
1030 Int_t nbPols = (hasRmin) ? (2 *
n *
n) : (
n * (
n + 1));
1031 if (buffer.
SetRawSizes(nbPnts, 3 * nbPnts, nbSegs, 3 * nbSegs, nbPols, 6 * nbPols)) {
1055 for (
Int_t i = 0; i < vecsize; i++)
1066 for (
Int_t i = 0; i < vecsize; i++)
1076 for (
Int_t i = 0; i < vecsize; i++)
1086 for (
Int_t i = 0; i < vecsize; i++)
1097 for (
Int_t i = 0; i < vecsize; i++)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
R__EXTERN TGeoManager * gGeoManager
#define isin(address, start, length)
Generic 3D primitive description class.
Bool_t SectionsValid(UInt_t mask) const
void SetSectionsValid(UInt_t mask)
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.
void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from outside point to surface of the box.
void InspectShape() const override
Prints shape parameters.
A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bo...
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
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.
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
in case shape has some negative parameters, these has to be computed in order to fit the mother
Double_t ZHypeSq(Double_t r, Bool_t inner) const
Compute z^2 at a given r^2, for either inner or outer hyperbolas.
~TGeoHype() override
destructor
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Compute normal to closest surface from POINT.
void SetSegsAndPols(TBuffer3D &buff) const override
Fill TBuffer3D structure for segments and polygons.
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
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.
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Cannot divide hyperboloids.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
void ComputeBBox() override
Compute bounding box of the hyperboloid.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute closest distance from point px,py to each corner
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
void Sizeof3D() const override
fill size of this 3-D object
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.
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
Compute safe distance from each of the points in the input array.
void SetDimensions(Double_t *param) override
Set dimensions of the hyperboloid starting from an array.
void SetPoints(Double_t *points) const override
create tube mesh points
TGeoHype()
Default constructor.
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the hyperboloid.
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
void SetHypeDimensions(Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Set dimensions of the hyperboloid.
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
compute distance from outside point to surface of the hyperboloid.
void InspectShape() const override
print shape parameters
Bool_t Contains(const Double_t *point) const override
test if point is inside this tube
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
Compute distance from array of input points having directions specified by dirs. Store output in dist...
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Check the inside status for each of the points in the array.
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
Base abstract class for all shapes.
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
Int_t GetBasicColor() const
Get the basic color (0-7).
void TransformPoints(Double_t *points, UInt_t NbPoints) const
Tranform a set of points (LocalToMaster)
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
const char * GetPointerName() const
Provide a pointer name containing uid.
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
const char * GetName() const override
Get the shape name.
static Double_t Tolerance()
Bool_t TestShapeBit(UInt_t f) const
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.