Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Shapes/Shape.cpp

    r23bade rbf3817  
    66 */
    77
     8// include config.h
     9#ifdef HAVE_CONFIG_H
     10#include <config.h>
     11#endif
     12
     13#include "Helpers/MemDebug.hpp"
     14
    815#include "Shape.hpp"
    916#include "Shape_impl.hpp"
    10 
    11 
    12 #include "Helpers/Assert.hpp"
    13 #include "LinearAlgebra/Vector.hpp"
    1417
    1518Shape::Shape(const Shape& src) :
     
    2124bool Shape::isInside(const Vector &point) const{
    2225  return impl->isInside(point);
    23 }
    24 
    25 std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const int N) const {
    26   return impl->getHomogeneousPointsOnSurface(N);
    2726}
    2827
     
    7372}
    7473
    75 std::vector<Vector> AndShape_impl::getHomogeneousPointsOnSurface(const int N) const {
    76   std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N);
    77   std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N);
    78   std::vector<Vector> PointsOnSurface;
    79 
    80   for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) {
    81     if (rhs->isInside(*iter))
    82       PointsOnSurface.push_back(*iter);
    83   }
    84   for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) {
    85     if (lhs->isInside(*iter))
    86       PointsOnSurface.push_back(*iter);
    87   }
    88 
    89   return PointsOnSurface;
    90 }
    91 
    92 
    9374Shape operator&&(const Shape &lhs,const Shape &rhs){
    9475  Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
     
    10687bool OrShape_impl::isInside(const Vector &point){
    10788  return rhs->isInside(point) || lhs->isInside(point);
    108 }
    109 
    110 std::vector<Vector> OrShape_impl::getHomogeneousPointsOnSurface(const int N) const {
    111   std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N);
    112   std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N);
    113   std::vector<Vector> PointsOnSurface;
    114 
    115   for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) {
    116     if (!rhs->isInside(*iter))
    117       PointsOnSurface.push_back(*iter);
    118   }
    119   for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) {
    120     if (!lhs->isInside(*iter))
    121       PointsOnSurface.push_back(*iter);
    122   }
    123 
    124   return PointsOnSurface;
    12589}
    12690
     
    142106}
    143107
    144 std::vector<Vector> NotShape_impl::getHomogeneousPointsOnSurface(const int N) const {
    145   // surfaces are the same, only normal direction is different
    146   return arg->getHomogeneousPointsOnSurface(N);
    147 }
    148 
    149108Shape operator!(const Shape &arg){
    150109  Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
Note: See TracChangeset for help on using the changeset viewer.