222 fOrigin[2] = (zmax + zmin) / 2;
226 fDZ = (zmax - zmin) / 2;
234 Double_t rxy2 = point[0] * point[0] + point[1] * point[1];
285 if (
norm[0] * dir[0] +
norm[1] * dir[1] +
norm[2] * dir[2] < 0) {
305 Double_t r2 = point[0] * point[0] + point[1] * point[1] + point[2] * point[2];
355 Double_t r2 = point[0] * point[0] + point[1] * point[1] + point[2] * point[2];
389 Double_t r2 = point[0] * point[0] + point[1] * point[1] + point[2] * point[2];
443 Double_t rxy2 = point[0] * point[0] + point[1] * point[1];
445 r2 =
rxy2 + point[2] * point[2];
495 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1] + point[2] * dir[2];
557 if (point[2] * dir[2] < 0) {
558 snxt = -point[2] / dir[2];
643 if (point[2] * dir[2] < 0) {
644 snxt = -point[2] / dir[2];
741 un = dir[0] *
s1 - dir[1] *
c1;
744 ptnew[0] = point[0] + s * dir[0];
745 ptnew[1] = point[1] + s * dir[1];
746 ptnew[2] = point[2] + s * dir[2];
756 un = -dir[0] *
s2 + dir[1] *
c2;
759 ptnew[0] = point[0] + s * dir[0];
760 ptnew[1] = point[1] + s * dir[1];
761 ptnew[2] = point[2] + s * dir[2];
780 Double_t rxy2 = point[0] * point[0] + point[1] * point[1];
837 Double_t rdotn = point[0] * dir[0] + point[1] * dir[1] + point[2] * dir[2];
862 if (point[2] * dir[2] < 0)
863 sn1 = -point[2] / dir[2];
936 if (point[2] * dir[2] < 0)
937 sn1 = -point[2] / dir[2];
1034 Double_t r2 = point[0] * point[0] + point[1] * point[1] + point[2] * point[2];
1035 Double_t b = point[0] * dir[0] + point[1] * dir[1] + point[2] * dir[2];
1056 for (i = 0; i < 3; i++)
1057 pt[i] = point[i] + s * dir[i];
1075 Double_t end = start + ndiv * step;
1082 for (
id = 0;
id < ndiv;
id++) {
1087 voldiv->AddNodeOffset(vol,
id, 0, opt.
Data());
1100 for (
id = 0;
id < ndiv;
id++) {
1101 voldiv->AddNodeOffset(vol,
id, start +
id * step + step / 2, opt.
Data());
1110 for (
id = 0;
id < ndiv;
id++) {
1115 voldiv->AddNodeOffset(vol,
id, 0, opt.
Data());
1119 default:
Error(
"Divide",
"In shape %s wrong axis type for division",
GetName());
return nullptr;
1130 case 2:
return "PHI";
1131 case 3:
return "THETA";
1132 default:
return "UNDEFINED";
1178 param[0] *= param[0];
1182 param[1] *= param[1];
1189 while (param[3] < param[2])
1205 printf(
" Bounding box:\n");
1298 for (i = 0; i <
nlat; i++) {
1308 for (i = 0; i <
nlat - 1; i++) {
1352 for (i = 0; i <
nlat; i++) {
1361 for (i = 0; i <
nlat - 1; i++) {
1451 for (i = 0; i <
nlat - 1; i++) {
1484 for (i = 0; i <
nlat - 1; i++) {
1517 for (i = 0; i <
nlat - 1; i++) {
1532 for (i = 0; i <
nlat - 1; i++) {
1647 Double_t r2 = point[0] * point[0] + point[1] * point[1] + point[2] * point[2];
1676 for (
Int_t i = 0; i < 4; i++)
1691 out <<
" // Shape: " <<
GetName() <<
" type: " <<
ClassName() << std::endl;
1692 out <<
" rmin = " <<
fRmin <<
";" << std::endl;
1693 out <<
" rmax = " <<
fRmax <<
";" << std::endl;
1694 out <<
" theta1 = " <<
fTheta1 <<
";" << std::endl;
1695 out <<
" theta2 = " <<
fTheta2 <<
";" << std::endl;
1696 out <<
" phi1 = " <<
fPhi1 <<
";" << std::endl;
1697 out <<
" phi2 = " <<
fPhi2 <<
";" << std::endl;
1699 <<
"\",rmin,rmax,theta1, theta2,phi1,phi2);" << std::endl;
1710 Error(
"SetDimensions",
"invalid parameters rmin/rmax");
1718 Error(
"SetDimensions",
"invalid parameters theta1/theta2");
1787 Error(
"SetPoints",
"Input array is NULL");
1821 for (i = 0; i <
nlat; i++) {
1852 for (i = 0; i <
nlat; i++) {
1895 Error(
"SetPoints",
"Input array is NULL");
1929 for (i = 0; i <
nlat; i++) {
1960 for (i = 0; i <
nlat; i++) {
2060 Int_t numPoints = 0;
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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
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
Sphere description class - see TBuffer3DTypes for producer classes Supports hollow and cut spheres.
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...
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=nullptr)
Set parameters of the box.
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.
static void DistToCone(const Double_t *point, const Double_t *dir, Double_t dz, Double_t r1, Double_t r2, Double_t &b, Double_t &delta)
Static method to compute distance to a conical surface with :
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Int_t GetNsegments() const
Get number of segments approximating circles.
Node containing an offset.
Base finder class for patterns.
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 DistToPhiMin(const Double_t *point, const Double_t *dir, Double_t s1, Double_t c1, Double_t s2, Double_t c2, Double_t sm, Double_t cm, Bool_t in=kTRUE)
compute distance from point (inside phi) to both phi planes. Return minimum.
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()
static Bool_t IsCloseToPhi(Double_t epsil, const Double_t *point, Double_t c1, Double_t s1, Double_t c2, Double_t s2)
True if point is closer than epsil to one of the phi planes defined by c1,s1 or c2,...
Bool_t TestShapeBit(UInt_t f) const
TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defi...
Double_t DistToSphere(const Double_t *point, const Double_t *dir, Double_t rsph, Bool_t check=kTRUE, Bool_t firstcross=kTRUE) const
compute distance to sphere of radius rsph. Direction has to be a unit vector
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this box shape belonging to volume "voldiv" into ndiv equal volumes called divname,...
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 SetPoints(Double_t *points) const override
create sphere mesh points
Bool_t Contains(const Double_t *point) const override
test if point is inside this sphere check Rmin<=R<=Rmax
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 SetSphDimensions(Double_t rmin, Double_t rmax, Double_t theta1, Double_t theta2, Double_t phi1, Double_t phi2)
Set spherical segment dimensions.
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
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 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...
TGeoSphere()
Default constructor.
void SetDimensions(Double_t *param) override
Set dimensions of the spherical segment starting from a list of parameters.
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
void InspectShape() const override
print shape parameters
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override
Compute normal to closest surface from POINT.
void SetSegsAndPols(TBuffer3D &buff) const override
Fill TBuffer3D structure for segments and polygons.
Bool_t IsPointInside(const Double_t *point, Bool_t checkR=kTRUE, Bool_t checkTh=kTRUE, Bool_t checkPh=kTRUE) const
Check if a point is inside radius/theta/phi ranges for the spherical sector.
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 sphere
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
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 sphere Check if the bounding box is crossed wit...
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
const char * GetAxisName(Int_t iaxis) const override
Returns name of axis IAXIS.
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
virtual void SetNumberOfDivisions(Int_t p)
Set the number of divisions of mesh circles keeping aspect ratio.
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 GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Int_t GetNmeshVertices() const override
Return number of vertices of the mesh representation.
~TGeoSphere() override
destructor
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 sphere
Int_t IsOnBoundary(const Double_t *point) const
Check if a point in local sphere coordinates is close to a boundary within shape tolerance.
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
void Sizeof3D() const override
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.
const char * Data() const
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
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.
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.
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.