MINT2
NPlane.cpp
Go to the documentation of this file.
1 #include "Mint/NPlane.h"
2 
7  _origin ( a.at(0) ),
8  _v ( a.getDimension() )
9 {
10 
11  WELCOME_LOG << "Hello from the NPlane() Constructor";
12 
13  for(unsigned i = 1; i < a.size(); i++){
14  _v.push_back( a.at(i) - a.at(0) );
15  }
16 
17  if ( _v.getDimension() < (int)_v.size() ) ERROR_LOG << "You are providing too many directions in this dimension - your points must be L.D.";
18  if ( 0 == (int)_v.size() ) ERROR_LOG << "You have not provided any directions";
19 
20 
21 }
22 
25 NPlane::NPlane(const HyperPoint& origin, const HyperPointSet& v) :
26  _origin ( origin ),
27  _v ( v )
28 {
29  WELCOME_LOG << "Hello from the NPlane() Constructor";
30 
31  if ( _v.getDimension() < (int)_v.size() ) ERROR_LOG << "You are providing too many directions in this dimension - your points must be L.D.";
32  if ( 0 == (int)_v.size() ) ERROR_LOG << "You have not provided any directions";
33 
34 }
35 
36 
41  if ( t.size() != (int)_v.size() ) ERROR_LOG << "You have not provided the correct number of parameters";
42 
43  HyperPoint point = _origin;
44 
45  for(unsigned int i = 0; i < _v.size(); i++){
46  point = point + _v.at(i)*t.at(i); //std::vector times a double
47  }
48 
49  return point;
50 
51 }
52 
56 void NPlane::print(std::ostream& os, int endline) const{
57  os << "NPlane: v = ";
58  _origin.print(os, 0);
59 
60  for (unsigned int i = 0; i < _v.size(); i++){
61  os << " + ";
62  _v.at(i).print(os, 0);
63  os << "t_" << i;
64  }
65  if (endline) os << std::endl;
66 }
67 
72 
73 }
74 
75 
int size() const
Definition: HyperPoint.h:96
HyperPointSet _v
Definition: NPlane.h:36
virtual void print(std::ostream &os=std::cout, int endline=1) const
Definition: HyperPoint.cpp:453
NPlane(const HyperPointSet &a)
Definition: NPlane.cpp:6
#define ERROR_LOG
virtual ~NPlane()
Definition: NPlane.cpp:71
const HyperPoint & at(int i) const
HyperPoint _origin
Definition: NPlane.h:34
virtual void print(std::ostream &os=std::cout, int endline=1) const
Definition: NPlane.cpp:56
const double & at(int i) const
Definition: HyperPoint.cpp:433
const int & getDimension() const
Definition: HyperPointSet.h:40
unsigned int size() const
#define WELCOME_LOG
void push_back(const HyperPoint &point)
HyperPoint getParametricPoint(const HyperPoint &t) const
Definition: NPlane.cpp:40