Changes in src/Shapes/Shape.cpp [23bade:bf3817]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Shapes/Shape.cpp ¶
r23bade rbf3817 6 6 */ 7 7 8 // include config.h 9 #ifdef HAVE_CONFIG_H 10 #include <config.h> 11 #endif 12 13 #include "Helpers/MemDebug.hpp" 14 8 15 #include "Shape.hpp" 9 16 #include "Shape_impl.hpp" 10 11 12 #include "Helpers/Assert.hpp"13 #include "LinearAlgebra/Vector.hpp"14 17 15 18 Shape::Shape(const Shape& src) : … … 21 24 bool Shape::isInside(const Vector &point) const{ 22 25 return impl->isInside(point); 23 }24 25 std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const int N) const {26 return impl->getHomogeneousPointsOnSurface(N);27 26 } 28 27 … … 73 72 } 74 73 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 93 74 Shape operator&&(const Shape &lhs,const Shape &rhs){ 94 75 Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs))); … … 106 87 bool OrShape_impl::isInside(const Vector &point){ 107 88 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;125 89 } 126 90 … … 142 106 } 143 107 144 std::vector<Vector> NotShape_impl::getHomogeneousPointsOnSurface(const int N) const {145 // surfaces are the same, only normal direction is different146 return arg->getHomogeneousPointsOnSurface(N);147 }148 149 108 Shape operator!(const Shape &arg){ 150 109 Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
Note:
See TracChangeset
for help on using the changeset viewer.