212 for (
Int_t i = 0; i < 3; i++) {
213 norm[i] = point[i] -
r0[i];
221 if (dir[0] *
norm[0] + dir[1] *
norm[1] + dir[2] *
norm[2] < 0) {
263 else if (
fDphi < 360)
274 for (
Int_t i = 0; i < 3; i++)
275 p[i] =
pt[i] + t * dir[i];
286 for (
Int_t i = 0; i < 3; i++)
287 p[i] =
pt[i] + t * dir[i];
290 return ((
p[2] * dir[2] -
fR *
TMath::Sqrt(dir[0] * dir[0] + dir[1] * dir[1])) /
295 Double_t dd = (
p[0] * dir[0] +
p[1] * dir[1] +
p[2] * dir[2] - (
p[0] * dir[0] +
p[1] * dir[1]) *
fR /
rxy) /
d;
305 for (
Int_t i = 0; i < 3; i++)
306 p[i] =
pt[i] + t * dir[i];
314 (
p[0] * dir[0] +
p[1] * dir[1] +
p[2] * dir[2] - (
p[0] * dir[0] +
p[1] * dir[1]) *
fR /
rxy) /
daxis;
316 fR * (
p[0] * dir[0] +
p[1] * dir[1]) * (
p[0] * dir[0] +
p[1] * dir[1]) / (
rxy *
rxy *
rxy);
356 TGeoTubeSeg::DistFromInsideS(point, dir,
fR -
fRmax,
fR +
fRmax,
fRmax,
c1,
s1,
c2,
s2, cm,
sm,
cdfi);
418 rxy2 = point[0] * point[0] + point[1] * point[1];
447 for (i = 0; i < 3; i++)
448 pt[i] = point[i] +
snext * dir[i];
459 for (i = 0; i < 3; i++)
460 pt[i] += 0.1 * eps * dir[i];
467 dring =
TGeoTubeSeg::DistFromInsideS(
pt, dir,
fR -
fRmin,
fR +
fRmin,
fRmin,
c1,
s1,
c2,
s2, cm,
sm,
cdfi);
474 for (i = 0; i < 3; i++)
475 pt[i] = point[i] +
snext * dir[i];
484 for (i = 0; i < 3; i++)
485 pt[i] += 0.1 * eps * dir[i];
500 for (i = 0; i < 3; i++)
501 pt[i] = point[i] +
snext * dir[i];
523 case 2:
return "PHI";
525 default:
return "UNDEFINED";
548 case 3:
dx = 0;
return dx;
572 Error(
"GetMakeRuntimeShape",
"parametrized toruses not supported");
587 printf(
" Bounding box:\n");
648 for (i = 0; i <
n; i++) {
649 for (
j = 0;
j <
n - 1;
j++) {
651 buff.fSegs[
indx + (i * (
n - 1) +
j) * 3 + 1] = i * (
n - 1) +
j;
652 buff.fSegs[
indx + (i * (
n - 1) +
j) * 3 + 2] = i * (
n - 1) + ((
j + 1) % (
n - 1));
658 for (i = 0; i <
n - 1; i++) {
659 for (
j = 0;
j <
n - 1;
j++) {
661 buff.fSegs[
indx + (i * (
n - 1) +
j) * 3 + 1] = i * (
n - 1) +
j;
662 buff.fSegs[
indx + (i * (
n - 1) +
j) * 3 + 2] = (i + 1) * (
n - 1) +
j;
665 indx += 3 * (
n - 1) * (
n - 1);
671 for (i = 0; i <
n; i++) {
672 for (
j = 0;
j <
n - 1;
j++) {
675 buff.fSegs[
indx + (i * (
n - 1) +
j) * 3 + 2] =
indp + i * (
n - 1) + ((
j + 1) % (
n - 1));
681 for (i = 0; i <
n - 1; i++) {
682 for (
j = 0;
j <
n - 1;
j++) {
685 buff.fSegs[
indx + (i * (
n - 1) +
j) * 3 + 2] =
indp + (i + 1) * (
n - 1) +
j;
688 indx += 3 * (
n - 1) * (
n - 1);
696 for (
j = 0;
j <
n - 1;
j++) {
703 for (
j = 0;
j <
n - 1;
j++) {
711 for (
j = 0;
j <
n - 1;
j++) {
718 for (
j = 0;
j <
n - 1;
j++) {
732 for (i = 0; i <
n - 1; i++) {
733 for (
j = 0;
j <
n - 1;
j++) {
736 buff.fPols[
indx++] =
n * (
n - 1) + (
n - 1) * i + ((
j + 1) % (
n - 1));
743 indp = (2 *
n - 1) * (
n - 1);
746 for (i = 0; i <
n - 1; i++) {
747 for (
j = 0;
j <
n - 1;
j++) {
761 for (
j = 0;
j <
n - 1;
j++) {
772 for (
j = 0;
j <
n - 1;
j++) {
799 for (i = 0; i < 2; i++)
809 for (i = 0; i < 2; i++)
823 out <<
" r = " <<
fR <<
";" << std::endl;
824 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
825 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
826 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
827 out <<
" dphi = " <<
fDphi <<
";" << std::endl;
828 out <<
" TGeoShape *" <<
GetPointerName() <<
" = new TGeoTorus(\"" <<
GetName() <<
"\",r,rmin,rmax,phi1,dphi);"
871 for (i = 0; i <
n; i++) {
875 for (
j = 0;
j <
n - 1;
j++) {
887 for (i = 0; i <
n; i++) {
891 for (
j = 0;
j <
n - 1;
j++) {
930 for (i = 0; i <
n; i++) {
934 for (
j = 0;
j <
n - 1;
j++) {
947 for (i = 0; i <
n; i++) {
951 for (
j = 0;
j <
n - 1;
j++) {
984 else if (
fDphi < 360.)
1012 t = (-3 *
q *
sq3 + delta) / (6 *
sq3);
1013 u = (3 *
q *
sq3 + delta) / (6 *
sq3);
1019 u = delta / (6 *
sq3);
1024 t =
x[0] *
x[0] +
a *
x[0] +
b;
1026 delta =
u *
u - 4. * t;
1030 x[1] = 0.5 * (-
u - delta);
1031 x[2] = 0.5 * (-
u + delta);
1054 delta =
e *
e - 4. *
g;
1058 h = 0.5 * (-
e - delta);
1064 h = 0.5 * (-
e + delta);
1072 for (i = 0; i <
ireal; i++)
1082 for (i = 0; i <
ind[0]; i++)
1086 for (i = 0; i <
ireal; i++)
1100 for (i = 0; i < 3; i++) {
1111 delta =
h *
h - 4. *
j;
1114 x[
ireal++] = 0.5 * (-
h - delta) - 0.25 *
a;
1115 x[
ireal++] = 0.5 * (-
h + delta) - 0.25 *
a;
1117 delta =
h *
h - 4. *
g /
j;
1120 x[
ireal++] = 0.5 * (
h - delta) - 0.25 *
a;
1121 x[
ireal++] = 0.5 * (
h + delta) - 0.25 *
a;
1125 for (i = 0; i <
ireal; i++)
1154 Double_t b0 = (
pt[0] * dir[0] +
pt[1] * dir[1]) / (dir[0] * dir[0] + dir[1] * dir[1]);
1155 Double_t c0 = (
pt[0] *
pt[0] + (
pt[1] -
r0) * (
pt[1] +
r0)) / (dir[0] * dir[0] + dir[1] * dir[1]);
1166 c0 = (
pt[0] *
pt[0] + (
pt[1] -
r0) * (
pt[1] +
r0)) / (dir[0] * dir[0] + dir[1] * dir[1]);
1167 delta = b0 * b0 - c0;
1211 Double_t delta = s * s * s * s +
a * s * s * s +
b * s * s +
c * s +
d;
1212 Double_t eps0 = -delta / (4. * s * s * s + 3. *
a * s * s + 2. *
b * s +
c);
1219 delta = s * s * s * s +
a * s * s * s +
b * s * s +
c * s +
d;
1220 eps = -delta / (4. * s * s * s + 3. *
a * s * s + 2. *
b * s +
c);
1245 nsegs = (2 *
n - 1) * (
n - 1);
1248 nsegs += (2 *
n - 1) * (
n - 1);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
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
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.
Int_t GetNsegments() const
Get number of segments approximating circles.
Geometrical transformation package.
Base abstract class for all shapes.
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.
static Double_t SafetyPhi(const Double_t *point, Bool_t in, Double_t phi1, Double_t phi2)
Static method to compute safety w.r.t a phi corner defined by cosines/sines of the angles phi1,...
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
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.
static void NormalPhi(const Double_t *point, const Double_t *dir, Double_t *norm, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
Static method to compute normal to phi planes.
const char * GetName() const override
Get the shape name.
static Double_t Tolerance()
Bool_t TestShapeBit(UInt_t f) const
The torus is defined by its axial radius, its inner and outer radius.
Int_t SolveQuartic(Double_t a, Double_t b, Double_t c, Double_t d, Double_t *x) const
Find real solutions of the quartic equation : x^4 + a*x^3 + b*x^2 + c*x + d = 0 Input: a,...
void Sizeof3D() const override
fill size of this 3-D object
Double_t ToBoundary(const Double_t *pt, const Double_t *dir, Double_t r, Bool_t in) const
Returns distance to the surface or the torus (fR,r) from a point, along a direction.
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
Double_t DDDaxis(const Double_t *pt, const Double_t *dir, Double_t t) const
Second derivative of distance to torus axis w.r.t t.
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 torus.
const char * GetAxisName(Int_t iaxis) const override
Returns name of axis IAXIS.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
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...
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 torus.
Double_t Daxis(const Double_t *pt, const Double_t *dir, Double_t t) const
Computes distance to axis of the torus from point pt + t*dir;.
void SetTorusDimensions(Double_t r, Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi)
Set torus dimensions.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute closest distance from point px,py to each vertex.
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
void SetPoints(Double_t *points) const override
Create torus mesh points.
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
void SetSegsAndPols(TBuffer3D &buff) const override
Fill TBuffer3D structure for segments and polygons.
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.
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
Create a shape fitting the mother.
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
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 DDaxis(const Double_t *pt, const Double_t *dir, Double_t t) const
Computes derivative w.r.t. t of the distance to axis of the torus from point pt + t*dir;.
Bool_t Contains(const Double_t *point) const override
Test if point is inside the torus.
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.
void InspectShape() const override
print shape parameters
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this torus shape belonging to volume "voldiv" into ndiv volumes called divname,...
TGeoTorus()
Default constructor.
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
Compute normal to closest surface from POINT.
void SetDimensions(Double_t *param) override
Set torus dimensions starting from a list.
void ComputeBBox() override
Compute bounding box of the torus.
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...
Int_t SolveCubic(Double_t a, Double_t b, Double_t c, Double_t *x) const
Find real solutions of the cubic equation : x^3 + a*x^2 + b*x + c = 0 Input: a,b,c Output: x[3] real ...
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 Safety(const Double_t *point, Bool_t in=kTRUE) const override
computes the closest distance from given point to this shape, according to option.
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
Compute distance from inside point to surface of the tube segment (static) Boundary safe algorithm.
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz, Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cm, Double_t sm, Double_t cdfi)
Static method to compute distance to arbitrary tube segment from outside point Boundary safe algorith...
static Double_t DistFromOutsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
Static method to compute distance from outside point to a tube with given parameters Boundary safe al...
static Double_t DistFromInsideS(const Double_t *point, const Double_t *dir, Double_t rmin, Double_t rmax, Double_t dz)
Compute distance from inside point to surface of the tube (static) Boundary safe algorithm.
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.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
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.
Long64_t LocMax(Long64_t n, const T *a)
Returns index of array with the maximum element.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
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.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Sort the n elements of the array a of generic templated type Element.
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.