| [0a4f7f] | 1 | /*
|
|---|
| 2 | * Plane.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Apr 7, 2010
|
|---|
| 5 | * Author: crueger
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef PLANE_HPP_
|
|---|
| 9 | #define PLANE_HPP_
|
|---|
| 10 |
|
|---|
| 11 | #include <memory>
|
|---|
| [c61c87] | 12 | #include <vector>
|
|---|
| [986ed3] | 13 | #include <iosfwd>
|
|---|
| [2247a9] | 14 | #include "Space.hpp"
|
|---|
| [2cbe97] | 15 | #include "Exceptions/LinearDependenceException.hpp"
|
|---|
| 16 | #include "Exceptions/ZeroVectorException.hpp"
|
|---|
| [0a4f7f] | 17 |
|
|---|
| 18 | class Vector;
|
|---|
| [5589858] | 19 | class Line;
|
|---|
| [0a4f7f] | 20 |
|
|---|
| [2247a9] | 21 | class Plane : public Space
|
|---|
| [0a4f7f] | 22 | {
|
|---|
| 23 | typedef std::auto_ptr<Vector> vec_ptr;
|
|---|
| 24 | public:
|
|---|
| [2cbe97] | 25 | Plane(const Vector &y1, const Vector &y2, const Vector &y3) throw(LinearDependenceException);
|
|---|
| [fa5a6a] | 26 | Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException);
|
|---|
| 27 | Plane(const Vector &_normalVector, double _offset) throw(ZeroVectorException);
|
|---|
| [2cbe97] | 28 | Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException);
|
|---|
| [d4c9ae] | 29 | Plane(const Plane& plane);
|
|---|
| [0a4f7f] | 30 | virtual ~Plane();
|
|---|
| 31 |
|
|---|
| 32 | // Accessor Functions
|
|---|
| [72e7fa] | 33 | /**
|
|---|
| 34 | * returns normal Vector for a plane
|
|---|
| 35 | */
|
|---|
| [fa5a6a] | 36 | Vector getNormal() const;
|
|---|
| [72e7fa] | 37 | /**
|
|---|
| 38 | * returns the distance of the plane from the origin
|
|---|
| 39 | */
|
|---|
| [fa5a6a] | 40 | double getOffset() const;
|
|---|
| [72e7fa] | 41 | /**
|
|---|
| 42 | * returns a vector that points on the plane.
|
|---|
| 43 | * Same as getOffset()*getNormal();
|
|---|
| 44 | */
|
|---|
| [45ef76] | 45 | Vector getOffsetVector() const;
|
|---|
| [0a4f7f] | 46 |
|
|---|
| [c61c87] | 47 | /**
|
|---|
| 48 | * returns three seperate points on this plane
|
|---|
| 49 | */
|
|---|
| [45ef76] | 50 | std::vector<Vector> getPointsOnPlane() const;
|
|---|
| [c61c87] | 51 |
|
|---|
| [0a4f7f] | 52 | // some calculations
|
|---|
| [27ac00] | 53 | Vector GetIntersection(const Line &Line) const;
|
|---|
| [0a4f7f] | 54 |
|
|---|
| [ccf826] | 55 | Vector mirrorVector(const Vector &rhs) const;
|
|---|
| 56 |
|
|---|
| [5589858] | 57 | /**
|
|---|
| 58 | * get a Line that is orthogonal to this plane, going through a chosen
|
|---|
| 59 | * point.
|
|---|
| 60 | *
|
|---|
| 61 | * The point does not have to lie on the plane itself.
|
|---|
| 62 | */
|
|---|
| 63 | Line getOrthogonalLine(const Vector &origin) const;
|
|---|
| 64 |
|
|---|
| [c17975] | 65 | /**
|
|---|
| 66 | * Test if two points are on the same side of the plane
|
|---|
| 67 | */
|
|---|
| 68 | bool onSameSide(const Vector&,const Vector&) const;
|
|---|
| 69 |
|
|---|
| [2247a9] | 70 | /****** Methods inherited from Space ***********/
|
|---|
| 71 |
|
|---|
| [005e18] | 72 | virtual double distance(const Vector &point) const;
|
|---|
| 73 | virtual Vector getClosestPoint(const Vector &point) const;
|
|---|
| [2247a9] | 74 |
|
|---|
| [0a4f7f] | 75 | private:
|
|---|
| 76 | vec_ptr normalVector;
|
|---|
| 77 | double offset;
|
|---|
| 78 | };
|
|---|
| 79 |
|
|---|
| [fa5a6a] | 80 | std::ostream &operator<< (std::ostream &ost,const Plane& p);
|
|---|
| 81 |
|
|---|
| [0a4f7f] | 82 | #endif /* PLANE_HPP_ */
|
|---|