Changes in src/Shapes/Shape.cpp [205d9b:bcf653]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Shapes/Shape.cpp
r205d9b rbcf653 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * Shape.cpp … … 6 13 */ 7 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 19 20 #include "Helpers/MemDebug.hpp" 21 8 22 #include "Shape.hpp" 9 23 #include "Shape_impl.hpp" 24 25 26 #include "Helpers/Assert.hpp" 27 #include "LinearAlgebra/Vector.hpp" 10 28 11 29 Shape::Shape(const Shape& src) : … … 17 35 bool Shape::isInside(const Vector &point) const{ 18 36 return impl->isInside(point); 37 } 38 39 std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const int N) const { 40 return impl->getHomogeneousPointsOnSurface(N); 19 41 } 20 42 … … 65 87 } 66 88 89 std::vector<Vector> AndShape_impl::getHomogeneousPointsOnSurface(const int N) const { 90 std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N); 91 std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N); 92 std::vector<Vector> PointsOnSurface; 93 94 for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) { 95 if (rhs->isInside(*iter)) 96 PointsOnSurface.push_back(*iter); 97 } 98 for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) { 99 if (lhs->isInside(*iter)) 100 PointsOnSurface.push_back(*iter); 101 } 102 103 return PointsOnSurface; 104 } 105 106 67 107 Shape operator&&(const Shape &lhs,const Shape &rhs){ 68 108 Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs))); … … 80 120 bool OrShape_impl::isInside(const Vector &point){ 81 121 return rhs->isInside(point) || lhs->isInside(point); 122 } 123 124 std::vector<Vector> OrShape_impl::getHomogeneousPointsOnSurface(const int N) const { 125 std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N); 126 std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N); 127 std::vector<Vector> PointsOnSurface; 128 129 for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) { 130 if (!rhs->isInside(*iter)) 131 PointsOnSurface.push_back(*iter); 132 } 133 for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) { 134 if (!lhs->isInside(*iter)) 135 PointsOnSurface.push_back(*iter); 136 } 137 138 return PointsOnSurface; 82 139 } 83 140 … … 99 156 } 100 157 158 std::vector<Vector> NotShape_impl::getHomogeneousPointsOnSurface(const int N) const { 159 // surfaces are the same, only normal direction is different 160 return arg->getHomogeneousPointsOnSurface(N); 161 } 162 101 163 Shape operator!(const Shape &arg){ 102 164 Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
Note:
See TracChangeset
for help on using the changeset viewer.