Changes in src/Shapes/Shape.cpp [205d9b:c5186e]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/Shape.cpp
r205d9b rc5186e 9 9 #include "Shape_impl.hpp" 10 10 11 12 #include "Helpers/Assert.hpp" 13 #include "LinearAlgebra/Vector.hpp" 14 11 15 Shape::Shape(const Shape& src) : 12 16 impl(src.getImpl()) … … 17 21 bool Shape::isInside(const Vector &point) const{ 18 22 return impl->isInside(point); 23 } 24 25 std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const int N) const { 26 return impl->getHomogeneousPointsOnSurface(N); 19 27 } 20 28 … … 65 73 } 66 74 75 std::vector<Vector> AndShape_impl::getHomogeneousPointsOnSurface(const int N) const { 76 std::vector<Vector> PointsOnSurface; 77 ASSERT(false, "AndShape_impl::getHomogeneousPointsOnSurface() not implemented yet"); 78 return PointsOnSurface; 79 } 80 81 67 82 Shape operator&&(const Shape &lhs,const Shape &rhs){ 68 83 Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs))); … … 80 95 bool OrShape_impl::isInside(const Vector &point){ 81 96 return rhs->isInside(point) || lhs->isInside(point); 97 } 98 99 std::vector<Vector> OrShape_impl::getHomogeneousPointsOnSurface(const int N) const { 100 std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N); 101 std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N); 102 std::vector<Vector> PointsOnSurface; 103 104 for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) { 105 if (!rhs->isInside(*iter)) 106 PointsOnSurface.push_back(*iter); 107 } 108 for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) { 109 if (!lhs->isInside(*iter)) 110 PointsOnSurface.push_back(*iter); 111 } 112 113 return PointsOnSurface; 82 114 } 83 115 … … 99 131 } 100 132 133 std::vector<Vector> NotShape_impl::getHomogeneousPointsOnSurface(const int N) const { 134 // surfaces are the same, only normal direction is different 135 return arg->getHomogeneousPointsOnSurface(N); 136 } 137 101 138 Shape operator!(const Shape &arg){ 102 139 Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
Note:
See TracChangeset
for help on using the changeset viewer.