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