Ignore:
Timestamp:
Jan 11, 2010, 9:16:36 AM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
afa056
Parents:
d403a1
git-author:
Frederik Heber <heber@…> (01/11/10 09:13:49)
git-committer:
Frederik Heber <heber@…> (01/11/10 09:16:36)
Message:

Fixed Tesselation::IsInnerPoint()

Signed-off-by: Frederik Heber <heber@tabletINS.(none)>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/tesselation.cpp

    rd403a1 r91b1e79  
    402402bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection)
    403403{
    404         Info FunctionInfo(__func__);
     404  Info FunctionInfo(__func__);
    405405  Vector CrossPoint;
    406406  Vector helper;
     
    415415  Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl;
    416416
     417  if (Intersection->DistanceSquared(endpoints[0]->node->node) < MYEPSILON) {
     418    Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl;
     419    return true;
     420  }   else if (Intersection->DistanceSquared(endpoints[1]->node->node) < MYEPSILON) {
     421    Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl;
     422    return true;
     423  }   else if (Intersection->DistanceSquared(endpoints[2]->node->node) < MYEPSILON) {
     424    Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl;
     425    return true;
     426  }
    417427  // Calculate cross point between one baseline and the line from the third endpoint to intersection
    418428  int i=0;
    419429  do {
    420430    if (CrossPoint.GetIntersectionOfTwoLinesOnPlane(endpoints[i%3]->node->node, endpoints[(i+1)%3]->node->node, endpoints[(i+2)%3]->node->node, Intersection, &NormalVector)) {
     431      helper.CopyVector(endpoints[(i+1)%3]->node->node);
     432      helper.SubtractVector(endpoints[i%3]->node->node);
    421433      CrossPoint.SubtractVector(endpoints[i%3]->node->node);  // cross point was returned as absolute vector
     434      const double s = CrossPoint.ScalarProduct(&helper)/helper.NormSquared();
     435      Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl;
     436      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
     437        Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl;
     438        i=4;
     439        break;
     440      }
    422441      i++;
    423442    } else
Note: See TracChangeset for help on using the changeset viewer.