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>
|
---|
12 | #include <vector>
|
---|
13 | #include <iostream>
|
---|
14 | #include "Space.hpp"
|
---|
15 | #include "Exceptions/LinearDependenceException.hpp"
|
---|
16 | #include "Exceptions/ZeroVectorException.hpp"
|
---|
17 |
|
---|
18 | class Vector;
|
---|
19 | class Line;
|
---|
20 |
|
---|
21 | class Plane : public Space
|
---|
22 | {
|
---|
23 | typedef std::auto_ptr<Vector> vec_ptr;
|
---|
24 | public:
|
---|
25 | Plane(const Vector &y1, const Vector &y2, const Vector &y3) throw(LinearDependenceException);
|
---|
26 | Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException);
|
---|
27 | Plane(const Vector &_normalVector, double _offset) throw(ZeroVectorException);
|
---|
28 | Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException);
|
---|
29 | Plane(const Plane& plane);
|
---|
30 | virtual ~Plane();
|
---|
31 |
|
---|
32 | // Accessor Functions
|
---|
33 | /**
|
---|
34 | * returns normal Vector for a plane
|
---|
35 | */
|
---|
36 | Vector getNormal() const;
|
---|
37 | /**
|
---|
38 | * returns the distance of the plane from the origin
|
---|
39 | */
|
---|
40 | double getOffset() const;
|
---|
41 | /**
|
---|
42 | * returns a vector that points on the plane.
|
---|
43 | * Same as getOffset()*getNormal();
|
---|
44 | */
|
---|
45 | Vector getOffsetVector() const;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * returns three seperate points on this plane
|
---|
49 | */
|
---|
50 | std::vector<Vector> getPointsOnPlane() const;
|
---|
51 |
|
---|
52 | // some calculations
|
---|
53 | Vector GetIntersection(const Line &Line) const;
|
---|
54 |
|
---|
55 | Vector mirrorVector(const Vector &rhs) const;
|
---|
56 |
|
---|
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 |
|
---|
65 | /****** Methods inherited from Space ***********/
|
---|
66 |
|
---|
67 | virtual double distance(const Vector &point) const;
|
---|
68 | virtual Vector getClosestPoint(const Vector &point) const;
|
---|
69 |
|
---|
70 | private:
|
---|
71 | vec_ptr normalVector;
|
---|
72 | double offset;
|
---|
73 | };
|
---|
74 |
|
---|
75 | std::ostream &operator<< (std::ostream &ost,const Plane& p);
|
---|
76 |
|
---|
77 | #endif /* PLANE_HPP_ */
|
---|