136 fMinExtent.
set(0,0,0);
137 fMaxExtent.
set(0,0,0);
166 if (&ts ==
this)
return *
this;
182 void G4TessellatedSolid::Initialize()
186 fRebuildPolyhedron =
false; fpPolyhedron = 0;
187 fCubicVolume = 0.; fSurfaceArea = 0.;
189 fGeometryType =
"G4TessellatedSolid";
190 fSolidClosed =
false;
200 void G4TessellatedSolid::DeleteObjects ()
202 G4int size = fFacets.size();
203 for (
G4int i = 0; i < size; ++i) {
delete fFacets[i]; }
205 delete fpPolyhedron; fpPolyhedron = 0;
220 for (
G4int i = 0; i <
n; ++i)
239 G4Exception(
"G4TessellatedSolid::AddFacet()",
"GeomSolids1002",
240 JustWarning,
"Attempt to add facets when solid is closed.");
245 set<G4VertexInfo,G4VertexComparator>::iterator begin
246 = fFacetList.begin(), end = fFacetList.end(),
pos, it;
249 value.
id = fFacetList.size();
250 value.
mag2 = p.
x() + p.
y() + p.
z();
256 pos = fFacetList.lower_bound(value);
259 while (!found && it != end)
264 if ((found = (facet == aFacet)))
break;
266 if (dif > kCarTolerance3)
break;
270 if (fFacets.size() > 1)
273 while (!found && it != begin)
279 found = (facet == aFacet);
282 if (dif > kCarTolerance3)
break;
289 fFacets.push_back(aFacet);
290 fFacetList.insert(value);
297 G4Exception(
"G4TessellatedSolid::AddFacet()",
"GeomSolids1002",
298 JustWarning,
"Attempt to add facet not properly defined.");
306 G4int G4TessellatedSolid::SetAllUsingStack(
const std::vector<G4int> &voxel,
307 const std::vector<G4int> &
max,
310 vector<G4int> xyz = voxel;
311 stack<vector<G4int> >
pos;
314 G4int cc = 0, nz = 0;
316 vector<G4int> candidates;
334 for (
G4int i = 0; i <= 2; ++i)
336 if (xyz[i] < max[i] - 1)
362 void G4TessellatedSolid::PrecalculateInsides()
364 vector<G4int> voxel(3), maxVoxels(3);
365 for (
G4int i = 0; i <= 2; ++i) maxVoxels[i] = fVoxels.
GetBoundary(i).size();
366 G4int size = maxVoxels[0] * maxVoxels[1] * maxVoxels[2];
373 for (voxel[2] = 0; voxel[2] < maxVoxels[2] - 1; ++voxel[2])
375 for (voxel[1] = 0; voxel[1] < maxVoxels[1] - 1; ++voxel[1])
377 for (voxel[0] = 0; voxel[0] < maxVoxels[0] - 1; ++voxel[0])
380 if (!checked[index] && fVoxels.
IsEmpty(index))
382 for (
G4int i = 0; i <= 2; ++i)
387 SetAllUsingStack(voxel, maxVoxels, inside, checked);
397 void G4TessellatedSolid::Voxelize ()
409 PrecalculateInsides();
425 void G4TessellatedSolid::SetExtremeFacets()
427 G4int size = fFacets.size();
428 for (
G4int j = 0; j < size; ++j)
433 G4int vsize = fVertexList.size();
434 for (
G4int i=0; i < vsize; ++i)
436 if (!facet.
IsInside(fVertexList[i]))
442 if (isExtreme) fExtremeFacets.insert(&facet);
448 void G4TessellatedSolid::CreateVertexList()
460 set<G4VertexInfo,G4VertexComparator> vertexListSorted;
461 set<G4VertexInfo,G4VertexComparator>::iterator begin
462 = vertexListSorted.begin(), end = vertexListSorted.end(),
pos, it;
467 G4int size = fFacets.size();
471 vector<G4int> newIndex(100);
473 for (
G4int k = 0; k < size; ++k)
481 value.
id = fVertexList.size();
482 value.
mag2 = p.
x() + p.
y() + p.
z();
488 pos = vertexListSorted.lower_bound(value);
495 found = (dif < kCarTolerance24);
497 dif = q.
x() + q.
y() + q.
z() - value.
mag2;
498 if (dif > kCarTolerance3)
break;
502 if (!found && (fVertexList.size() > 1))
511 found = (dif < kCarTolerance24);
513 dif = value.
mag2 - (q.
x() + q.
y() + q.
z());
514 if (dif > kCarTolerance3)
break;
523 G4cout <<
"Adding new vertex #" << i <<
" of facet " << k
527 fVertexList.push_back(p);
528 vertexListSorted.insert(value);
529 begin = vertexListSorted.begin();
530 end = vertexListSorted.end();
531 newIndex[i] = value.
id;
535 if (value.
id == 0) fMinExtent = fMaxExtent =
p;
538 if (p.
x() > fMaxExtent.
x()) fMaxExtent.
setX(p.
x());
539 else if (p.
x() < fMinExtent.
x()) fMinExtent.
setX(p.
x());
540 if (p.
y() > fMaxExtent.
y()) fMaxExtent.
setY(p.
y());
541 else if (p.
y() < fMinExtent.
y()) fMinExtent.
setY(p.
y());
542 if (p.
z() > fMaxExtent.
z()) fMaxExtent.
setZ(p.
z());
543 else if (p.
z() < fMinExtent.
z()) fMinExtent.
setZ(p.
z());
550 G4cout <<
"Vertex #" << i <<
" of facet " << k
551 <<
" found, redirecting to " <<
id <<
G4endl;
563 vector<G4ThreeVector>(fVertexList).swap(fVertexList);
567 for (set<G4VertexInfo,G4VertexComparator>::iterator res=
568 vertexListSorted.begin(); res!=vertexListSorted.end(); ++res)
570 G4int id = (*res).id;
573 if (previousValue && (previousValue - 1e-9 > mvalue))
574 G4cout <<
"Error in CreateVertexList: previousValue " << previousValue
575 <<
" is smaller than mvalue " << mvalue <<
G4endl;
576 previousValue = mvalue;
588 G4cout <<
"G4TessellatedSolid - Allocated memory without voxel overhead "
589 << without <<
"; with " << with <<
"; ratio: " << ratio <<
G4endl;
645 for (
G4int i = 0; i < size; ++i)
657 return fFacets.size();
671 vector<G4int> startingVoxel(3);
674 const G4double dirTolerance = 1.0E-14;
676 const vector<G4int> &startingCandidates =
678 G4int limit = startingCandidates.size();
679 if (limit == 0 && fInsides.
GetNbits())
688 for(
G4int i = 0; i < limit; ++i)
690 G4int candidate = startingCandidates[i];
691 G4VFacet &facet = *fFacets[candidate];
693 if (dist < minDist) minDist = dist;
720 G4bool nearParallel =
false;
740 vector<G4int> curVoxel(3);
741 curVoxel = startingVoxel;
749 const vector<G4int> &candidates =
750 started ? startingCandidates : fVoxels.
GetCandidates(curVoxel);
752 if (
G4int candidatesCount = candidates.size())
754 for (
G4int i = 0 ; i < candidatesCount; ++i)
756 G4int candidate = candidates[i];
758 G4VFacet &facet = *fFacets[candidate];
760 crossingO = facet.
Intersect(p,v,
true,distO,distFromSurfaceO,normalO);
761 crossingI = facet.
Intersect(p,v,
false,distI,distFromSurfaceI,normalI);
763 if (crossingO || crossingI)
767 nearParallel = (crossingO
768 && std::fabs(normalO.
dot(v))<dirTolerance)
769 || (crossingI && std::fabs(normalI.
dot(v))<dirTolerance);
772 if (crossingO && distO > 0.0 && distO < distOut)
774 if (crossingI && distI > 0.0 && distI < distIn)
780 if (nearParallel)
break;
787 G4bool inside = fInsides[index];
796 currentPoint += direction * (shift + shiftBonus);
801 while (nearParallel && sm!=fMaxTries);
815 std::ostringstream message;
816 G4int oldprc = message.precision(16);
817 message <<
"Cannot determine whether point is inside or outside volume!"
819 <<
"Solid name = " <<
GetName() << G4endl
820 <<
"Geometry Type = " << fGeometryType << G4endl
821 <<
"Number of facets = " << fFacets.size() << G4endl
822 <<
"Position:" << G4endl << G4endl
823 <<
"p.x() = " << p.
x()/
mm <<
" mm" << G4endl
824 <<
"p.y() = " << p.
y()/
mm <<
" mm" << G4endl
825 <<
"p.z() = " << p.
z()/
mm <<
" mm";
826 message.precision(oldprc);
862 const G4double dirTolerance = 1.0E-14;
868 G4int size = fFacets.size();
869 for (
G4int i = 0; i < size; ++i)
873 if (dist < minDist) minDist = dist;
909 for (
G4int i=0; i<nTry; ++i)
911 G4bool nearParallel =
false;
923 vector<G4VFacet*>::const_iterator f = fFacets.begin();
932 crossingO = ((*f)->Intersect(p,v,
true,distO,distFromSurfaceO,normalO));
933 crossingI = ((*f)->Intersect(p,v,
false,distI,distFromSurfaceI,normalI));
934 if (crossingO || crossingI)
936 nearParallel = (crossingO && std::fabs(normalO.
dot(v))<dirTolerance)
937 || (crossingI && std::fabs(normalI.
dot(v))<dirTolerance);
940 if (crossingO && distO > 0.0 && distO < distOut) distOut = distO;
941 if (crossingI && distI > 0.0 && distI < distIn) distIn = distI;
944 }
while (!nearParallel && ++f!=fFacets.end());
945 }
while (nearParallel && sm!=fMaxTries);
955 std::ostringstream message;
956 G4int oldprc = message.precision(16);
957 message <<
"Cannot determine whether point is inside or outside volume!"
959 <<
"Solid name = " <<
GetName() << G4endl
960 <<
"Geometry Type = " << fGeometryType << G4endl
961 <<
"Number of facets = " << fFacets.size() << G4endl
962 <<
"Position:" << G4endl << G4endl
963 <<
"p.x() = " << p.
x()/
mm <<
" mm" << G4endl
964 <<
"p.y() = " << p.
y()/
mm <<
" mm" << G4endl
965 <<
"p.z() = " << p.
z()/
mm <<
" mm";
966 message.precision(oldprc);
988 if (i == 0) location = locationprime;
1007 vector<G4int> curVoxel(3);
1009 const vector<G4int> &candidates = fVoxels.
GetCandidates(curVoxel);
1012 if (
G4int limit = candidates.size())
1015 for(
G4int i = 0 ; i < limit ; ++i)
1017 G4int candidate = candidates[i];
1018 G4VFacet &fct = *fFacets[candidate];
1020 if (dist < minDist) minDist = dist;
1028 minDist = MinDistanceFacet(p,
true, facet);
1033 G4int size = fFacets.size();
1034 for (
G4int i = 0; i < size; ++i)
1054 std::ostringstream message;
1055 message <<
"Point p is not on surface !?" << G4endl
1056 <<
" No facets found for point: " << p <<
" !" << G4endl
1057 <<
" Returning approximated value for normal.";
1059 G4Exception(
"G4TessellatedSolid::SurfaceNormal(p)",
1078 G4TessellatedSolid::DistanceToInNoVoxels (
const G4ThreeVector &p,
1090 std::ostringstream message;
1091 G4int oldprc = message.precision(16) ;
1092 message <<
"Point p is already inside!?" << G4endl
1093 <<
"Position:" << G4endl << G4endl
1094 <<
" p.x() = " << p.
x()/
mm <<
" mm" << G4endl
1095 <<
" p.y() = " << p.
y()/
mm <<
" mm" << G4endl
1096 <<
" p.z() = " << p.
z()/
mm <<
" mm" << G4endl
1098 message.precision(oldprc) ;
1099 G4Exception(
"G4TriangularFacet::DistanceToIn(p,v)",
1104 G4int size = fFacets.size();
1105 for (
G4int i = 0; i < size; ++i)
1108 if (facet.
Intersect(p,v,
false,dist,distFromSurface,normal))
1144 G4TessellatedSolid::DistanceToOutNoVoxels (
const G4ThreeVector &p,
1158 std::ostringstream message;
1159 G4int oldprc = message.precision(16) ;
1160 message <<
"Point p is already outside!?" << G4endl
1161 <<
"Position:" << G4endl << G4endl
1162 <<
" p.x() = " << p.
x()/
mm <<
" mm" << G4endl
1163 <<
" p.y() = " << p.
y()/
mm <<
" mm" << G4endl
1164 <<
" p.z() = " << p.
z()/
mm <<
" mm" << G4endl
1166 message.precision(oldprc) ;
1167 G4Exception(
"G4TriangularFacet::DistanceToOut(p)",
1172 G4bool isExtreme =
false;
1173 G4int size = fFacets.size();
1174 for (
G4int i = 0; i < size; ++i)
1177 if (facet.
Intersect(p,v,
true,dist,distFromSurface,normal))
1183 aConvex = (fExtremeFacets.find(&facet) != fExtremeFacets.end());
1189 if (dist >= 0.0 && dist < minDist)
1193 isExtreme = (fExtremeFacets.find(&facet) != fExtremeFacets.end());
1199 aNormalVector = minNormal;
1200 aConvex = isExtreme;
1207 Normal(p, aNormalVector);
1214 void G4TessellatedSolid::
1215 DistanceToOutCandidates(
const std::vector<G4int> &candidates,
1219 G4int &minCandidate )
const
1221 G4int candidatesCount = candidates.size();
1226 for (
G4int i = 0 ; i < candidatesCount; ++i)
1228 G4int candidate = candidates[i];
1229 G4VFacet &facet = *fFacets[candidate];
1230 if (facet.
Intersect(aPoint,direction,
true,dist,distFromSurface,normal))
1239 minCandidate = candidate;
1242 if (dist >= 0.0 && dist < minDist)
1246 minCandidate = candidate;
1255 G4TessellatedSolid::DistanceToOutCore(
const G4ThreeVector &aPoint,
1270 vector<G4int> curVoxel(3);
1271 if (!fVoxels.
Contains(aPoint))
return 0;
1273 fVoxels.
GetVoxel(curVoxel, currentPoint);
1277 const vector<G4int> *old = 0;
1279 G4int minCandidate = -1;
1282 const vector<G4int> &candidates = fVoxels.
GetCandidates(curVoxel);
1283 if (old == &candidates)
1285 if (old != &candidates && candidates.size())
1287 DistanceToOutCandidates(candidates, aPoint, direction, minDistance,
1288 aNormalVector, minCandidate);
1289 if (minDistance <= totalShift)
break;
1295 totalShift += shift;
1296 if (minDistance <= totalShift)
break;
1298 currentPoint += direction * (shift + shiftBonus);
1304 if (minCandidate < 0)
1309 Normal(aPoint, aNormalVector);
1313 aConvex = (fExtremeFacets.find(fFacets[minCandidate])
1314 != fExtremeFacets.end());
1319 minDistance = DistanceToOutNoVoxels(aPoint, aDirection, aNormalVector,
1328 DistanceToInCandidates(
const std::vector<G4int> &candidates,
1332 G4int candidatesCount = candidates.size();
1338 for (
G4int i = 0 ; i < candidatesCount; ++i)
1340 G4int candidate = candidates[i];
1341 G4VFacet &facet = *fFacets[candidate];
1342 if (facet.
Intersect(aPoint,direction,
false,dist,distFromSurface,normal))
1352 && (dist >= 0.0) && (dist < minDistance))
1376 G4TessellatedSolid::DistanceToInCore(
const G4ThreeVector &aPoint,
1391 currentPoint += direction * (shift + shiftBonus);
1396 vector<G4int> curVoxel(3);
1398 fVoxels.
GetVoxel(curVoxel, currentPoint);
1401 const vector<G4int> &candidates = fVoxels.
GetCandidates(curVoxel);
1402 if (candidates.size())
1404 G4double distance=DistanceToInCandidates(candidates, aPoint, direction);
1405 if (minDistance > distance) minDistance = distance;
1406 if (distance < totalShift)
break;
1409 shift = fVoxels.
DistanceToNext(currentPoint, direction, curVoxel);
1412 totalShift += shift;
1413 if (minDistance < totalShift)
break;
1415 currentPoint += direction * (shift + shiftBonus);
1421 minDistance = DistanceToInNoVoxels(aPoint, aDirection, aPstep);
1430 G4TessellatedSolid::CompareSortedVoxel(
const std::pair<G4int, G4double> &l,
1431 const std::pair<G4int, G4double> &r)
1433 return l.second < r.second;
1439 G4TessellatedSolid::MinDistanceFacet(
const G4ThreeVector &p,
1446 vector<pair<G4int, G4double> > voxelsSorted(size);
1448 pair<G4int, G4double>
info;
1450 for (
G4int i = 0; i < size; ++i)
1457 info.second = safety;
1458 voxelsSorted[i] =
info;
1461 std::sort(voxelsSorted.begin(), voxelsSorted.end(),
1462 &G4TessellatedSolid::CompareSortedVoxel);
1464 for (
G4int i = 0; i < size; ++i)
1466 const pair<G4int,G4double> &inf = voxelsSorted[i];
1468 if (dist > minDist)
break;
1471 G4int csize = candidates.size();
1472 for (
G4int j = 0; j < csize; ++j)
1474 G4int candidate = candidates[j];
1475 G4VFacet &facet = *fFacets[candidate];
1476 dist = simple ? facet.
Distance(p,minDist)
1496 std::ostringstream message;
1497 G4int oldprc = message.precision(16) ;
1498 message <<
"Point p is already inside!?" << G4endl
1499 <<
"Position:" << G4endl << G4endl
1500 <<
"p.x() = " << p.
x()/
mm <<
" mm" << G4endl
1501 <<
"p.y() = " << p.
y()/
mm <<
" mm" << G4endl
1502 <<
"p.z() = " << p.
z()/
mm <<
" mm" << G4endl
1504 message.precision(oldprc) ;
1519 vector<G4int> startingVoxel(3);
1520 fVoxels.
GetVoxel(startingVoxel, p);
1521 const vector<G4int> &candidates = fVoxels.
GetCandidates(startingVoxel);
1522 if (candidates.size() == 0 && fInsides.
GetNbits())
1525 if (fInsides[index])
return 0.;
1530 minDist = MinDistanceFacet(p,
true, facet);
1535 G4int size = fFacets.size();
1536 for (
G4int i = 0; i < size; ++i)
1540 if (dist < minDist) minDist = dist;
1554 std::ostringstream message;
1555 G4int oldprc = message.precision(16) ;
1556 message <<
"Point p is already outside!?" << G4endl
1557 <<
"Position:" << G4endl << G4endl
1558 <<
"p.x() = " << p.
x()/
mm <<
" mm" << G4endl
1559 <<
"p.y() = " << p.
y()/
mm <<
" mm" << G4endl
1560 <<
"p.z() = " << p.
z()/
mm <<
" mm" << G4endl
1562 message.precision(oldprc) ;
1563 G4Exception(
"G4TriangularFacet::DistanceToOut(p)",
1575 minDist = MinDistanceFacet(p,
true, facet);
1581 G4int size = fFacets.size();
1582 for (
G4int i = 0; i < size; ++i)
1586 if (dist < minDist) minDist = dist;
1600 return fGeometryType;
1608 os <<
"Geometry Type = " << fGeometryType <<
G4endl;
1609 os <<
"Number of facets = " << fFacets.size() <<
G4endl;
1611 G4int size = fFacets.size();
1612 for (
G4int i = 0; i < size; ++i)
1614 os <<
"FACET # = " << i + 1 <<
G4endl;
1648 location = InsideVoxels(aPoint);
1652 location = InsideNoVoxels(aPoint);
1689 std::ostringstream message;
1690 message <<
"Invalid response from facet in solid '" <<
GetName() <<
"',"
1692 <<
"at point: " << p <<
"and direction: " << v;
1693 G4Exception(
"G4TessellatedSolid::DistanceToIn(p,v)",
1740 G4double dist = DistanceToOutCore(p, v, n, valid);
1751 std::ostringstream message;
1752 message <<
"Invalid response from facet in solid '" <<
GetName() <<
"',"
1754 <<
"at point: " << p <<
"and direction: " << v;
1755 G4Exception(
"G4TessellatedSolid::DistanceToOut(p,v,..)",
1774 G4int nVertices = fVertexList.size();
1775 G4int nFacets = fFacets.size();
1778 for (G4ThreeVectorList::const_iterator v= fVertexList.begin();
1779 v!=fVertexList.end(); ++v)
1784 G4int size = fFacets.size();
1785 for (
G4int i = 0; i < size; ++i)
1791 else if (n == 3) v[3] = 0;
1792 for (
G4int j=0; j<
n; ++j)
1797 polyhedron->
AddFacet(v[0],v[1],v[2],v[3]);
1810 if (!fpPolyhedron ||
1811 fRebuildPolyhedron ||
1816 delete fpPolyhedron;
1818 fRebuildPolyhedron =
false;
1821 return fpPolyhedron;
1835 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
1837 std::ostringstream message;
1838 message <<
"Bad bounding box (min >= max) for solid: "
1840 <<
"\npMin = " << pMin
1841 <<
"\npMax = " << pMax;
1865 #ifdef G4BBOX_EXTENT
1866 if (
true)
return bbox.
CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
1870 return exist = (pMin < pMax) ?
true :
false;
1881 std::vector<const G4ThreeVectorList *> pyramid(2);
1884 apex[0] = (bmin+bmax)*0.5;
1901 if (!benv.
CalculateExtent(pAxis,pVoxelLimit,pTransform,emin,emax))
continue;
1902 if (emin < pMin) pMin = emin;
1903 if (emax > pMax) pMax =
emax;
1904 if (eminlim > pMin && emaxlim < pMax)
break;
1906 return (pMin < pMax);
1913 return fMinExtent.
x();
1920 return fMaxExtent.
x();
1927 return fMinExtent.
y();
1934 return fMaxExtent.
y();
1941 return fMinExtent.
z();
1948 return fMaxExtent.
z();
1956 fMinExtent.
y(), fMaxExtent.
y(),
1957 fMinExtent.
z(), fMaxExtent.
z());
1964 if (fCubicVolume != 0.)
return fCubicVolume;
1970 G4int size = fFacets.size();
1971 for (
G4int i = 0; i < size; ++i)
1976 fCubicVolume += area * (facet.
GetVertex(0).
dot(unit_normal));
1979 return fCubicVolume;
1986 if (fSurfaceArea != 0.)
return fSurfaceArea;
1988 G4int size = fFacets.size();
1989 for (
G4int i = 0; i < size; ++i)
1992 fSurfaceArea += facet.
GetArea();
1994 return fSurfaceArea;
2004 return fFacets[i]->GetPointOnFace();
2016 void G4TessellatedSolid::SetRandomVectors ()
2020 G4ThreeVector(-0.9577428892113370, 0.2732676269591740, 0.0897405271949221);
2022 G4ThreeVector(-0.8331264504940770,-0.5162067214954600,-0.1985722492445700);
2024 G4ThreeVector(-0.1516671651108820, 0.9666292616127460, 0.2064580868390110);
2026 G4ThreeVector( 0.6570250350323190,-0.6944539025883300, 0.2933460081893360);
2028 G4ThreeVector(-0.4820456281280320,-0.6331060000098690,-0.6056474264406270);
2030 G4ThreeVector( 0.7629032554236800 , 0.1016854697539910,-0.6384658864065180);
2032 G4ThreeVector( 0.7689540409061150, 0.5034929891988220, 0.3939600142169160);
2034 G4ThreeVector( 0.5765188359255740, 0.5997271636278330,-0.5549354566343150);
2036 G4ThreeVector( 0.6660632777862070,-0.6362809868288380, 0.3892379937580790);
2038 G4ThreeVector( 0.3824415020414780, 0.6541792713761380,-0.6525243125110690);
2040 G4ThreeVector(-0.5107726564526760, 0.6020905056811610, 0.6136760679616570);
2042 G4ThreeVector( 0.7459135439578050, 0.6618796061649330, 0.0743530220183488);
2044 G4ThreeVector( 0.1536405855311580, 0.8117477913978260,-0.5634359711967240);
2046 G4ThreeVector( 0.0744395301705579,-0.8707110101772920,-0.4861286795736560);
2048 G4ThreeVector(-0.1665874645185400, 0.6018553940549240,-0.7810369397872780);
2050 G4ThreeVector( 0.7766902003633100, 0.6014617505959970,-0.1870724331097450);
2052 G4ThreeVector(-0.8710128685847430,-0.1434320216603030,-0.4698551243971010);
2054 G4ThreeVector( 0.8901082092766820,-0.4388411398893870, 0.1229871120030100);
2056 G4ThreeVector(-0.6430417431544370,-0.3295938228697690, 0.6912779675984150);
2058 G4ThreeVector( 0.6331124368380410, 0.6306211461665000, 0.4488714875425340);
2071 G4int limit = fFacets.size();
2072 for (
G4int i = 0; i < limit; i++)
2078 std::set<G4VFacet *>::const_iterator beg, end, it;
2079 beg = fExtremeFacets.begin();
2080 end = fExtremeFacets.end();
2081 for (it = beg; it != end; it++)
2096 size += sizeInsides + sizeVoxels;
void set(double x, double y, double z)
G4bool Contains(const G4ThreeVector &point) const
void ResetBitNumber(unsigned int bitnumber)
const XML_Char XML_Encoding * info
unsigned int GetNbits() const
ThreeVector shoot(const G4int Ap, const G4int Af)
void SetSolidClosed(const G4bool t)
static constexpr double mm
static const G4double kInfinity
void Voxelize(std::vector< G4VFacet * > &facets)
CLHEP::Hep3Vector G4ThreeVector
virtual void DescribeYourselfTo(G4VGraphicsScene &scene) const
double dot(const Hep3Vector &) const
virtual G4bool Intersect(const G4ThreeVector &, const G4ThreeVector &, const G4bool, G4double &, G4double &, G4ThreeVector &)=0
virtual G4VisExtent GetExtent() const
G4double DistanceToFirst(const G4ThreeVector &point, const G4ThreeVector &direction) const
G4double DistanceToBoundingBox(const G4ThreeVector &point) const
G4double GetMaxXExtent() const
virtual G4int GetNumberOfVertices() const =0
virtual G4ThreeVector GetCircumcentre() const =0
virtual G4double GetCubicVolume()
virtual G4double Distance(const G4ThreeVector &, G4double)=0
G4int GetVoxelsIndex(G4int x, G4int y, G4int z) const
G4double GetMinXExtent() const
virtual G4double GetSurfaceArea()
static G4double MinDistanceToBox(const G4ThreeVector &aPoint, const G4ThreeVector &f)
virtual void SetVertexIndex(G4int i, G4int j)=0
G4bool UpdateCurrentVoxel(const G4ThreeVector &point, const G4ThreeVector &direction, std::vector< G4int > &curVoxel) const
G4double GetMaxZExtent() const
virtual void AddSolid(const G4Box &)=0
const XML_Char int const XML_Char int const XML_Char * base
#define G4MUTEX_INITIALIZER
G4int GetPointIndex(const G4ThreeVector &p) const
void SetBitNumber(unsigned int bitnumber, G4bool value=true)
G4VFacet * GetFacet(G4int i) const
static double normal(HepRandomEngine *eptr)
G4double kCarToleranceHalf
G4bool IsEmpty(G4int index) const
virtual G4ThreeVector GetSurfaceNormal() const =0
G4double GetMinZExtent() const
G4GLOB_DLL std::ostream G4cout
virtual G4double DistanceToOut(const G4ThreeVector &p) const
const XML_Char int const XML_Char * value
virtual G4Polyhedron * CreatePolyhedron() const
void GetVoxel(std::vector< G4int > &curVoxel, const G4ThreeVector &point) const
virtual void SetVertices(std::vector< G4ThreeVector > *vertices)=0
virtual G4double GetArea() const =0
virtual EInside Inside(const G4ThreeVector &p) const
G4bool AddFacet(G4VFacet *aFacet)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
G4double DistanceToNext(const G4ThreeVector &point, const G4ThreeVector &direction, const std::vector< G4int > &curVoxel) const
G4bool BoundingBoxVsVoxelLimits(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void SetMaxVoxels(G4int max)
G4TessellatedSolid & operator+=(const G4TessellatedSolid &right)
const std::vector< G4int > & GetCandidates(std::vector< G4int > &curVoxel) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
std::vector< G4ThreeVector > G4ThreeVectorList
void AddVertex(const G4ThreeVector &v)
virtual G4VSolid * Clone() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const G4double emax
G4int AllocatedMemoryWithoutVoxels()
virtual G4Polyhedron * GetPolyhedron() const
G4int GetNumberOfFacets() const
G4bool IsInside(const G4ThreeVector &p) const
virtual std::ostream & StreamInfo(std::ostream &os) const
virtual G4int GetVertexIndex(G4int i) const =0
static G4int GetNumberOfRotationSteps()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual G4double SafetyFromInside(const G4ThreeVector &p, G4bool aAccurate=false) const
std::ostream & StreamInfo(std::ostream &os) const
void AddFacet(const G4int iv1, const G4int iv2, const G4int iv3, const G4int iv4=0)
virtual ~G4TessellatedSolid()
long long GetCountOfVoxels() const
virtual G4GeometryType GetEntityType() const
const std::vector< G4double > & GetBoundary(G4int index) const
G4VSolid & operator=(const G4VSolid &rhs)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
const G4SurfBits & Empty() const
G4int GetMaxVoxels(G4ThreeVector &ratioOfReduction)
const std::vector< G4int > & GetVoxelBoxCandidates(G4int i) const
void DisplayAllocatedMemory()
virtual G4VFacet * GetClone()=0
virtual G4bool Normal(const G4ThreeVector &p, G4ThreeVector &n) const
G4int GetVoxelBoxesSize() const
G4double GetMaxExtent(const EAxis pAxis) const
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
virtual G4ThreeVector GetVertex(G4int i) const =0
const G4VoxelBox & GetVoxelBox(G4int i) const
G4double GetMaxYExtent() const
virtual G4ThreeVector GetPointOnSurface() const
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
static const G4double pos
G4double GetMinExtent(const EAxis pAxis) const
virtual G4int AllocatedMemory()=0
virtual G4double SafetyFromOutside(const G4ThreeVector &p, G4bool aAccurate=false) const
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4double GetMinYExtent() const
unsigned int GetNbytes() const
G4TessellatedSolid & operator=(const G4TessellatedSolid &right)
G4bool GetSolidClosed() const
virtual G4bool IsDefined() const =0