Debian Codegraph @

src/TriWithLines2D.h

raw
1 /////////////////////////////////////////////////////////////
2 // //
3 // Copyright (c) 2007-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
11 /////////////////////////////////////////////////////////////
12
13 #ifndef __TRIWITHLINES2D_H
14 #define __TRIWITHLINES2D_H
15
16 // --- Project includes ---
17 #include "AVolume2D.h"
18
19 // --- STL includes ---
20 #include <vector>
21 #include <map>
22
23 // --- IO includes ---
24 #include <iostream>
25
26 using std::vector;
27 using std::map;
28 using std::ostream;
29
30
31 /*!
32 \class TriWithLines2D
33
34 A class for the generation of random particles inside a triangle. An arbitrary number
35 of lines can be added to which the particles are fitted.
36 */
37 class TriWithLines2D : public AVolume2D
38 {
39 protected:
40 Vector3 m_pmin;
41 Vector3 m_pmax;
42 Vector3 m_p0;
43 Vector3 m_p1;
44 Vector3 m_p2;
45 double m_a0,m_a1,m_a2;
46 double m_b0,m_b1,m_b2;
47 double m_c0,m_c1,m_c2;
48 vector<Line2D> m_lines;
49 double m_random(double,double)const;
50
51 public:
52 TriWithLines2D();
53 // TriWithLines2D(const Vector3&,const Vector3&);
54 TriWithLines2D(const Vector3&,const Vector3&,const Vector3&);
55 virtual ~TriWithLines2D(){};
56
57 void addLine(const Line2D&);
58 virtual pair<Vector3,Vector3> getBoundingBox();
59 virtual Vector3 getAPoint(int)const;
60 virtual bool hasPlane() const{return (m_lines.size()>0);};
61 virtual Line2D getClosestPlane(const Vector3&);
62 virtual const map<double,const Line2D*> getClosestPlanes(const Vector3&,int) const;
63 virtual bool isIn(const Vector3&) const;
64 virtual bool isIn(const Sphere&);
65
66 friend ostream& operator<< (ostream&, const TriWithLines2D&);
67 };
68 #endif // __TRIWITHLINES2D_H