Changeset 0e9394 for molecuilder
- Timestamp:
- Apr 30, 2010, 9:03:57 AM (16 years ago)
- Children:
- 7a8319
- Parents:
- c53e0b
- git-author:
- Tillmann Crueger <crueger@…> (04/30/10 08:26:28)
- git-committer:
- Tillmann Crueger <crueger@…> (04/30/10 09:03:57)
- Location:
- molecuilder/src
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Makefile.am
rc53e0b r0e9394 123 123 periodentafel.cpp \ 124 124 Plane.cpp \ 125 Space.cpp \ 125 126 tesselation.cpp \ 126 127 tesselationhelpers.cpp \ … … 161 162 periodentafel.hpp \ 162 163 Plane.hpp \ 164 Space.hpp \ 163 165 stackclass.hpp \ 164 166 tesselation.hpp \ -
molecuilder/src/Plane.cpp
rc53e0b r0e9394 8 8 #include "Plane.hpp" 9 9 #include "vector.hpp" 10 #include "defs.hpp" 10 11 #include "Exceptions/LinearDependenceException.hpp" 11 12 #include "info.hpp" … … 13 14 #include "verbose.hpp" 14 15 #include "Helpers/Assert.hpp" 16 #include <cmath> 15 17 16 18 /** … … 163 165 return res; 164 166 }; 167 168 /************ Methods inherited from Space ****************/ 169 170 double Plane::distance(Vector &point){ 171 double res = point.ScalarProduct(*normalVector)-offset; 172 return fabs(res); 173 } 174 175 Vector Plane::getClosestPoint(Vector &point){ 176 Vector difference = distance(point) * (*normalVector); 177 if(difference.IsZero()){ 178 // the point itself lies on the plane 179 return point; 180 } 181 // get the direction this vector is pointing 182 double sign = difference.ScalarProduct(*normalVector); 183 // sign cannot be zero, since normalVector and difference are both != zero 184 sign = sign/fabs(sign); 185 return (point - (sign * difference)); 186 } 187 188 bool Plane::isContained(Vector &point){ 189 return (point.ScalarProduct(*normalVector) - offset) < MYEPSILON; 190 } -
molecuilder/src/Plane.hpp
rc53e0b r0e9394 11 11 #include <memory> 12 12 #include <vector> 13 #include "Space.hpp" 13 14 14 15 class Vector; 15 16 16 class Plane 17 class Plane : public Space 17 18 { 18 19 typedef std::auto_ptr<Vector> vec_ptr; … … 47 48 Vector GetIntersection(const Vector &Origin, const Vector &LineVector); 48 49 50 /****** Methods inherited from Space ***********/ 51 52 virtual double distance(Vector &point); 53 virtual Vector getClosestPoint(Vector &point); 54 virtual bool isContained(Vector &point); 55 56 49 57 private: 50 58 vec_ptr normalVector;
Note:
See TracChangeset
for help on using the changeset viewer.
