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