299 if (pTransform3D.
xx()==1 && pTransform3D.
yy()==1 && pTransform3D.
zz()==1)
341 G4double scale = FindScaleFactor(pTransform3D);
347 G4double radius = 0.5*scale*(fMax-fMin).mag() + delta;
352 if (center.
x()-radius >= xminlim && center.
x()+radius <= xmaxlim &&
353 center.
y()-radius >= yminlim && center.
y()+radius <= ymaxlim &&
354 center.
z()-radius >= zminlim && center.
z()+radius <= zmaxlim )
359 cx = pTransform3D.
xx();
360 cy = pTransform3D.
xy();
361 cz = pTransform3D.
xz();
362 cd = pTransform3D.
dx();
366 cx = pTransform3D.
yx();
367 cy = pTransform3D.
yy();
368 cz = pTransform3D.
yz();
369 cd = pTransform3D.
dy();
373 cx = pTransform3D.
zx();
374 cy = pTransform3D.
zy();
375 cz = pTransform3D.
zz();
376 cd = pTransform3D.
dz();
386 coor = cx*fMin.
x() + cy*fMin.
y() + cz*fMin.
z() +
cd;
387 if (coor < emin) emin = coor;
388 if (coor > emax) emax = coor;
389 coor = cx*fMax.
x() + cy*fMin.
y() + cz*fMin.
z() +
cd;
390 if (coor < emin) emin = coor;
391 if (coor > emax) emax = coor;
392 coor = cx*fMax.
x() + cy*fMax.
y() + cz*fMin.
z() +
cd;
393 if (coor < emin) emin = coor;
394 if (coor > emax) emax = coor;
395 coor = cx*fMin.
x() + cy*fMax.
y() + cz*fMin.
z() +
cd;
396 if (coor < emin) emin = coor;
397 if (coor > emax) emax = coor;
398 coor = cx*fMin.
x() + cy*fMin.
y() + cz*fMax.
z() +
cd;
399 if (coor < emin) emin = coor;
400 if (coor > emax) emax = coor;
401 coor = cx*fMax.
x() + cy*fMin.
y() + cz*fMax.
z() +
cd;
402 if (coor < emin) emin = coor;
403 if (coor > emax) emax = coor;
404 coor = cx*fMax.
x() + cy*fMax.
y() + cz*fMax.
z() +
cd;
405 if (coor < emin) emin = coor;
406 if (coor > emax) emax = coor;
407 coor = cx*fMin.
x() + cy*fMax.
y() + cz*fMax.
z() +
cd;
408 if (coor < emin) emin = coor;
409 if (coor > emax) emax = coor;
413 std::vector<const G4ThreeVectorList*>::const_iterator ibase;
414 for (ibase = fPolygons->begin(); ibase != fPolygons->end(); ibase++)
416 G4ThreeVectorList::const_iterator ipoint;
417 for (ipoint = (*ibase)->begin(); ipoint != (*ibase)->end(); ipoint++)
419 G4double coor = ipoint->x()*cx + ipoint->y()*cy + ipoint->z()*cz +
cd;
420 if (coor < emin) emin = coor;
421 if (coor > emax) emax = coor;
433 if (center.
x()-radius > xmaxlim)
return false;
434 if (center.
y()-radius > ymaxlim)
return false;
435 if (center.
z()-radius > zmaxlim)
return false;
436 if (center.
x()+radius < xminlim)
return false;
437 if (center.
y()+radius < yminlim)
return false;
438 if (center.
z()+radius < zminlim)
return false;
442 G4int nbases = (fPolygons == 0) ? 2 : fPolygons->size();
443 std::vector<G4Polygon3D*> bases(nbases);
451 for (
G4int i=0; i<nbases; ++i)
453 bases[i] =
new G4Polygon3D((*fPolygons)[i]->size());
459 TransformVertices(pTransform3D, bases);
467 for (
G4int i=0; i<3; ++i)
473 limits.
AddLimit(axis[i], emin, emax);
482 for (
G4int k=0; k<nbases-1; ++k)
488 GetPrismAABB(*baseA, *baseB, prismAABB);
498 if (extent.first.x() > prismAABB.first.x())
499 extent.first.setX( prismAABB.first.x() );
500 if (extent.first.y() > prismAABB.first.y())
501 extent.first.setY( prismAABB.first.y() );
502 if (extent.first.z() > prismAABB.first.z())
503 extent.first.setZ( prismAABB.first.z() );
504 if (extent.second.x() < prismAABB.second.x())
505 extent.second.setX(prismAABB.second.x());
506 if (extent.second.y() < prismAABB.second.y())
507 extent.second.setY(prismAABB.second.y());
508 if (extent.second.z() < prismAABB.second.z())
509 extent.second.setZ(prismAABB.second.z());
522 std::vector<G4Segment3D> vecEdges;
523 CreateListOfEdges(*baseA, *baseB, vecEdges);
524 if (ClipEdgesByVoxel(vecEdges, limits, extent))
continue;
544 if (bits == 0xFFF)
continue;
546 std::vector<G4Plane3D> vecPlanes;
547 CreateListOfPlanes(*baseA, *baseB, vecPlanes);
548 ClipVoxelByPlanes(bits, limits, vecPlanes, prismAABB, extent);
553 for (
G4int i=0; i<nbases; ++i) {
delete bases[i]; bases[i] = 0; }
558 if (pAxis ==
kXAxis) { emin = extent.first.x(); emax = extent.second.x(); }
559 if (pAxis ==
kYAxis) { emin = extent.first.y(); emax = extent.second.y(); }
560 if (pAxis ==
kZAxis) { emin = extent.first.z(); emax = extent.second.z(); }
562 if (emin > emax)
return false;
static const G4double kInfinity
G4double GetMinYExtent() const
HepGeom::Point3D< G4double > G4Point3D
G4double GetMaxXExtent() const
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)
G4double GetMinZExtent() const
std::vector< G4Point3D > G4Polygon3D
const G4double kCarTolerance
static const G4double emax
G4double GetMinXExtent() const
G4double GetMaxZExtent() const
std::pair< G4Point3D, G4Point3D > G4Segment3D
G4double GetMaxYExtent() const
G4double GetMaxExtent(const EAxis pAxis) const
G4double GetMinExtent(const EAxis pAxis) const