|
ATLAS Offline Software
|
#include <BooleanProcessor.h>
|
void | takePolyhedron (const HepPolyhedron &p, double, double, double) |
|
double | findMinMax () |
|
void | selectOutsideFaces (int &ifaces, int &iout) |
|
int | testFaceVsPlane (ExtEdge &edge) |
|
void | renumberNodes (int &i1, int &i2, int &i3, int &i4) |
|
int | testEdgeVsEdge (ExtEdge &edge1, ExtEdge &edge2) |
|
void | removeJunkNodes () |
|
void | divideEdge (int &i1, int &i2) |
|
void | insertEdge (const ExtEdge &edge) |
|
void | caseII (ExtEdge &edge1, ExtEdge &edge2) |
|
void | caseIE (ExtEdge &edge1, ExtEdge &edge2) |
|
void | caseEE (ExtEdge &edge1, ExtEdge &edge2) |
|
void | testFaceVsFace (int iface1, int iface2) |
|
void | invertNewEdges (int iface) |
|
void | checkDoubleEdges (int iface) |
|
void | assembleFace (int what, int iface) |
|
void | assembleNewFaces (int what, int ihead) |
|
void | initiateLists () |
|
void | assemblePolyhedra () |
|
void | findABC (double x1, double y1, double x2, double y2, double &a, double &b, double &c) const |
|
int | checkDirection (double *x, double *y) const |
|
int | checkIntersection (int ix, int iy, int i1, int i2) const |
|
void | mergeContours (int ix, int iy, int kext, int kint) |
|
int | checkTriangle (int iedge1, int iedge2, int ix, int iy) const |
|
void | triangulateContour (int ix, int iy, int ihead) |
|
void | modifyReference (int iface, int i1, int i2, int iref) |
|
void | triangulateFace (int iface) |
|
HepPolyhedron | createPolyhedron () |
|
Definition at line 312 of file BooleanProcessor.h.
◆ BooleanProcessor()
BooleanProcessor::BooleanProcessor |
( |
| ) |
|
|
inline |
◆ ~BooleanProcessor()
BooleanProcessor::~BooleanProcessor |
( |
| ) |
|
|
inline |
◆ assembleFace()
void BooleanProcessor::assembleFace |
( |
int |
what, |
|
|
int |
iface |
|
) |
| |
|
private |
Definition at line 1081 of file BooleanProcessor.h.
1100 #define INSERT_EDGE_TO_THE_LIST(A) \
1101 *ilink = A; ilink = &m_edges[A].inext; *ilink = 0
1106 if (face.
inew == 0)
break;
1122 if (edge_i.
i1 == edge_cur.
i2)
break;
1129 if (edge_i.
i1 == edge_cur.
i2) {
1140 if (
m_edges[icur].i2 == ifirst) {
break; }
else {
continue; }
1145 <<
"BooleanProcessor::assembleFace(" << iface <<
") : "
1146 <<
"could not find next edge of the contour"
1159 if (
what == 0 && ioldflag == 0 && iedge > 0) {
1161 if (
m_edges[iedge].inext > 0) {
1183 iface2 =
m_edges[iedge].iface2;
◆ assembleNewFaces()
void BooleanProcessor::assembleNewFaces |
( |
int |
what, |
|
|
int |
ihead |
|
) |
| |
|
private |
◆ assemblePolyhedra()
void BooleanProcessor::assemblePolyhedra |
( |
| ) |
|
|
private |
◆ caseEE()
Definition at line 970 of file BooleanProcessor.h.
983 <<
"BooleanProcessor::caseEE : unimplemented case"
◆ caseIE()
Definition at line 952 of file BooleanProcessor.h.
965 <<
"BooleanProcessor::caseIE : unimplemented case"
◆ caseII()
◆ checkDirection()
int BooleanProcessor::checkDirection |
( |
double * |
x, |
|
|
double * |
y |
|
) |
| const |
|
private |
◆ checkDoubleEdges()
void BooleanProcessor::checkDoubleEdges |
( |
int |
iface | ) |
|
|
private |
◆ checkIntersection()
int BooleanProcessor::checkIntersection |
( |
int |
ix, |
|
|
int |
iy, |
|
|
int |
i1, |
|
|
int |
i2 |
|
) |
| const |
|
private |
Definition at line 1456 of file BooleanProcessor.h.
1477 int icontour, iedge, k1, k2;
1478 double x3, y3, x4, y4, a2, b2,
c2,
d1,
d2;
1485 if (k1 == i1 || k2 == i1)
continue;
1486 if (k1 == i2 || k2 == i2)
continue;
1491 d1 = a1*x3 + b1*y3 +
c1;
1492 d2 = a1*x4 + b1*y4 +
c1;
1513 if (k1 == i1 || k2 == i1)
continue;
1514 if (k1 == i2 || k2 == i2)
continue;
1519 d1 = a1*x3 + b1*y3 +
c1;
1520 d2 = a1*x4 + b1*y4 +
c1;
◆ checkTriangle()
int BooleanProcessor::checkTriangle |
( |
int |
iedge1, |
|
|
int |
iedge2, |
|
|
int |
ix, |
|
|
int |
iy |
|
) |
| const |
|
private |
Definition at line 1607 of file BooleanProcessor.h.
1624 for (
int i=0;
i<3;
i++) {
1632 if (a1*
x[1]+b1*
y[1]+
c1 <= 0.1*
m_del)
return 1;
1637 double a2, b2,
c2, a3, b3,
c3;
1644 if (
m_edges[iedge].inext == iedge1)
return 0;
1646 if (
inode ==
k[0])
continue;
1647 if (
inode ==
k[1])
continue;
1648 if (
inode ==
k[2])
continue;
1651 if (a1*
x[1]+b1*
y[1]+
c1 < -0.1*
m_del)
continue;
1652 if (a2*
x[1]+b2*
y[1]+
c2 < -0.1*
m_del)
continue;
1653 if (a3*
x[1]+b3*
y[1]+
c3 < -0.1*
m_del)
continue;
◆ createPolyhedron()
Definition at line 1934 of file BooleanProcessor.h.
1944 int i, iedge, nnode = 0, nface = 0;
1970 if (nface == 0)
return polyhedron;
1971 polyhedron.AllocateMemory(nnode, nface);
1981 int k,
v[4]={0},
f[4]={0};
1983 if (
m_faces[
i].inew == 0)
continue;
1984 v[3] =
f[3] =
k = 0;
1988 std::cerr <<
"BooleanProcessor::createPolyhedron : too many edges" << std::endl;
1998 std::cerr <<
"BooleanProcessor::createPolyhedron : "
1999 <<
"face has only " <<
k <<
" edges"
◆ divideEdge()
void BooleanProcessor::divideEdge |
( |
int & |
i1, |
|
|
int & |
i2 |
|
) |
| |
|
private |
Definition at line 869 of file BooleanProcessor.h.
885 if (i1 < i2) { i2 = i1; }
886 else if (i1 > i2) { i1 = i2; }
887 else { iedges[1] = 0; }
888 if (iedges[0] == iedges[1])
return;
890 int ie1, ie2,
inode = i1;
892 for (
int i=0;
i<2;
i++) {
896 if ((ie1 = iedges[
i]) == 0)
continue;
◆ draw()
void BooleanProcessor::draw |
( |
| ) |
|
◆ draw_contour()
void BooleanProcessor::draw_contour |
( |
int |
, |
|
|
int |
, |
|
|
int |
|
|
) |
| |
◆ draw_edge()
void BooleanProcessor::draw_edge |
( |
int |
, |
|
|
int |
|
|
) |
| |
◆ draw_faces()
void BooleanProcessor::draw_faces |
( |
int |
, |
|
|
int |
, |
|
|
int |
|
|
) |
| |
◆ dump()
void BooleanProcessor::dump |
( |
| ) |
|
◆ execute()
Definition at line 2014 of file BooleanProcessor.h.
2062 <<
"BooleanProcessor: corrupted input polyhedron"
2074 <<
"BooleanProcessor: intersection with empty polyhedron"
2079 <<
"BooleanProcessor: subtraction from empty polyhedron"
2091 <<
"BooleanProcessor: intersection with empty polyhedron"
2111 #define PROCESSOR_ERROR(a_what)
2113 unsigned int try_count = 1;
2189 <<
"BooleanProcessor::execute : unknown faces !!!"
2212 <<
"BooleanProcessor::execute : had converged."
2235 <<
"BooleanProcessor::execute : try another tilt..."
2242 #undef PROCESSOR_ERROR //G.Barrand
◆ findABC()
void BooleanProcessor::findABC |
( |
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2, |
|
|
double & |
a, |
|
|
double & |
b, |
|
|
double & |
c |
|
) |
| const |
|
inlineprivate |
◆ findMinMax()
double BooleanProcessor::findMinMax |
( |
| ) |
|
|
private |
Definition at line 567 of file BooleanProcessor.h.
580 double rmin1[3], rmax1[3];
581 double rmin2[3], rmax2[3];
585 for (
i=0;
i<3;
i++) {
595 for (
i=0;
i<3;
i++) {
605 for (
i=0;
i<3;
i++) {
614 for (
i=0;
i<3;
i++) {
615 m_rmin[
i] = (rmin1[
i] > rmin2[
i]) ? rmin1[
i] : rmin2[
i];
616 m_rmax[
i] = (rmax1[
i] < rmax2[
i]) ? rmax1[
i] : rmax2[
i];
623 for (
i=0;
i<3;
i++) {
624 if ((rmax1[
i]-rmin1[
i]) > del1) del1 = rmax1[
i]-rmin1[
i];
625 if ((rmax2[
i]-rmin2[
i]) > del2) del2 = rmax2[
i]-rmin2[
i];
627 return ((del1 < del2) ? del1 : del2) /
GRANULARITY;
◆ get_num_shift()
int BooleanProcessor::get_num_shift |
( |
| ) |
|
|
static |
◆ get_processor_error()
int BooleanProcessor::get_processor_error |
( |
| ) |
const |
|
inline |
◆ get_shift()
int BooleanProcessor::get_shift |
( |
| ) |
|
|
static |
◆ initiateLists()
void BooleanProcessor::initiateLists |
( |
| ) |
|
|
private |
◆ insertEdge()
◆ invertNewEdges()
void BooleanProcessor::invertNewEdges |
( |
int |
iface | ) |
|
|
private |
◆ mergeContours()
void BooleanProcessor::mergeContours |
( |
int |
ix, |
|
|
int |
iy, |
|
|
int |
kext, |
|
|
int |
kint |
|
) |
| |
|
private |
Definition at line 1535 of file BooleanProcessor.h.
1545 int i1ext, i2ext, i1int, i2int,
i,
k[6];
1557 for (
i=0;
i<3;
i++) {
1571 for (
i=3;
i<6;
i++) {
◆ modifyReference()
void BooleanProcessor::modifyReference |
( |
int |
iface, |
|
|
int |
i1, |
|
|
int |
i2, |
|
|
int |
iref |
|
) |
| |
|
private |
Definition at line 1767 of file BooleanProcessor.h.
1777 int iedge =
m_faces[iface].iold;
1788 <<
"BooleanProcessor::modifyReference : could not find the edge, "
1789 <<
"iface=" << iface <<
", i1,i2=" << i1 <<
"," << i2 <<
", iref=" << iref
◆ print_edge()
void BooleanProcessor::print_edge |
( |
int |
| ) |
|
◆ print_face()
void BooleanProcessor::print_face |
( |
int |
| ) |
|
◆ removeJunkNodes()
void BooleanProcessor::removeJunkNodes |
( |
| ) |
|
|
inlineprivate |
◆ renumberNodes()
void BooleanProcessor::renumberNodes |
( |
int & |
i1, |
|
|
int & |
i2, |
|
|
int & |
i3, |
|
|
int & |
i4 |
|
) |
| |
|
private |
Definition at line 806 of file BooleanProcessor.h.
820 if (i1 == i2)
return;
824 if (i1 == ilast) { i1 = i2;
m_nodes.pop_back();
return; }
825 if (i2 == ilast) { i2 = i1; }
826 if (i3 == ilast) { i3 = i1; }
827 if (i4 == ilast) { i4 = i1; }
◆ selectOutsideFaces()
void BooleanProcessor::selectOutsideFaces |
( |
int & |
ifaces, |
|
|
int & |
iout |
|
) |
| |
|
private |
Definition at line 630 of file BooleanProcessor.h.
640 int i, outflag, iface = ifaces, *prev;
656 for (
i=0;
i<3;
i++) {
664 int npos = 0, nneg = 0;
666 for (
i=0;
i<8;
i++) {
671 if (npos == 8 || nneg == 8) outflag = 1;
◆ set_shift()
void BooleanProcessor::set_shift |
( |
int |
a_shift | ) |
|
|
static |
◆ takePolyhedron()
void BooleanProcessor::takePolyhedron |
( |
const HepPolyhedron & |
p, |
|
|
double |
dx, |
|
|
double |
dy, |
|
|
double |
dz |
|
) |
| |
|
private |
Definition at line 451 of file BooleanProcessor.h.
462 int i,
k, nnode, iNodes[5], iVis[4], iFaces[4];
463 int dnode =
m_nodes.size() - 1;
464 int dface =
m_faces.size() - 1;
473 for (
i=1;
i <=
p.GetNoVertices();
i++) {
474 #ifdef BP_GEANT4 //G.Barrand
475 ppp =
p.GetVertex(
i);
476 ppp.setX(ppp.x()+
dx);
477 ppp.setY(ppp.y()+
dy);
478 ppp.setZ(ppp.z()+dz);
480 ppp =
p.GetVertexFast(
i);
488 for (
int iface=1; iface <=
p.GetNoFacets(); iface++) {
493 p.GetFacet(iface, nnode, iNodes, iVis, iFaces);
494 for (
i=0;
i<nnode;
i++) {
498 if (iNodes[
i] < 1 || iNodes[
i] >
p.GetNoVertices()) {
502 <<
"BooleanProcessor::takePolyhedron : problem 1."
506 if (iFaces[
i] < 1 || iFaces[
i] >
p.GetNoFacets()) {
510 <<
"BooleanProcessor::takePolyhedron : problem 2."
520 iNodes[nnode] = iNodes[0];
522 for (
i=0;
i<nnode;
i++) {
525 iface+dface, iFaces[
i], iVis[
i]));
533 for (
i=0;
i<3;
i++) {
537 for (
i=1;
i<nnode;
i++) {
539 for (
k=0;
k<3;
k++) {
553 for (
i=0;
i<nnode;
i++) { point +=
m_nodes[iNodes[
i]].v; }
554 if (nnode > 1) point *= (1./nnode);
◆ testEdgeVsEdge()
int BooleanProcessor::testEdgeVsEdge |
( |
ExtEdge & |
edge1, |
|
|
ExtEdge & |
edge2 |
|
) |
| |
|
private |
◆ testFaceVsFace()
void BooleanProcessor::testFaceVsFace |
( |
int |
iface1, |
|
|
int |
iface2 |
|
) |
| |
|
private |
◆ testFaceVsPlane()
int BooleanProcessor::testFaceVsPlane |
( |
ExtEdge & |
edge | ) |
|
|
private |
Definition at line 688 of file BooleanProcessor.h.
700 int i, nnode, npos = 0, nneg = 0, nzer = 0;
705 nnode = (
m_faces[iface].iedges[3] == 0) ? 3 : 4;
706 for (
i=0;
i<nnode;
i++) {
719 if (npos == nnode || nneg == nnode)
return OUT_OF_PLANE;
727 int ie1 = 0, ie2 = 0,
s1 = 0,
s2 = 0,
status, nint = 0;
728 enum { PLUS_MINUS, MINUS_PLUS, ZERO_ZERO, ZERO_PLUS, ZERO_MINUS };
731 for (
i=0;
i<nnode;
i++) {
733 if (
dd[
i+1] >= 0)
continue;
735 }
else if (
dd[
i] < 0) {
736 if (
dd[
i+1] <= 0)
continue;
756 if (
s1 != ZERO_ZERO &&
s2 != ZERO_ZERO) {
758 int iedge, i1 = 0, i2 = 0, ii[2];
759 double d1 = 0.,
d2 = 0., d3 = 0.;
760 ii[0] = ie1; ii[1] = ie2;
761 for (
i=0;
i<2;
i++) {
762 iedge =
m_faces[iface].iedges[ii[
i]];
784 if (
s1 == MINUS_PLUS ||
s1 == ZERO_PLUS) {
794 edge.
inext = (
s1 == ZERO_ZERO) ? ie1+1 : ie2+1;
795 if (
s1 == ZERO_PLUS ||
s2 == ZERO_MINUS) {
◆ triangulateContour()
void BooleanProcessor::triangulateContour |
( |
int |
ix, |
|
|
int |
iy, |
|
|
int |
ihead |
|
) |
| |
|
private |
Definition at line 1659 of file BooleanProcessor.h.
1676 int ipnext = ihead, nnode = 1;
1678 if (
m_edges[ipnext].inext > 0) {
1679 ipnext =
m_edges[ipnext].inext;
1682 m_edges[ipnext].inext = ihead;
1692 int iedge1, iedge2, iedge3, istart = 0;
1694 iedge1 =
m_edges[ipnext].inext;
1695 iedge2 =
m_edges[iedge1].inext;
1707 iedge3 =
m_edges[iedge2].inext;
1720 }
else if (istart == iedge1) {
1724 <<
"BooleanProcessor::triangulateContour : "
1725 <<
"could not generate a triangle (infinite loop)"
1734 ipnext =
m_edges[ipnext].inext;
1742 int iface1 =
m_edges[iedge1].iface1;
1756 m_edges[iedge1].iface1 = iface2;
1757 m_edges[iedge2].iface1 = iface2;
1758 ipnext =
m_edges[ipnext].inext;
◆ triangulateFace()
void BooleanProcessor::triangulateFace |
( |
int |
iface | ) |
|
|
private |
Definition at line 1794 of file BooleanProcessor.h.
1808 #ifdef BP_GEANT4 //G.Barrand
1816 if (::fabs(normal[1]) > ::fabs(normal[iz])) iz = 1;
1817 if (::fabs(normal[2]) > ::fabs(normal[iz])) iz = 2;
1818 if (normal[iz] > 0) {
1819 ix = (iz+1)%3; iy = (ix+1)%3;
1821 iy = (iz+1)%3; ix = (iy+1)%3;
1829 int i1, i2, ifirst, iedge, icontour =
m_faces[iface].iold;
1830 while (icontour > 0) {
1840 z += node_1.
v[ix]*node_2.
v[iy]-node_2.
v[ix]*node_1.
v[iy];
1853 <<
"BooleanProcessor::triangulateFace : too small contour"
1857 icontour =
m_edges[iedge].inext;
1865 <<
"BooleanProcessor::triangulateFace : broken contour"
1886 <<
"BooleanProcessor::triangulateFace : "
1887 <<
"could not merge internal contour " << kint
1901 <<
"BooleanProcessor::triangulateFace : "
1902 <<
"triangulateContour failed."
1912 for (
int ifa=nface; ifa<(
int)
m_faces.size(); ifa++) {
1915 if (
m_edges[iedge].iface1 != ifa) {
1919 <<
"BooleanProcessor::triangulateFace : wrong reference to itself, "
1920 <<
"iface=" << ifa <<
", iface1=" <<
m_edges[iedge].iface1
1923 }
else if (
m_edges[iedge].iface2 > 0) {
1926 }
else if (
m_edges[iedge].iface2 < 0) {
◆ m_del
double BooleanProcessor::m_del |
|
private |
◆ m_edges
std::vector<ExtEdge> BooleanProcessor::m_edges |
|
private |
◆ m_external_contours
std::vector<int> BooleanProcessor::m_external_contours |
|
private |
◆ m_faces
std::vector<ExtFace> BooleanProcessor::m_faces |
|
private |
◆ m_ifaces1
int BooleanProcessor::m_ifaces1 |
|
private |
◆ m_ifaces2
int BooleanProcessor::m_ifaces2 |
|
private |
◆ m_internal_contours
std::vector<int> BooleanProcessor::m_internal_contours |
|
private |
◆ m_iout1
int BooleanProcessor::m_iout1 |
|
private |
◆ m_iout2
int BooleanProcessor::m_iout2 |
|
private |
◆ m_iunk1
int BooleanProcessor::m_iunk1 |
|
private |
◆ m_iunk2
int BooleanProcessor::m_iunk2 |
|
private |
◆ m_nodes
std::vector<ExtNode> BooleanProcessor::m_nodes |
|
private |
◆ m_operation
int BooleanProcessor::m_operation |
|
private |
◆ m_processor_error
int BooleanProcessor::m_processor_error |
|
private |
◆ m_result_faces
FaceList BooleanProcessor::m_result_faces |
|
private |
◆ m_rmax
double BooleanProcessor::m_rmax[3] |
|
private |
◆ m_rmin
double BooleanProcessor::m_rmin[3] |
|
private |
◆ m_suitable_faces
FaceList BooleanProcessor::m_suitable_faces |
|
private |
◆ m_unknown_faces
FaceList BooleanProcessor::m_unknown_faces |
|
private |
◆ m_unsuitable_faces
FaceList BooleanProcessor::m_unsuitable_faces |
|
private |
◆ s_ishift
int BooleanProcessor::s_ishift = 0 |
|
staticprivate |
The documentation for this class was generated from the following file:
void testFaceVsFace(int iface1, int iface2)
void caseII(ExtEdge &edge1, ExtEdge &edge2)
std::vector< LUCID_RawData_p1 > t3
#define INSERT_EDGE_TO_THE_LIST(A)
void divideEdge(int &i1, int &i2)
void checkDoubleEdges(int iface)
std::vector< ALFA_RawDataCollection_p1 > t1
void caseEE(ExtEdge &edge1, ExtEdge &edge2)
double distance(const SbVec3d &point) const
void triangulateFace(int iface)
HEPVis::SbPlane HVPlane3D
void assembleNewFaces(int what, int ihead)
FaceList m_unsuitable_faces
void assembleFace(int what, int iface)
std::vector< ExtEdge > m_edges
FaceList m_suitable_faces
static int get_num_shift()
int checkDirection(double *x, double *y) const
std::vector< ExtNode > m_nodes
std::vector< ExtFace > m_faces
int checkIntersection(int ix, int iy, int i1, int i2) const
void invertNewEdges(int iface)
void findABC(double x1, double y1, double x2, double y2, double &a, double &b, double &c) const
std::vector< LUCID_RawDataContainer_p1 > t4
void mergeContours(int ix, int iy, int kext, int kint)
std::vector< int > m_external_contours
void modifyReference(int iface, int i1, int i2, int iref)
int checkTriangle(int iedge1, int iedge2, int ix, int iy) const
std::vector< ALFA_RawDataContainer_p1 > t2
int testFaceVsPlane(ExtEdge &edge)
std::vector< int > m_internal_contours
void takePolyhedron(const HepPolyhedron &p, double, double, double)
void selectOutsideFaces(int &ifaces, int &iout)
HepPolyhedron createPolyhedron()
void renumberNodes(int &i1, int &i2, int &i3, int &i4)
void triangulateContour(int ix, int iy, int ihead)
#define PROCESSOR_ERROR(a_what)
void insertEdge(const ExtEdge &edge)
void caseIE(ExtEdge &edge1, ExtEdge &edge2)
int testEdgeVsEdge(ExtEdge &edge1, ExtEdge &edge2)