Changes in / [1ac51b:47191b]


Ignore:
Location:
src
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r1ac51b r47191b  
    8888                                  Exceptions/LinearDependenceException.cpp \
    8989                                  Exceptions/MathException.cpp \
     90                                  Exceptions/SkewException.cpp \
    9091                                  Exceptions/ZeroVectorException.cpp
    9192                                 
     
    9394                                  Exceptions/LinearDependenceException.hpp \
    9495                                  Exceptions/MathException.hpp \
     96                                  Exceptions/SkewException.hpp \
    9597                                  Exceptions/ZeroVectorException.hpp
    9698
  • src/atom.cpp

    r1ac51b r47191b  
    6868atom *atom::GetTrueFather()
    6969{
    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;
     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  }
    7779};
    7880
  • src/tesselation.cpp

    r1ac51b r47191b  
    442442  try {
    443443    *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*MolCenter, *x);
    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 {
     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 {
    469462      CrossPoint = GetIntersectionOfTwoLinesOnPlane(*(endpoints[i%3]->node->node),
    470463                                                    *(endpoints[(i+1)%3]->node->node),
     
    477470      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
    478471        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    479         i=4;
    480         break;
     472        return false;
    481473      }
    482474      i++;
    483     } catch (LinearDependenceException &excp){
    484       break;
    485     }
    486   } while (i < 3);
    487   if (i == 3) {
     475    } while (i < 3);
    488476    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    489477    return true;
    490   } else {
    491     DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl);
     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);
    492482    return false;
    493483  }
     484
     485
    494486}
    495487;
  • src/vector_ops.cpp

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