36 #include "../geometry/GeomUtils.h"
37 #include "../geometry/GridHelpers.h"
39 #include "../winged_edge/WFillGrid.h"
52 template<
typename G,
typename I>
62 vector<WVertex *> &faceVertices)
64 WFace *face =
nullptr;
77 Vec3r v(-u[0], -u[1], -u[2]);
78 bool noIntersection =
true;
81 for (occluders.initAfterTarget(); occluders.validAfterTarget(); occluders.nextOccludee()) {
84 cout <<
"\t\tEvaluating intersection for occludee " << occluders.getWFace() <<
" and ray "
85 <<
A <<
" * " << u << endl;
88 oface = occluders.getWFace();
89 Polygon3r *p = occluders.getCameraSpacePolygon();
93 if (
nullptr != face) {
100 if (faceVertices.empty()) {
104 for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
107 if ((*fv)->isBoundary()) {
112 for (ie = iebegin; ie != ieend; ++ie) {
113 if ((*ie) ==
nullptr) {
117 WFace *sface = (*ie)->GetbFace();
118 if (sface == oface) {
139 cout <<
"\t\tRejecting occluder for target coincidence." << endl;
149 cout <<
"\t\tRay " <<
A <<
" * " <<
v <<
" intersects at time " <<
t << endl;
150 cout <<
"\t\t(v * normal) == " << (
v * p->
getNormal()) <<
" for normal "
159 noIntersection =
false;
163 cout <<
"\t\tIs occludee" << endl;
170 occluders.reportDepth(
A,
v,
t);
174 if (noIntersection) {
180 template<
typename G,
typename I>
186 A =
Vec3r(((fe)->vertexA()->point3D() + (fe)->vertexB()->point3D()) / 2.0);
187 edgeDir =
Vec3r((fe)->vertexB()->point3D() - (fe)->vertexA()->point3D());
189 origin =
Vec3r((fe)->vertexA()->point3D());
191 if (grid.orthographicProjection()) {
192 u =
Vec3r(0.0, 0.0, grid.viewpoint().z() -
A.z());
195 u =
Vec3r(grid.viewpoint() -
A);
199 vector<WVertex *> faceVertices;
201 WFace *face =
nullptr;
212 findOccludee<G, I>(fe, grid, occluders,
epsilon, oaFace, u,
A, origin, edgeDir, faceVertices);
217 template<
typename G,
typename I>
224 set<ViewShape *> *foundOccluders)
238 if (grid.orthographicProjection()) {
242 vp =
Vec3r(grid.viewpoint());
248 WFace *face =
nullptr;
253 vector<WVertex *> faceVertices;
265 for (occluders.initBeforeTarget(); occluders.validBeforeTarget(); occluders.nextOccluder()) {
270 oface = occluders.getWFace();
271 Polygon3r *p = occluders.getCameraSpacePolygon();
275 cout <<
"\t\tEvaluating intersection for occluder " << (p->
getVertices())[0]
277 <<
"\t\t\tand ray " << vp <<
" * " << u <<
" (center " <<
center <<
")" << endl;
285 vector<Vec3r> points;
287 for (vector<WOEdge *>::const_iterator woe = oface->
getEdgeList().begin(),
291 points.push_back(
Vec3r((*woe)->GetaVertex()->GetVertex()));
309 cout <<
"\t\tDetermining face adjacency...";
317 cout <<
" Rejecting occluder for face concurrency." << endl;
323 for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
326 if ((*fv)->isBoundary()) {
332 for (ie = iebegin; ie != ieend; ++ie) {
333 if ((*ie) ==
nullptr) {
337 WFace *sface = (*ie)->GetbFace();
340 if (sface == oface) {
352 cout <<
" Rejecting occluder for face adjacency." << endl;
366 cout <<
"\t\tRejecting occluder for target coincidence." << endl;
377 cout <<
"\t\tRay should intersect at time " << (rl -
x) <<
". Center: " <<
center
378 <<
", V: " <<
v <<
", RL: " << rl <<
", T:" <<
x << endl;
381 cout <<
"\t\tRay should not intersect. Center: " <<
center <<
", V: " <<
v
382 <<
", RL: " << rl << endl;
390 cout <<
"\t\tRay " <<
center <<
" * " << u <<
" intersects at time " <<
t
391 <<
" (raylength is " << raylength <<
")" << endl;
392 cout <<
"\t\t(u * normal) == " << (u * p->
getNormal()) <<
" for normal " << p->
getNormal()
397 if ((
t > 0.0) && (
t < raylength)) {
400 cout <<
"\t\tIs occluder" << endl;
403 if (foundOccluders !=
nullptr) {
405 foundOccluders->insert(vshape);
409 if (!grid.enableQI()) {
414 occluders.reportDepth(
center, u,
t);
421 fe, grid, occluders,
epsilon, oaWFace, u,
center, origin, edgeDir, faceVertices);
435 template<
typename G,
typename I>
441 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
445 vector<WFace *> wFaces;
446 WFace *wFace =
nullptr;
448 unsigned cntStep = (unsigned)
ceil(0.01f * vedges.size());
450 unsigned qiClasses[256];
451 unsigned maxIndex, maxCard;
453 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
454 if (iRenderMonitor) {
458 if (cnt % cntStep == 0) {
460 ss <<
"Freestyle: Visibility computations " << (100 * cnt / vedges.size()) <<
"%";
461 iRenderMonitor->
setInfo(ss.str());
462 iRenderMonitor->
progress((
float)cnt / vedges.size());
468 cout <<
"Processing ViewEdge " << (*ve)->getId() << endl;
472 if (!(*ve)->isInImage()) {
475 (*ve)->setaShape(
nullptr);
478 cout <<
"\tCulled." << endl;
485 festart = (*ve)->fedgeA();
486 fe = (*ve)->fedgeA();
493 }
while (fe && fe != festart);
495 if (qiMajority == 0) {
499 cout <<
"View Edge in viewport without occludable FEdges: " << (*ve)->
getId() << endl;
504 (*ve)->setaShape(
nullptr);
513 cout <<
"\tqiMajority: " << qiMajority << endl;
521 memset(qiClasses, 0, 256 *
sizeof(*qiClasses));
522 set<ViewShape *> foundOccluders;
524 fe = (*ve)->fedgeA();
530 if ((maxCard < qiMajority)) {
532 tmpQI = computeVisibility<G, I>(
533 ioViewMap, fe, grid,
epsilon, *ve, &wFace, &foundOccluders);
536 cout <<
"\tFEdge: visibility " << tmpQI << endl;
543 cerr <<
"Warning: too many occluding levels" << endl;
548 if (++qiClasses[tmpQI] > maxCard) {
549 maxCard = qiClasses[tmpQI];
556 findOccludee<G, I>(fe, grid,
epsilon, *ve, &wFace);
559 cout <<
"\tFEdge: occludee only (" << (wFace !=
NULL ?
"found" :
"not found") <<
")"
567 vector<Vec3r> vertices;
568 for (
int i = 0, numEdges = wFace->
numberOfEdges(); i < numEdges; ++i) {
574 wFaces.push_back(wFace);
578 cout <<
"\tFound occludee" << endl;
588 }
while ((maxCard < qiMajority) && (fe) && (fe != festart));
592 cout <<
"\tFinished with " << nSamples <<
" samples, maxCard = " << maxCard << endl;
599 for (
unsigned count = 0, i = 0; i < 256; ++i) {
600 count += qiClasses[i];
601 if (
count >= qiMajority) {
609 for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end();
612 (*ve)->AddOccluder((*o));
616 cout <<
"\tConclusion: QI = " << maxIndex <<
", " << (*ve)->occluders_size() <<
" occluders."
623 if (!wFaces.empty()) {
624 if (wFaces.size() <= (
float)nSamples / 2.0f) {
625 (*ve)->setaShape(
nullptr);
629 (*wFaces.begin())->GetVertex(0)->shape()->GetId());
630 (*ve)->setaShape(vshape);
636 if (iRenderMonitor && !vedges.empty()) {
638 ss <<
"Freestyle: Visibility computations " << (100 * cnt / vedges.size()) <<
"%";
639 iRenderMonitor->
setInfo(ss.str());
640 iRenderMonitor->
progress((
float)cnt / vedges.size());
644 template<
typename G,
typename I>
650 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
654 vector<WFace *> wFaces;
655 WFace *wFace =
nullptr;
657 unsigned qiClasses[256];
658 unsigned maxIndex, maxCard;
660 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
661 if (iRenderMonitor && iRenderMonitor->
testBreak()) {
666 cout <<
"Processing ViewEdge " << (*ve)->getId() << endl;
670 if (!(*ve)->isInImage()) {
673 (*ve)->setaShape(
nullptr);
676 cout <<
"\tCulled." << endl;
683 festart = (*ve)->fedgeA();
684 fe = (*ve)->fedgeA();
691 }
while (fe && fe != festart);
693 if (qiMajority == 0) {
697 cout <<
"View Edge in viewport without occludable FEdges: " << (*ve)->
getId() << endl;
702 (*ve)->setaShape(
nullptr);
711 cout <<
"\tqiMajority: " << qiMajority << endl;
719 memset(qiClasses, 0, 256 *
sizeof(*qiClasses));
720 set<ViewShape *> foundOccluders;
722 fe = (*ve)->fedgeA();
728 if ((maxCard < qiMajority)) {
730 tmpQI = computeVisibility<G, I>(
731 ioViewMap, fe, grid,
epsilon, *ve, &wFace, &foundOccluders);
734 cout <<
"\tFEdge: visibility " << tmpQI << endl;
741 cerr <<
"Warning: too many occluding levels" << endl;
746 if (++qiClasses[tmpQI] > maxCard) {
747 maxCard = qiClasses[tmpQI];
754 findOccludee<G, I>(fe, grid,
epsilon, *ve, &wFace);
757 cout <<
"\tFEdge: occludee only (" << (wFace !=
NULL ?
"found" :
"not found") <<
")"
765 vector<Vec3r> vertices;
766 for (
int i = 0, numEdges = wFace->
numberOfEdges(); i < numEdges; ++i) {
772 wFaces.push_back(wFace);
776 cout <<
"\tFound occludee" << endl;
786 }
while ((maxCard < qiMajority) && (fe) && (fe != festart));
790 cout <<
"\tFinished with " << nSamples <<
" samples, maxCard = " << maxCard << endl;
796 (*ve)->setQI(maxIndex);
800 for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end();
803 (*ve)->AddOccluder((*o));
807 cout <<
"\tConclusion: QI = " << maxIndex <<
", " << (*ve)->
occluders_size() <<
" occluders."
812 if (!wFaces.empty()) {
813 if (wFaces.size() <= (
float)nSamples / 2.0f) {
814 (*ve)->setaShape(
nullptr);
818 (*wFaces.begin())->GetVertex(0)->shape()->GetId());
819 (*ve)->setaShape(vshape);
827 template<
typename G,
typename I>
830 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
833 unsigned nSamples = 0;
834 vector<WFace *> wFaces;
835 WFace *wFace =
nullptr;
837 unsigned qiClasses[256];
838 unsigned maxIndex, maxCard;
841 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
843 if (!(*ve)->isInImage()) {
846 (*ve)->setaShape(
nullptr);
851 festart = (*ve)->fedgeA();
852 fe = (*ve)->fedgeA();
857 if (even_test && fe && fe->
isInImage()) {
859 even_test = !even_test;
862 }
while (fe && fe != festart);
864 if (qiMajority == 0) {
868 cout <<
"View Edge in viewport without occludable FEdges: " << (*ve)->
getId() << endl;
873 (*ve)->setaShape(
nullptr);
884 memset(qiClasses, 0, 256 *
sizeof(*qiClasses));
885 set<ViewShape *> foundOccluders;
887 fe = (*ve)->fedgeA();
894 if ((maxCard < qiMajority)) {
896 tmpQI = computeVisibility<G, I>(
897 ioViewMap, fe, grid,
epsilon, *ve, &wFace, &foundOccluders);
902 cerr <<
"Warning: too many occluding levels" << endl;
907 if (++qiClasses[tmpQI] > maxCard) {
908 maxCard = qiClasses[tmpQI];
915 findOccludee<G, I>(fe, grid,
epsilon, *ve, &wFace);
919 vector<Vec3r> vertices;
920 for (
int i = 0, numEdges = wFace->
numberOfEdges(); i < numEdges; ++i) {
926 wFaces.push_back(wFace);
931 even_test = !even_test;
933 }
while ((maxCard < qiMajority) && (fe) && (fe != festart));
936 (*ve)->setQI(maxIndex);
939 for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end();
942 (*ve)->AddOccluder((*o));
946 if (!wFaces.empty()) {
947 if (wFaces.size() < nSamples / 2) {
948 (*ve)->setaShape(
nullptr);
952 (*wFaces.begin())->GetVertex(0)->shape()->GetId());
953 (*ve)->setaShape(vshape);
961 template<
typename G,
typename I>
964 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
968 WFace *wFace =
nullptr;
970 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
972 if (!(*ve)->isInImage()) {
975 (*ve)->setaShape(
nullptr);
978 fe = (*ve)->fedgeA();
981 while (fe && !fe->
isInImage() && fe != festart) {
990 cout <<
"View Edge in viewport without occludable FEdges: " << (*ve)->
getId() << endl;
998 qi = computeVisibility<G, I>(ioViewMap, fe, grid,
epsilon, *ve, &wFace,
NULL);
1003 vector<Vec3r> vertices;
1004 for (
int i = 0, numEdges = wFace->
numberOfEdges(); i < numEdges; ++i) {
1011 (*ve)->setaShape(vshape);
1014 (*ve)->setaShape(
nullptr);
1024 for (
unsigned int i = 0; i < 3; i++) {
1031 cout <<
"Warning: the bbox size is 0 in dimension " << i << endl;
1042 _Grid->displayDebug();
1049 unsigned int sceneNumFaces)
1054 _currentSVertexId = 0;
1057 computeInitialViewEdges(we);
1060 computeCusps(_ViewMap);
1063 ComputeIntersections(_ViewMap, sweep_line,
epsilon);
1066 ComputeEdgesVisibility(_ViewMap, we, bbox, sceneNumFaces, iAlgo,
epsilon);
1078 Vec2r min(proscenium[0], proscenium[2]);
1079 Vec2r max(proscenium[1], proscenium[3]);
1088 return !(point[0] < proscenium[0] || point[0] > proscenium[1] || point[1] < proscenium[2] ||
1089 point[1] > proscenium[3]);
1093 real viewProscenium[4],
1094 real occluderProscenium[4],
1095 bool extensiveFEdgeSearch)
1107 real prosceniumOrigin[2];
1108 prosceniumOrigin[0] = (viewProscenium[1] - viewProscenium[0]) / 2.0;
1109 prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0;
1111 cout <<
"Proscenium culling:" << endl;
1112 cout <<
"Proscenium: [" << viewProscenium[0] <<
", " << viewProscenium[1] <<
", "
1113 << viewProscenium[2] <<
", " << viewProscenium[3] <<
"]" << endl;
1114 cout <<
"Origin: [" << prosceniumOrigin[0] <<
", " << prosceniumOrigin[1] <<
"]" << endl;
1127 ViewMap::viewedges_container::iterator ve, veend;
1129 for (ve = ioViewMap->
ViewEdges().begin(), veend = ioViewMap->
ViewEdges().end(); ve != veend;
1140 bool bestOccluderTargetFound =
false;
1141 FEdge *bestOccluderTarget =
nullptr;
1142 real bestOccluderDistance = 0.0;
1143 FEdge *festart = (*ve)->fedgeA();
1144 FEdge *fe = festart;
1155 if (!bestOccluderTargetFound) {
1161 bestOccluderTargetFound =
true;
1162 bestOccluderTarget = fe;
1167 if (bestOccluderTarget ==
nullptr || d < bestOccluderDistance) {
1169 bestOccluderDistance = d;
1170 bestOccluderTarget = fe;
1181 }
while (fe && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage()));
1185 while (fe && fe != festart) {
1192 if ((*ve)->isInImage() && bestOccluderTarget !=
nullptr && !bestOccluderTargetFound) {
1195 if (point[0] < occluderProscenium[0]) {
1196 occluderProscenium[0] = point[0];
1198 else if (point[0] > occluderProscenium[1]) {
1199 occluderProscenium[1] = point[0];
1201 if (point[1] < occluderProscenium[2]) {
1202 occluderProscenium[2] = point[1];
1204 else if (point[1] > occluderProscenium[3]) {
1205 occluderProscenium[3] = point[1];
1215 occluderProscenium[0] -=
epsilon;
1216 occluderProscenium[1] +=
epsilon;
1217 occluderProscenium[2] -=
epsilon;
1218 occluderProscenium[3] +=
epsilon;
1231 if (extensiveFEdgeSearch) {
1233 for (ve = ioViewMap->
ViewEdges().begin(), veend = ioViewMap->
ViewEdges().end(); ve != veend;
1235 if (!(*ve)->isInImage()) {
1239 FEdge *festart = (*ve)->fedgeA();
1240 FEdge *fe = festart;
1248 }
while (fe && fe != festart);
1258 for (vector<WShape *>::const_iterator it = wshapes.begin(); it != wshapes.end(); it++) {
1259 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
1265 psShape->
setId((*it)->GetId());
1266 psShape->
setName((*it)->getName());
1273 _ViewMap->AddViewShape(vshape);
1276 _pViewEdgeBuilder->setCurrentViewId(_currentId);
1278 _pViewEdgeBuilder->setCurrentFId(_currentFId);
1280 _pViewEdgeBuilder->setCurrentSVertexId(_currentFId);
1281 _pViewEdgeBuilder->BuildViewEdges(
dynamic_cast<WXShape *
>(*it),
1283 _ViewMap->ViewEdges(),
1284 _ViewMap->ViewVertices(),
1286 _ViewMap->SVertices());
1288 _currentId = _pViewEdgeBuilder->currentViewId() + 1;
1289 _currentFId = _pViewEdgeBuilder->currentFId() + 1;
1290 _currentSVertexId = _pViewEdgeBuilder->currentSVertexId() + 1;
1298 vector<ViewVertex *> newVVertices;
1299 vector<ViewEdge *> newVEdges;
1301 ViewMap::viewedges_container::iterator ve = vedges.begin(), veend = vedges.end();
1302 for (; ve != veend; ++ve) {
1303 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
1306 if ((!((*ve)->getNature() &
Nature::SILHOUETTE)) || (!((*ve)->fedgeA()->isSmooth()))) {
1309 FEdge *fe = (*ve)->fedgeA();
1310 FEdge *fefirst = fe;
1312 bool positive =
true;
1315 Vec3r A((fes)->vertexA()->point3d());
1316 Vec3r B((fes)->vertexB()->point3d());
1323 if (_orthographicProjection) {
1324 viewvector =
Vec3r(0.0, 0.0, m.
z() - _viewpoint.z());
1327 viewvector =
Vec3r(m - _viewpoint);
1331 if (((crossP) * (viewvector)) > 0) {
1342 if (((crossP) * (viewvector)) < -0.1) {
1355 if (((crossP) * (viewvector)) > 0.1) {
1365 }
while (fe && fe != fefirst);
1367 for (ve = newVEdges.begin(), veend = newVEdges.end(); ve != veend; ++ve) {
1368 (*ve)->viewShape()->AddEdge(*ve);
1369 vedges.push_back(*ve);
1383 if (_orthographicProjection) {
1384 transform = std::make_unique<BoxGrid::Transform>();
1387 transform = std::make_unique<SphericalGrid::Transform>();
1391 source = std::make_unique<CulledOccluderSource>(*
transform, we, *ioViewMap,
true);
1394 source = std::make_unique<OccluderSource>(*
transform, we);
1399 if (_orthographicProjection) {
1400 BoxGrid grid(*source, *density, ioViewMap, _viewpoint, _EnableQI);
1401 computeCumulativeVisibility<BoxGrid, BoxGrid::Iterator>(
1402 ioViewMap, grid,
epsilon, _pRenderMonitor);
1405 SphericalGrid grid(*source, *density, ioViewMap, _viewpoint, _EnableQI);
1406 computeCumulativeVisibility<SphericalGrid, SphericalGrid::Iterator>(
1407 ioViewMap, grid,
epsilon, _pRenderMonitor);
1421 if (_orthographicProjection) {
1422 transform = std::make_unique<BoxGrid::Transform>();
1425 transform = std::make_unique<SphericalGrid::Transform>();
1429 source = std::make_unique<CulledOccluderSource>(*
transform, we, *ioViewMap,
true);
1432 source = std::make_unique<OccluderSource>(*
transform, we);
1437 if (_orthographicProjection) {
1438 BoxGrid grid(*source, *density, ioViewMap, _viewpoint, _EnableQI);
1439 computeDetailedVisibility<BoxGrid, BoxGrid::Iterator>(
1440 ioViewMap, grid,
epsilon, _pRenderMonitor);
1443 SphericalGrid grid(*source, *density, ioViewMap, _viewpoint, _EnableQI);
1444 computeDetailedVisibility<SphericalGrid, SphericalGrid::Iterator>(
1445 ioViewMap, grid,
epsilon, _pRenderMonitor);
1452 unsigned int sceneNumFaces,
1457 iAlgo = ray_casting;
1462 cout <<
"Using ordinary ray casting" << endl;
1464 BuildGrid(we, bbox, sceneNumFaces);
1465 ComputeRayCastingVisibility(ioViewMap,
epsilon);
1467 case ray_casting_fast:
1469 cout <<
"Using fast ray casting" << endl;
1471 BuildGrid(we, bbox, sceneNumFaces);
1472 ComputeFastRayCastingVisibility(ioViewMap,
epsilon);
1474 case ray_casting_very_fast:
1476 cout <<
"Using very fast ray casting" << endl;
1478 BuildGrid(we, bbox, sceneNumFaces);
1479 ComputeVeryFastRayCastingVisibility(ioViewMap,
epsilon);
1481 case ray_casting_culled_adaptive_traditional:
1483 cout <<
"Using culled adaptive grid with heuristic density and traditional QI calculation"
1488 ComputeDetailedVisibility(ioViewMap, we, bbox,
epsilon,
true, factory);
1503 case ray_casting_adaptive_traditional:
1506 <<
"Using unculled adaptive grid with heuristic density and traditional QI calculation"
1511 ComputeDetailedVisibility(ioViewMap, we, bbox,
epsilon,
false, factory);
1517 case ray_casting_culled_adaptive_cumulative:
1519 cout <<
"Using culled adaptive grid with heuristic density and cumulative QI calculation"
1524 ComputeCumulativeVisibility(ioViewMap, we, bbox,
epsilon,
true, factory);
1530 case ray_casting_adaptive_cumulative:
1532 cout <<
"Using unculled adaptive grid with heuristic density and cumulative QI calculation"
1537 ComputeCumulativeVisibility(ioViewMap, we, bbox,
epsilon,
false, factory);
1553 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
1554 bool progressBarDisplay =
false;
1555 unsigned progressBarStep = 0;
1556 unsigned vEdgesSize = vedges.size();
1557 unsigned fEdgesSize = ioViewMap->
FEdges().size();
1561 progressBarStep = vEdgesSize / progressBarSteps;
1562 _pProgressBar->reset();
1563 _pProgressBar->setLabelText(
"Computing Ray casting Visibility");
1564 _pProgressBar->setTotalSteps(progressBarSteps);
1565 _pProgressBar->setProgress(0);
1566 progressBarDisplay =
true;
1569 unsigned counter = progressBarStep;
1570 FEdge *fe, *festart;
1572 vector<Polygon3r *> aFaces;
1575 unsigned qiClasses[256];
1576 unsigned maxIndex, maxCard;
1577 unsigned qiMajority;
1578 static unsigned timestamp = 1;
1579 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
1580 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
1585 cout <<
"Processing ViewEdge " << (*ve)->
getId() << endl;
1588 festart = (*ve)->fedgeA();
1589 fe = (*ve)->fedgeA();
1594 }
while (fe && fe != festart);
1598 cout <<
"\tqiMajority: " << qiMajority << endl;
1606 fe = (*ve)->fedgeA();
1607 memset(qiClasses, 0, 256 *
sizeof(*qiClasses));
1608 set<ViewShape *> occluders;
1610 if ((maxCard < qiMajority)) {
1611 tmpQI = ComputeRayCastingVisibility(fe, _Grid,
epsilon, occluders, &aFace, timestamp++);
1615 cout <<
"\tFEdge: visibility " << tmpQI << endl;
1621 cerr <<
"Warning: too many occluding levels" << endl;
1626 if (++qiClasses[tmpQI] > maxCard) {
1627 maxCard = qiClasses[tmpQI];
1633 FindOccludee(fe, _Grid,
epsilon, &aFace, timestamp++);
1636 cout <<
"\tFEdge: occludee only (" << (aFace !=
NULL ?
"found" :
"not found") <<
")"
1644 aFaces.push_back(aFace);
1648 cout <<
"\tFound occludee" << endl;
1662 }
while ((maxCard < qiMajority) && (fe) && (fe != festart));
1665 cout <<
"\tFinished with " << nSamples <<
" samples, maxCard = " << maxCard << endl;
1671 (*ve)->setQI(maxIndex);
1673 for (set<ViewShape *>::iterator o = occluders.begin(), oend = occluders.end(); o != oend;
1675 (*ve)->AddOccluder((*o));
1679 cout <<
"\tConclusion: QI = " << maxIndex <<
", " << (*ve)->
occluders_size() <<
" occluders."
1684 if (!aFaces.empty()) {
1685 if (aFaces.size() <= (
float)nSamples / 2.0f) {
1686 (*ve)->setaShape(
nullptr);
1689 vector<Polygon3r *>::iterator p = aFaces.begin();
1693 (*ve)->setaShape(vshape);
1697 if (progressBarDisplay) {
1700 counter = progressBarStep;
1701 _pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
1710 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
1711 bool progressBarDisplay =
false;
1712 unsigned progressBarStep = 0;
1713 unsigned vEdgesSize = vedges.size();
1714 unsigned fEdgesSize = ioViewMap->
FEdges().size();
1718 progressBarStep = vEdgesSize / progressBarSteps;
1719 _pProgressBar->reset();
1720 _pProgressBar->setLabelText(
"Computing Ray casting Visibility");
1721 _pProgressBar->setTotalSteps(progressBarSteps);
1722 _pProgressBar->setProgress(0);
1723 progressBarDisplay =
true;
1726 unsigned counter = progressBarStep;
1727 FEdge *fe, *festart;
1728 unsigned nSamples = 0;
1729 vector<Polygon3r *> aFaces;
1732 unsigned qiClasses[256];
1733 unsigned maxIndex, maxCard;
1734 unsigned qiMajority;
1735 static unsigned timestamp = 1;
1737 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
1738 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
1742 festart = (*ve)->fedgeA();
1743 fe = (*ve)->fedgeA();
1748 }
while (fe && fe != festart);
1749 if (qiMajority >= 4) {
1756 set<ViewShape *> occluders;
1762 memset(qiClasses, 0, 256 *
sizeof(*qiClasses));
1763 fe = (*ve)->fedgeA();
1766 if ((maxCard < qiMajority)) {
1767 tmpQI = ComputeRayCastingVisibility(fe, _Grid,
epsilon, occluders, &aFace, timestamp++);
1772 cerr <<
"Warning: too many occluding levels" << endl;
1777 if (++qiClasses[tmpQI] > maxCard) {
1778 maxCard = qiClasses[tmpQI];
1784 FindOccludee(fe, _Grid,
epsilon, &aFace, timestamp++);
1789 aFaces.push_back(aFace);
1798 }
while ((maxCard < qiMajority) && (fe) && (fe != festart));
1800 (*ve)->setQI(maxIndex);
1802 if (!aFaces.empty()) {
1803 if (aFaces.size() < nSamples / 2) {
1804 (*ve)->setaShape(
nullptr);
1807 vector<Polygon3r *>::iterator p = aFaces.begin();
1812 for (; p != pend; ++p) {
1823 (*ve)->setaShape(vshape);
1830 if (progressBarDisplay) {
1833 counter = progressBarStep;
1834 _pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
1843 vector<ViewEdge *> &vedges = ioViewMap->
ViewEdges();
1844 bool progressBarDisplay =
false;
1845 unsigned progressBarStep = 0;
1846 unsigned vEdgesSize = vedges.size();
1847 unsigned fEdgesSize = ioViewMap->
FEdges().size();
1851 progressBarStep = vEdgesSize / progressBarSteps;
1852 _pProgressBar->reset();
1853 _pProgressBar->setLabelText(
"Computing Ray casting Visibility");
1854 _pProgressBar->setTotalSteps(progressBarSteps);
1855 _pProgressBar->setProgress(0);
1856 progressBarDisplay =
true;
1859 unsigned counter = progressBarStep;
1863 static unsigned timestamp = 1;
1864 for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
1865 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
1869 set<ViewShape *> occluders;
1871 fe = (*ve)->fedgeA();
1872 qi = ComputeRayCastingVisibility(fe, _Grid,
epsilon, occluders, &aFace, timestamp++);
1877 (*ve)->setaShape(vshape);
1880 (*ve)->setaShape(
nullptr);
1885 if (progressBarDisplay) {
1888 counter = progressBarStep;
1889 _pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
1904 vector<WVertex *> &faceVertices)
1906 WFace *face =
nullptr;
1916 OccludersSet::iterator p, pend;
1918 *oaPolygon =
nullptr;
1922 Vec3r v(-u[0], -u[1], -u[2]);
1925 bool noIntersection =
true;
1926 real mint = FLT_MAX;
1928 for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) {
1933 Vec3r v1(((*p)->getVertices())[0]);
1941 if (face == oface) {
1945 if (faceVertices.empty()) {
1949 for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
1952 if ((*fv)->isBoundary()) {
1957 for (ie = iebegin; ie != ieend; ++ie) {
1958 if ((*ie) ==
nullptr) {
1962 WFace *sface = (*ie)->GetbFace();
1963 if (sface == oface) {
1982 if ((*p)->rayIntersect(
A,
v,
t, t_u, t_v)) {
1988 noIntersection =
false;
1996 if (noIntersection) {
1997 *oaPolygon =
nullptr;
2010 A =
Vec3r(((fe)->vertexA()->point3D() + (fe)->vertexB()->point3D()) / 2.0);
2011 edgeDir =
Vec3r((fe)->vertexB()->point3D() - (fe)->vertexA()->point3D());
2013 origin =
Vec3r((fe)->vertexA()->point3D());
2015 if (_orthographicProjection) {
2016 u =
Vec3r(0.0, 0.0, _viewpoint.z() -
A.z());
2019 u =
Vec3r(_viewpoint -
A);
2023 cerr <<
"Warning: point is out of the grid for fedge " << fe->
getId().
getFirst() <<
"-"
2027 vector<WVertex *> faceVertices;
2029 WFace *face =
nullptr;
2038 return FindOccludee(
2039 fe, iGrid,
epsilon, oaPolygon, timestamp, u,
A, origin, edgeDir, faceVertices);
2045 set<ViewShape *> &oOccluders,
2064 if ((
center.x() < gridOrigin.
x()) || (
center.y() < gridOrigin.
y()) ||
2065 (
center.z() < gridOrigin.
z()) || (
center.x() > gridExtremity.
x()) ||
2066 (
center.y() > gridExtremity.
y()) || (
center.z() > gridExtremity.
z())) {
2067 cerr <<
"Warning: point is out of the grid for fedge " << fe->
getId() << endl;
2076 if ((
A.x() < viewport[0]) || (
A.x() > viewport[2]) || (
A.y() < viewport[1]) ||
2077 (
A.y() > viewport[3]) || (
B.x() < viewport[0]) || (
B.x() > viewport[2]) ||
2078 (
B.y() < viewport[1]) || (
B.y() > viewport[3])) {
2079 cerr <<
"Warning: point is out of the grid for fedge " << fe->
getId() << endl;
2085 if (_orthographicProjection) {
2089 vp =
Vec3r(_viewpoint);
2104 WFace *face =
nullptr;
2109 vector<WVertex *> faceVertices;
2114 OccludersSet::iterator p, pend;
2119 for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) {
2127 cout <<
"\t\tEvaluating intersection for occluder " << ((*p)->getVertices())[0]
2128 << ((*p)->getVertices())[1] << ((*p)->getVertices())[2] << endl
2129 <<
"\t\t\tand ray " << vp <<
" * " << u <<
" (center " <<
center <<
")" << endl;
2132 Vec3r v1(((*p)->getVertices())[0]);
2139 cout <<
"\t\tp: " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1]
2140 << ((*p)->getVertices())[2] <<
", norm: " << (*p)->getNormal() << endl;
2147 cout <<
"\t\tDetermining face adjacency...";
2152 if (face == oface) {
2155 cout <<
" Rejecting occluder for face concurrency." << endl;
2161 for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
2164 if ((*fv)->isBoundary()) {
2170 for (ie = iebegin; ie != ieend; ++ie) {
2171 if ((*ie) ==
nullptr) {
2175 WFace *sface = (*ie)->GetbFace();
2178 if (sface == oface) {
2190 cout <<
" Rejecting occluder for face adjacency." << endl;
2205 cout <<
"\t\tRejecting occluder for target coincidence." << endl;
2212 if ((*p)->rayIntersect(
center, u,
t, t_u, t_v)) {
2215 cout <<
"\t\tRay " << vp <<
" * " << u <<
" intersects at time " <<
t <<
" (raylength is "
2216 << raylength <<
")" << endl;
2217 cout <<
"\t\t(u * normal) == " << (u *
normal) <<
" for normal " <<
normal << endl;
2221 if ((
t > 0.0) && (
t < raylength)) {
2224 cout <<
"\t\tIs occluder" << endl;
2229 oOccluders.insert(vshape);
2240 FindOccludee(fe, iGrid,
epsilon, oaPolygon, timestamp, u,
center, origin, edgeDir, faceVertices);
2251 ComputeSweepLineIntersections(ioViewMap,
epsilon);
2259 for (ViewMap::viewvertices_container::iterator vv = vvertices.begin(), vvend = vvertices.end();
2264 cout <<
"TVertex " << tvertex->
getId() <<
" has :" << endl;
2265 cout <<
"FrontEdgeA: " << tvertex->
frontEdgeA().first << endl;
2266 cout <<
"FrontEdgeB: " << tvertex->
frontEdgeB().first << endl;
2267 cout <<
"BackEdgeA: " << tvertex->
backEdgeA().first << endl;
2268 cout <<
"BackEdgeB: " << tvertex->
backEdgeB().first << endl << endl;
2287 for (
unsigned int i = 0; i < 3; i++) {
2315 real tx =
x->getParameter(edge);
2316 real ty =
y->getParameter(edge);
2341 vector<SVertex *> &svertices = ioViewMap->
SVertices();
2342 bool progressBarDisplay =
false;
2343 unsigned sVerticesSize = svertices.size();
2344 unsigned fEdgesSize = ioViewMap->
FEdges().size();
2348 for (ViewMap::fedges_container::const_iterator f = fedges.begin(), end = fedges.end();
2351 cout << (*f)->aMaterialIndex() <<
"-" << (*f)->bMaterialIndex() << endl;
2355 unsigned progressBarStep = 0;
2359 progressBarStep = sVerticesSize / progressBarSteps;
2360 _pProgressBar->reset();
2361 _pProgressBar->setLabelText(
"Computing Sweep Line Intersections");
2362 _pProgressBar->setTotalSteps(progressBarSteps);
2363 _pProgressBar->setProgress(0);
2364 progressBarDisplay =
true;
2367 unsigned counter = progressBarStep;
2373 vector<FEdge *> &ioEdges = ioViewMap->
FEdges();
2375 vector<segment *> segments;
2377 vector<FEdge *>::iterator fe, fend;
2379 for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) {
2380 segment *s =
new segment((*fe), (*fe)->vertexA()->point2D(), (*fe)->vertexB()->point2D());
2381 (*fe)->userdata = s;
2382 segments.push_back(s);
2385 vector<segment *> vsegments;
2386 for (vector<SVertex *>::iterator sv = svertices.begin(), svend = svertices.end(); sv != svend;
2388 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
2392 const vector<FEdge *> &vedges = (*sv)->fedges();
2394 for (vector<FEdge *>::const_iterator sve = vedges.begin(), sveend = vedges.end();
2397 vsegments.push_back((
segment *)((*sve)->userdata));
2400 Vec3r evt((*sv)->point2D());
2404 if (progressBarDisplay) {
2407 counter = progressBarStep;
2408 _pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
2414 if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
2416 if (!segments.empty()) {
2417 vector<segment *>::iterator s, send;
2418 for (s = segments.begin(), send = segments.end(); s != send; s++) {
2426 for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) {
2427 (*fe)->userdata =
nullptr;
2431 vector<FEdge *> newEdges;
2440 vector<intersection *>::iterator i, iend;
2441 for (i = intersections.begin(), iend = intersections.end(); i != iend; i++) {
2442 FEdge *fA = (*i)->EdgeA->edge();
2443 FEdge *fB = (*i)->EdgeB->edge();
2459 cerr <<
"Warning: 2D intersection out of range for edge " << fA->
vertexA()->
getId() <<
" - "
2464 cerr <<
"Warning: 2D intersection out of range for edge " << fB->
vertexA()->
getId() <<
" - "
2472 cerr <<
"Warning: 3D intersection out of range for edge " << fA->
vertexA()->
getId() <<
" - "
2477 cerr <<
"Warning: 3D intersection out of range for edge " << fB->
vertexA()->
getId() <<
" - "
2484 printf(
"ta %.12e\n", ta);
2485 printf(
"tb %.12e\n", tb);
2486 printf(
"a1 %e, %e -- a2 %e, %e\n", a1[0], a1[1], a2[0], a2[1]);
2487 printf(
"b1 %e, %e -- b2 %e, %e\n", b1[0], b1[1], b2[0], b2[1]);
2491 printf(
"Ta %.12e\n", Ta);
2494 printf(
"Tb %.12e\n", Tb);
2496 printf(
"A1 %e, %e, %e -- A2 %e, %e, %e\n",
A1[0],
A1[1],
A1[2],
A2[0],
A2[1],
A2[2]);
2497 printf(
"B1 %e, %e, %e -- B2 %e, %e, %e\n",
B1[0],
B1[1],
B1[2],
B2[0],
B2[1],
B2[2]);
2503 Vec3r(a1 + ta * (a2 - a1)),
2506 Vec3r(b1 + tb * (b2 - b1)),
2514 progressBarStep = 0;
2516 if (progressBarDisplay) {
2517 unsigned iEdgesSize = iedges.size();
2519 progressBarStep = iEdgesSize / progressBarSteps;
2520 _pProgressBar->reset();
2521 _pProgressBar->setLabelText(
"Splitting intersected edges");
2522 _pProgressBar->setTotalSteps(progressBarSteps);
2523 _pProgressBar->setProgress(0);
2526 counter = progressBarStep;
2528 vector<TVertex *> edgeVVertices;
2529 vector<ViewEdge *> newVEdges;
2530 vector<segment *>::iterator s, send;
2531 for (s = iedges.begin(), send = iedges.end(); s != send; s++) {
2532 edgeVVertices.clear();
2536 FEdge *fedge = (*s)->edge();
2540 vector<intersection *> &eIntersections = (*s)->intersections();
2543 for (i = eIntersections.begin(), iend = eIntersections.end(); i != iend; i++) {
2544 edgeVVertices.push_back((
TVertex *)(*i)->userdata);
2549 if (progressBarDisplay) {
2552 counter = progressBarStep;
2553 _pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
2559 for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) {
2560 (*fe)->userdata =
nullptr;
2564 if (!segments.empty()) {
2565 for (s = segments.begin(), send = segments.end(); s != send; s++) {
typedef float(TangentPoint)[2]
Class to define a cell grid surrounding the projected image of a scene.
Class to define a cell grid surrounding the projected image of a scene.
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Class to define a cell grid surrounding the projected image of a scene.
Class to define a cell grid surrounding the projected image of a scene.
Class to define a cell grid surrounding the projected image of a scene.
Class to build silhouette edges from a Winged-Edge structure.
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void sort(btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V, int t)
Helper function of 3X3 SVD for sorting singular values.
const Point & getMax() const
const Point & getMin() const
void setOccludeeEmpty(bool iempty)
int occluders_size() const
ViewEdge * viewedge() const
void setIsInImage(bool iFlag)
void setaFace(Polygon3r &iFace)
void setOccludeeIntersection(const Vec3r &iPoint)
bool rayIntersect(const Vec3r &orig, const Vec3r &dir, real &t, real &u, real &v, real epsilon=M_EPSILON) const
const vector< Point > & getVertices() const
virtual AutoPtr< GridDensityProvider > newGridDensityProvider(OccluderSource &source, const real proscenium[4])=0
const Vec3r & getOrigin() const
void castInfiniteRay(const Vec3r &orig, const Vec3r &dir, OccludersSet &occluders, unsigned timestamp)
void castRay(const Vec3r &orig, const Vec3r &end, OccludersSet &occluders, unsigned timestamp)
id_type getSecond() const
void setInfo(string info)
void setFrsMaterials(const vector< FrsMaterial > &iMaterials)
void setLibraryPath(const string &path)
void setName(const string &name)
const Vec3r & point2d() const
const Vec3r & point3D() const
const Vec3r & point2D() const
virtual real getProjectedY() const
virtual real getProjectedX() const
static real ImageToWorldParameter(FEdge *fe, real t)
static void retrieveViewport(int viewport[4])
vector< Intersection< Segment< T, Point > > * > & intersections()
void process(Point &p, vector< Segment< T, Point > * > &segments, binary_rule< Segment< T, Point >, Segment< T, Point >> &binrule, real epsilon=M_EPSILON)
vector< Segment< T, Point > * > & intersectedEdges()
directedViewEdge & frontEdgeB()
directedViewEdge & frontEdgeA()
directedViewEdge & backEdgeB()
directedViewEdge & backEdgeA()
Vec< T, N > & normalize()
void ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real epsilon=1.0e-6)
void ComputeCumulativeVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox< Vec3r > &bbox, real epsilon, bool cull, GridDensityProviderFactory &factory)
void ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox< Vec3r > &bbox, unsigned int sceneNumFaces, visibility_algo iAlgo=ray_casting, real epsilon=1.0e-6)
void FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3r **oaPolygon, unsigned timestamp)
void CullViewEdges(ViewMap *ioViewMap, real viewProscenium[4], real occluderProscenium[4], bool extensiveFEdgeSearch=true)
void computeInitialViewEdges(WingedEdge &)
void ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilon=1.0e-6)
void BuildGrid(WingedEdge &we, const BBox< Vec3r > &bbox, unsigned int sceneNumFaces)
void computeCusps(ViewMap *ioViewMap)
ViewMap * BuildViewMap(WingedEdge &we, visibility_algo iAlgo, real epsilon, const BBox< Vec3r > &bbox, unsigned int sceneNumFaces)
void ComputeIntersections(ViewMap *ioViewMap, intersection_algo iAlgo=sweep_line, real epsilon=1.0e-06)
void ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsilon=1.0e-6)
void ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, real epsilon=1.0e-6)
void ComputeDetailedVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox< Vec3r > &bbox, real epsilon, bool cull, GridDensityProviderFactory &factory)
vector< FEdge * > fedges_container
ViewShape * viewShape(unsigned id)
vector< ViewVertex * > viewvertices_container
vector< ViewEdge * > viewedges_container
TVertex * CreateTVertex(const Vec3r &iA3D, const Vec3r &iA2D, FEdge *iFEdgeA, const Vec3r &iB3D, const Vec3r &iB2D, FEdge *iFEdgeB, const Id &id)
svertices_container & SVertices()
viewvertices_container & ViewVertices()
fedges_container & FEdges()
ViewVertex * InsertViewVertex(SVertex *iVertex, vector< ViewEdge * > &newViewEdges)
viewedges_container & ViewEdges()
void SplitEdge(FEdge *fe, const vector< TVertex * > &iViewVertices, vector< FEdge * > &ioNewEdges, vector< ViewEdge * > &ioNewViewEdges)
virtual Nature::VertexNature getNature() const
void setNature(Nature::VertexNature iNature)
int numberOfEdges() const
WVertex * GetVertex(unsigned int index)
const vector< WOEdge * > & getEdgeList()
void RetrieveVertexList(vector< WVertex * > &oVertices)
vector< WShape * > & getWShapes()
IconTextureDrawCall normal
bool intersect2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B)
intersection_test intersectRayPlane(const Vec3r &orig, const Vec3r &dir, const Vec3r &norm, const real d, real &t, const real epsilon)
VecMat::Vec3< real > Vec3r
void getDefaultViewProscenium(real viewProscenium[4])
static const EdgeNature BORDER
static const VertexNature T_VERTEX
static const VertexNature CUSP
static const EdgeNature SILHOUETTE
static void computeDetailedVisibility(ViewMap *ioViewMap, G &grid, real epsilon, RenderMonitor *iRenderMonitor)
static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
static real distance2D(const Vec3r &point, const real origin[2])
static double B1(double u)
static const Global & _global
static const unsigned gProgressBarMinSize
static const unsigned gProgressBarMaxSteps
static bool insideProscenium(const real proscenium[4], const Vec3r &point)
static void computeCumulativeVisibility(ViewMap *ioViewMap, G &grid, real epsilon, RenderMonitor *iRenderMonitor)
Segment< FEdge *, Vec3r > segment
static int computeVisibility(ViewMap *viewMap, FEdge *fe, G &grid, real epsilon, ViewEdge *, WFace **oaWFace, set< ViewShape * > *foundOccluders)
vector< Polygon3r * > OccludersSet
static void findOccludee(FEdge *fe, G &, I &occluders, real epsilon, WFace **oaWFace, Vec3r &u, Vec3r &A, Vec3r &origin, Vec3r &edgeDir, vector< WVertex * > &faceVertices)
static double B2(double u)
static bool crossesProscenium(real proscenium[4], FEdge *fe)
static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
INLINE Rall1d< T, V, S > hypot(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
bool operator()(intersection *x, intersection *y)
less_Intersection(segment *iEdge)
bool operator()(SVertex *x, SVertex *y)
bool operator()(segment &s1, segment &s2) override
ccl_device_inline float2 fabs(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)