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