MINT2
Public Member Functions | Protected Attributes | List of all members
NPlane Class Reference

#include <NPlane.h>

Inheritance diagram for NPlane:
HyperLine HyperPlane

Public Member Functions

 NPlane (const HyperPointSet &a)
 
 NPlane (const HyperPoint &origin, const HyperPointSet &v)
 
int getDimension () const
 
int getN () const
 
const HyperPointgetOrigin () const
 
virtual const HyperPointgetDirection (int i=0) const
 
HyperPoint getParametricPoint (const HyperPoint &t) const
 
virtual void print (std::ostream &os=std::cout, int endline=1) const
 
virtual ~NPlane ()
 

Protected Attributes

HyperPoint _origin
 
HyperPointSet _v
 

Detailed Description

A NPlane is some subspace of nDimensional space defined by between 1 and nDim HyperPoints.

e.g. to 3D space, you could have a point, a line, or a plane (defined by 1, 2 and 3 points respectively)

Definition at line 30 of file NPlane.h.

Constructor & Destructor Documentation

◆ NPlane() [1/2]

NPlane::NPlane ( const HyperPointSet a)

Standard constuctor that takes between 1 and nDim HyperPoints. Internally this is converted into an origin and between 0 and (nDim - 1) vectors.

Definition at line 6 of file NPlane.cpp.

6  :
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 }
HyperPointSet _v
Definition: NPlane.h:36
#define ERROR_LOG
const HyperPoint & at(int i) const
HyperPoint _origin
Definition: NPlane.h:34
const int & getDimension() const
Definition: HyperPointSet.h:40
unsigned int size() const
#define WELCOME_LOG
void push_back(const HyperPoint &point)

◆ NPlane() [2/2]

NPlane::NPlane ( const HyperPoint origin,
const HyperPointSet v 
)

Constuctor that takes between an origin, and between 0 and (nDim - 1) vectors.

Definition at line 25 of file NPlane.cpp.

25  :
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 }
HyperPointSet _v
Definition: NPlane.h:36
#define ERROR_LOG
HyperPoint _origin
Definition: NPlane.h:34
const int & getDimension() const
Definition: HyperPointSet.h:40
unsigned int size() const
#define WELCOME_LOG

◆ ~NPlane()

NPlane::~NPlane ( )
virtual

Destructor

Definition at line 71 of file NPlane.cpp.

71  {
72 
73 }

Member Function Documentation

◆ getDimension()

int NPlane::getDimension ( ) const
inline

get the dimensionality

Definition at line 45 of file NPlane.h.

◆ getDirection()

virtual const HyperPoint& NPlane::getDirection ( int  i = 0) const
inlinevirtual

get one of the vectors that defines the NPlane

Definition at line 54 of file NPlane.h.

◆ getN()

int NPlane::getN ( ) const
inline

get the number of vectors that define the NPlane

Definition at line 47 of file NPlane.h.

◆ getOrigin()

const HyperPoint& NPlane::getOrigin ( ) const
inline

get the origin of the NPlane

Definition at line 51 of file NPlane.h.

◆ getParametricPoint()

HyperPoint NPlane::getParametricPoint ( const HyperPoint t) const

The subspace is defined by (O + x.v_1 + y.v_2 + z.v_3 ...) - a point in this space is then defined by the ‘ParametricPoint’ (x,y,z...). This function takes (x,y,z...) and returns (O + x.v_1 + y.v_2 + z.v_3 ...)

Definition at line 40 of file NPlane.cpp.

40  {
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 }
int size() const
Definition: HyperPoint.h:96
HyperPointSet _v
Definition: NPlane.h:36
#define ERROR_LOG
const HyperPoint & at(int i) const
HyperPoint _origin
Definition: NPlane.h:34
const double & at(int i) const
Definition: HyperPoint.cpp:433
unsigned int size() const

◆ print()

void NPlane::print ( std::ostream &  os = std::cout,
int  endline = 1 
) const
virtual

Print out the origin and vectors that define the NPlane

Reimplemented in HyperPlane, and HyperLine.

Definition at line 56 of file NPlane.cpp.

56  {
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 }
HyperPointSet _v
Definition: NPlane.h:36
virtual void print(std::ostream &os=std::cout, int endline=1) const
Definition: HyperPoint.cpp:453
const HyperPoint & at(int i) const
HyperPoint _origin
Definition: NPlane.h:34
unsigned int size() const

Member Data Documentation

◆ _origin

HyperPoint NPlane::_origin
protected

The origin of the subspace

Definition at line 34 of file NPlane.h.

◆ _v

HyperPointSet NPlane::_v
protected

The vectors that define the dimensionality of the subspace

Definition at line 36 of file NPlane.h.


The documentation for this class was generated from the following files: