~ubuntu-branches/ubuntu/quantal/python-demgengeo/quantal

« back to all changes in this revision

Viewing changes to src/BoxWithLines2D.h

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2011-11-18 21:47:18 UTC
  • Revision ID: package-import@ubuntu.com-20111118214718-4ysqm3dhpqwdd7gd
Tags: upstream-0.99~bzr106
ImportĀ upstreamĀ versionĀ 0.99~bzr106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////
 
2
//                                                         //
 
3
// Copyright (c) 2007-2011 by The University of Queensland //
 
4
// Earth Systems Science Computational Centre (ESSCC)      //
 
5
// http://www.uq.edu.au/esscc                              //
 
6
//                                                         //
 
7
// Primary Business: Brisbane, Queensland, Australia       //
 
8
// Licensed under the Open Software License version 3.0    //
 
9
// http://www.opensource.org/licenses/osl-3.0.php          //
 
10
//                                                         //
 
11
/////////////////////////////////////////////////////////////
 
12
 
 
13
#ifndef __BOXWITHLINES2D_H
 
14
#define __BOXWITHLINES2D_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 BoxWithLines2D
 
33
 
 
34
  A class for the generation of random particles inside a box. An arbitrary number 
 
35
  of lines can be added to which the particles are fitted.  
 
36
*/
 
37
class BoxWithLines2D : public AVolume2D
 
38
{
 
39
 protected:
 
40
  Vector3 m_pmin;
 
41
  Vector3 m_pmax;
 
42
  vector<Line2D> m_lines;
 
43
  double m_random(double,double)const;
 
44
 
 
45
 public:
 
46
  BoxWithLines2D();
 
47
  BoxWithLines2D(const Vector3&,const Vector3&);
 
48
  virtual ~BoxWithLines2D(){};
 
49
 
 
50
  void addLine(const Line2D&);
 
51
  virtual pair<Vector3,Vector3> getBoundingBox();
 
52
  virtual Vector3 getAPoint(int)const;
 
53
  virtual bool hasPlane() const{return (m_lines.size()>0);};
 
54
  virtual Line2D getClosestPlane(const Vector3&);
 
55
  virtual const map<double,const Line2D*> getClosestPlanes(const Vector3&,int) const;
 
56
  virtual bool isIn(const Vector3&) const;
 
57
  virtual bool isIn(const Sphere&);
 
58
 
 
59
  friend ostream& operator<< (ostream&, const BoxWithLines2D&);
 
60
};
 
61
#endif // __BOXWITHLINES2D_H