Changes in / [47191b:1ac51b]


Ignore:
Location:
src
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r47191b r1ac51b  
    8888                                  Exceptions/LinearDependenceException.cpp \
    8989                                  Exceptions/MathException.cpp \
    90                                   Exceptions/SkewException.cpp \
    9190                                  Exceptions/ZeroVectorException.cpp
    9291                                 
     
    9493                                  Exceptions/LinearDependenceException.hpp \
    9594                                  Exceptions/MathException.hpp \
    96                                   Exceptions/SkewException.hpp \
    9795                                  Exceptions/ZeroVectorException.hpp
    9896
  • src/atom.cpp

    r47191b r1ac51b  
    6868atom *atom::GetTrueFather()
    6969{
    70   if(father == this){ // top most father is the one that points on itself
    71     return this;
    72   }
    73   else if(!father) {
    74     return 0;
    75   }
    76   else {
    77     return father->GetTrueFather();
    78   }
     70  atom *walker = this;
     71  do {
     72    if (walker == walker->father) // top most father is the one that points on itself
     73      break;
     74    walker = walker->father;
     75  } while (walker != NULL);
     76  return walker;
    7977};
    8078
  • src/tesselation.cpp

    r47191b r1ac51b  
    442442  try {
    443443    *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*MolCenter, *x);
    444 
    445     DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
    446     DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
    447     DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
    448 
    449     if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
    450       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
    451       return true;
    452     }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
    453       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
    454       return true;
    455     }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
    456       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
    457       return true;
    458     }
    459     // Calculate cross point between one baseline and the line from the third endpoint to intersection
    460     int i = 0;
    461     do {
     444  }
     445  catch (LinearDependenceException &excp) {
     446    Log() << Verbose(1) << excp;
     447    DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
     448    return false;
     449  }
     450
     451  DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
     452  DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
     453  DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
     454
     455  if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
     456    DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
     457    return true;
     458  }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
     459    DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
     460    return true;
     461  }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
     462    DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
     463    return true;
     464  }
     465  // Calculate cross point between one baseline and the line from the third endpoint to intersection
     466  int i = 0;
     467  do {
     468    try {
    462469      CrossPoint = GetIntersectionOfTwoLinesOnPlane(*(endpoints[i%3]->node->node),
    463470                                                    *(endpoints[(i+1)%3]->node->node),
     
    470477      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
    471478        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    472         return false;
     479        i=4;
     480        break;
    473481      }
    474482      i++;
    475     } while (i < 3);
     483    } catch (LinearDependenceException &excp){
     484      break;
     485    }
     486  } while (i < 3);
     487  if (i == 3) {
    476488    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    477489    return true;
    478   }
    479   catch (MathException &excp) {
    480     Log() << Verbose(1) << excp;
    481     DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
     490  } else {
     491    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl);
    482492    return false;
    483493  }
    484 
    485 
    486494}
    487495;
  • src/vector_ops.cpp

    r47191b r1ac51b  
    1515#include "Helpers/fast_functions.hpp"
    1616#include "Exceptions/LinearDependenceException.hpp"
    17 #include "Exceptions/SkewException.hpp"
    1817
    1918#include <gsl/gsl_linalg.h>
     
    177176  if (fabs(M->Determinant()) > MYEPSILON) {
    178177    Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
    179     throw SkewException(__FILE__,__LINE__);
     178    throw LinearDependenceException(__FILE__,__LINE__);
    180179  }
    181180
Note: See TracChangeset for help on using the changeset viewer.