Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselationhelpers.cpp

    rfc9992 r299554  
    8181
    8282  if (fabs(m11) < MYEPSILON)
    83     eLog() << Verbose(1) << "three points are colinear." << endl;
     83    DoeLog(1) && (eLog()<< Verbose(1) << "three points are colinear." << endl);
    8484
    8585  center->x[0] =  0.5 * m12/ m11;
     
    8888
    8989  if (fabs(a.Distance(center) - RADIUS) > MYEPSILON)
    90     eLog() << Verbose(1) << "The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl;
     90    DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl);
    9191
    9292  gsl_matrix_free(A);
     
    132132  Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma)));
    133133  NewUmkreismittelpunkt->CopyVector(Center);
    134   Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
     134  DoLog(1) && (Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n");
    135135  // Here we calculated center of circumscribing circle, using barycentric coordinates
    136   Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
     136  DoLog(1) && (Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n");
    137137
    138138  TempNormal.CopyVector(&a);
     
    158158  TempNormal.Normalize();
    159159  Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius);
    160   Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
     160  DoLog(1) && (Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n");
    161161  TempNormal.Scale(Restradius);
    162   Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
     162  DoLog(1) && (Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n");
    163163
    164164  Center->AddVector(&TempNormal);
    165   Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n";
     165  DoLog(1) && (Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n");
    166166  GetSphere(&OtherCenter, a, b, c, RADIUS);
    167   Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
     167  DoLog(1) && (Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n");
    168168};
    169169
     
    192192  //Log() << Verbose(1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
    193193  if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) {
    194     eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl;
     194    DoeLog(2) && (eLog()<< Verbose(2) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl);
    195195  }
    196196
     
    236236  // test whether new center is on the parameter circle's plane
    237237  if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    238     eLog() << Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal))  << "!" << endl;
     238    DoeLog(1) && (eLog()<< Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal))  << "!" << endl);
    239239    helper.ProjectOntoPlane(&CirclePlaneNormal);
    240240  }
     
    242242  // test whether the new center vector has length of CircleRadius
    243243  if (fabs(radius - CircleRadius) > HULLEPSILON)
    244     eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
     244    DoeLog(1) && (eLog()<< Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl);
    245245  alpha = helper.Angle(&RelativeOldSphereCenter);
    246246  // make the angle unique by checking the halfplanes/search direction
    247247  if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)  // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals
    248248    alpha = 2.*M_PI - alpha;
    249   Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl;
     249  DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl);
    250250  radius = helper.Distance(&RelativeOldSphereCenter);
    251251  helper.ProjectOntoPlane(&NormalVector);
    252252  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
    253253  if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) {
    254     Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
     254    DoLog(1) && (Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl);
    255255    return alpha;
    256256  } else {
    257     Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl;
     257    DoLog(1) && (Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl);
    258258    return 2.*M_PI;
    259259  }
     
    364364
    365365        if (status == GSL_SUCCESS) {
    366           Log() << Verbose(1) << "converged to minimum" <<  endl;
     366          DoLog(1) && (Log() << Verbose(1) << "converged to minimum" <<  endl);
    367367        }
    368368    } while (status == GSL_CONTINUE && iter < 100);
     
    394394
    395395  if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) {
    396     Log() << Verbose(1) << "true intersection." << endl;
     396    DoLog(1) && (Log() << Verbose(1) << "true intersection." << endl);
    397397    result = true;
    398398  } else {
    399     Log() << Verbose(1) << "intersection out of region of interest." << endl;
     399    DoLog(1) && (Log() << Verbose(1) << "intersection out of region of interest." << endl);
    400400    result = false;
    401401  }
     
    432432  }
    433433
    434   Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
     434  DoLog(1) && (Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl);
    435435
    436436  return phi;
     
    479479    for (int j=i+1; j<3; j++) {
    480480      if (nodes[i] == NULL) {
    481         Log() << Verbose(1) << "Node nr. " << i << " is not yet present." << endl;
     481        DoLog(1) && (Log() << Verbose(1) << "Node nr. " << i << " is not yet present." << endl);
    482482        result = true;
    483483      } else if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) {  // there already is a line
     
    493493        }
    494494      } else { // no line
    495         Log() << Verbose(1) << "The line between " << *nodes[i] << " and " << *nodes[j] << " is not yet present, hence no need for a degenerate triangle." << endl;
     495        DoLog(1) && (Log() << Verbose(1) << "The line between " << *nodes[i] << " and " << *nodes[j] << " is not yet present, hence no need for a degenerate triangle." << endl);
    496496        result = true;
    497497      }
    498498    }
    499499  if ((!result) && (counter > 1)) {
    500     Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
     500    DoLog(1) && (Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl);
    501501    result = true;
    502502  }
     
    512512//  Vector BaseLineVector, OrthogonalVector, helper;
    513513//  if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
    514 //    eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
     514//    DoeLog(1) && (eLog()<< Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl);
    515515//    //return false;
    516516//    exit(1);
     
    571571  for(int i=0;i<NDIM;i++) // store indices of this cell
    572572    N[i] = LC->n[i];
    573   Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     573  DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);
    574574
    575575  LC->GetNeighbourBounds(Nlower, Nupper);
     
    578578    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    579579      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    580         const LinkedNodes *List = LC->GetCurrentCell();
     580        const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
    581581        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    582582        if (List != NULL) {
    583           for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     583          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    584584            helper.CopyVector(Point);
    585585            helper.SubtractVector((*Runner)->node);
     
    626626  for(int i=0;i<NDIM;i++) // store indices of this cell
    627627    N[i] = LC->n[i];
    628   Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     628  DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);
    629629
    630630  LC->GetNeighbourBounds(Nlower, Nupper);
     
    633633    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    634634      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    635         const LinkedNodes *List = LC->GetCurrentCell();
     635        const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
    636636        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    637637        if (List != NULL) {
    638           for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     638          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    639639            helper.CopyVector(Point);
    640640            helper.SubtractVector((*Runner)->node);
     
    659659  // output
    660660  if (closestPoint != NULL) {
    661     Log() << Verbose(1) << "Closest point is " << *closestPoint;
     661    DoLog(1) && (Log() << Verbose(1) << "Closest point is " << *closestPoint);
    662662    if (SecondPoint != NULL)
    663       Log() << Verbose(0) << " and second closest is " << *SecondPoint;
    664     Log() << Verbose(0) << "." << endl;
     663      DoLog(0) && (Log() << Verbose(0) << " and second closest is " << *SecondPoint);
     664    DoLog(0) && (Log() << Verbose(0) << "." << endl);
    665665  }
    666666  return closestPoint;
     
    686686  Normal.VectorProduct(&OtherBaseline);
    687687  Normal.Normalize();
    688   Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
     688  DoLog(1) && (Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl);
    689689
    690690  // project one offset point of OtherBase onto this plane (and add plane offset vector)
     
    703703  Normal.CopyVector(Intersection);
    704704  Normal.SubtractVector(Base->endpoints[0]->node->node);
    705   Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
     705  DoLog(1) && (Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl);
    706706
    707707  return Intersection;
     
    764764    }
    765765  } else {
    766     eLog() << Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl;
     766    DoeLog(1) && (eLog()<< Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl);
    767767  }
    768768  delete(center);
     
    839839    *rasterfile << "9\n#  terminating special property\n";
    840840  } else {
    841     eLog() << Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl;
     841    DoeLog(1) && (eLog()<< Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl);
    842842  }
    843843  IncludeSphereinRaster3D(rasterfile, Tess, cloud);
     
    862862    } else {
    863863      *tecplot << N << "-";
    864       for (int i=0;i<3;i++)
    865         *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
     864      if (TesselStruct->LastTriangle != NULL) {
     865        for (int i=0;i<3;i++)
     866          *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
     867      } else {
     868        *tecplot << "none";
     869      }
    866870    }
    867871    *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
     
    881885    *tecplot << endl;
    882886    // print connectivity
    883     Log() << Verbose(1) << "The following triangles were created:" << endl;
     887    DoLog(1) && (Log() << Verbose(1) << "The following triangles were created:" << endl);
    884888    for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) {
    885       Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl;
     889      DoLog(1) && (Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl);
    886890      *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
    887891    }
     
    904908  for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
    905909    point = PointRunner->second;
    906     Log() << Verbose(1) << "INFO: Current point is " << *point << "." << endl;
     910    DoLog(1) && (Log() << Verbose(1) << "INFO: Current point is " << *point << "." << endl);
    907911    point->value = 0;
    908912    for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
     
    928932  int counter = 0;
    929933
    930   Log() << Verbose(1) << "Check: List of Baselines with not two connected triangles:" << endl;
     934  DoLog(1) && (Log() << Verbose(1) << "Check: List of Baselines with not two connected triangles:" << endl);
    931935  for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) {
    932936    if (testline->second->triangles.size() != 2) {
    933       Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl;
     937      DoLog(2) && (Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl);
    934938      counter++;
    935939    }
    936940  }
    937941  if (counter == 0) {
    938     Log() << Verbose(1) << "None." << endl;
     942    DoLog(1) && (Log() << Verbose(1) << "None." << endl);
    939943    result = true;
    940944  }
     
    951955  // check number of endpoints in *P
    952956  if (P->endpoints.size() != 4) {
    953     eLog() << Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl;
     957    DoeLog(1) && (eLog()<< Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl);
    954958    return 0;
    955959  }
     
    957961  // check number of triangles in *T
    958962  if (T->size() < 2) {
    959     eLog() << Verbose(1) << "Not enough triangles to have pairs!" << endl;
     963    DoeLog(1) && (eLog()<< Verbose(1) << "Not enough triangles to have pairs!" << endl);
    960964    return 0;
    961965  }
    962966
    963   Log() << Verbose(0) << "Polygon is " << *P << endl;
     967  DoLog(0) && (Log() << Verbose(0) << "Polygon is " << *P << endl);
    964968  // create each pair, get the endpoints and check whether *P is contained.
    965969  int counter = 0;
     
    977981        const int size = PairTrianglenodes.endpoints.size();
    978982        if (size == 4) {
    979           Log() << Verbose(0) << " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes << endl;
     983          DoLog(0) && (Log() << Verbose(0) << " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes << endl);
    980984          // now check
    981985          if (PairTrianglenodes.ContainsPresentTupel(P)) {
    982986            counter++;
    983             Log() << Verbose(0) << "  ACCEPT: Matches with " << *P << endl;
     987            DoLog(0) && (Log() << Verbose(0) << "  ACCEPT: Matches with " << *P << endl);
    984988          } else {
    985             Log() << Verbose(0) << "  REJECT: No match with " << *P << endl;
     989            DoLog(0) && (Log() << Verbose(0) << "  REJECT: No match with " << *P << endl);
    986990          }
    987991        } else {
    988           Log() << Verbose(0) << "  REJECT: Less than four endpoints." << endl;
     992          DoLog(0) && (Log() << Verbose(0) << "  REJECT: Less than four endpoints." << endl);
    989993        }
    990994      }
     
    10071011    if (P2->ContainsBoundaryPoint((*Runner))) {
    10081012      counter++;
    1009       Log() << Verbose(1) << *(*Runner) << " of second polygon is found in the first one." << endl;
     1013      DoLog(1) && (Log() << Verbose(1) << *(*Runner) << " of second polygon is found in the first one." << endl);
    10101014      return true;
    10111015    }
     
    10251029    Tester = P1->endpoints.insert((*Runner));
    10261030    if (Tester.second)
    1027       Log() << Verbose(0) << "Inserting endpoint " << *(*Runner) << " into first polygon." << endl;
     1031      DoLog(0) && (Log() << Verbose(0) << "Inserting endpoint " << *(*Runner) << " into first polygon." << endl);
    10281032  }
    10291033  P2->endpoints.clear();
Note: See TracChangeset for help on using the changeset viewer.