Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/tesselationhelpers.cpp

    r49d3e1e rea3627  
    143143  if (fabs(HalfplaneIndicator) < MYEPSILON)
    144144    {
    145       if ((TempNormal.ScalarProduct(AlternativeDirection) <0 && AlternativeIndicator >0) || (TempNormal.ScalarProduct(AlternativeDirection) >0 && AlternativeIndicator <0))
     145      if ((TempNormal.ScalarProduct(AlternativeDirection) <0 and AlternativeIndicator >0) or (TempNormal.ScalarProduct(AlternativeDirection) >0 and AlternativeIndicator <0))
    146146        {
    147147          TempNormal.Scale(-1);
     
    150150  else
    151151    {
    152       if (((TempNormal.ScalarProduct(Direction)<0) && (HalfplaneIndicator >0)) || ((TempNormal.ScalarProduct(Direction)>0) && (HalfplaneIndicator<0)))
     152      if (TempNormal.ScalarProduct(Direction)<0 && HalfplaneIndicator >0 || TempNormal.ScalarProduct(Direction)>0 && HalfplaneIndicator<0)
    153153        {
    154154          TempNormal.Scale(-1);
     
    226226  Vector helper;
    227227  double radius, alpha;
    228   Vector RelativeOldSphereCenter;
    229   Vector RelativeNewSphereCenter;
    230 
    231   RelativeOldSphereCenter.CopyVector(&OldSphereCenter);
    232   RelativeOldSphereCenter.SubtractVector(&CircleCenter);
    233   RelativeNewSphereCenter.CopyVector(&NewSphereCenter);
    234   RelativeNewSphereCenter.SubtractVector(&CircleCenter);
    235   helper.CopyVector(&RelativeNewSphereCenter);
     228
     229  helper.CopyVector(&NewSphereCenter);
    236230  // test whether new center is on the parameter circle's plane
    237231  if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
     
    239233    helper.ProjectOntoPlane(&CirclePlaneNormal);
    240234  }
    241   radius = helper.NormSquared();
     235  radius = helper.ScalarProduct(&helper);
    242236  // test whether the new center vector has length of CircleRadius
    243237  if (fabs(radius - CircleRadius) > HULLEPSILON)
    244238    eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
    245   alpha = helper.Angle(&RelativeOldSphereCenter);
     239  alpha = helper.Angle(&OldSphereCenter);
    246240  // make the angle unique by checking the halfplanes/search direction
    247241  if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)  // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals
    248242    alpha = 2.*M_PI - alpha;
    249   Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl;
    250   radius = helper.Distance(&RelativeOldSphereCenter);
     243  //Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;
     244  radius = helper.Distance(&OldSphereCenter);
    251245  helper.ProjectOntoPlane(&NormalVector);
    252246  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
    253247  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;
     248    //Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
    255249    return alpha;
    256250  } else {
    257     Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl;
     251    //Log() << Verbose(1) << "INFO: NewSphereCenter " << helper << " is too close to OldSphereCenter" << OldSphereCenter << "." << endl;
    258252    return 2.*M_PI;
    259253  }
     
    558552 * @return point which is second closest to the provided one
    559553 */
    560 TesselPoint* FindSecondClosestTesselPoint(const Vector* Point, const LinkedCell* const LC)
     554TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC)
    561555{
    562556        Info FunctionInfo(__func__);
     
    613607 * @return point which is closest to the provided one, NULL if none found
    614608 */
    615 TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
     609TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
    616610{
    617611        Info FunctionInfo(__func__);
     
    639633            helper.CopyVector(Point);
    640634            helper.SubtractVector((*Runner)->node);
    641             double currentNorm = helper.NormSquared();
     635            double currentNorm = helper. Norm();
    642636            if (currentNorm < distance) {
    643637              secondDistance = distance;
     
    866860    }
    867861    *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
    868     int i=cloud->GetMaxId();
     862    int i=0;
     863    for (cloud->GoToFirst(); !cloud->IsEnd(); cloud->GoToNext(), i++);
    869864    int *LookupList = new int[i];
    870865    for (cloud->GoToFirst(), i=0; !cloud->IsEnd(); cloud->GoToNext(), i++)
Note: See TracChangeset for help on using the changeset viewer.