summaryrefslogtreecommitdiff
path: root/src/main/Element.cc
blob: ed66d9436a3ba68049c51fb685d61ac87acb4c68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Element.cc
 *
 *  Created on: Mar 16, 2011
 *      Author: jakob
 */


#include <sstream>
#include "Element.h"

namespace vhc {

Element::Element(const Vector3D& entry, const Vector3D& exit, double sectionRadius, Element* next):
		entryPosition(entry),
		exitPosition(exit),
		sectionRadius(sectionRadius),
		next(next) {

}

Element::~Element() {};

Vector3D Element::magneticFieldAt(const Vector3D& position) const {return Vector3D::Null;}

Vector3D Element::electricFieldAt(const Vector3D& position) const {return Vector3D::Null;}

Vector3D Element::getDiagonal() const {return exitPosition - entryPosition;}

Vector3D Element::getEntryPosition() const {return entryPosition;}

Vector3D Element::getExitPosition() const {return exitPosition;}

double Element::getSectionRadius() const {return sectionRadius;}

Element* Element::getNext() const {return next;}

void Element::setNext(Element* n) {next = n;}

bool Element::isConnected() const {return next != NULL;}

std::string Element::getType() const {return "Element";}

std::string Element::toString() const {
	std::stringstream s;
	s << getType() << ":\n";
	s << "\tentry: " << getEntryPosition()	<<	"\n";
	s << "\texit: " << getExitPosition()	<<	"\n";
	s << "\tsection radius: " << getSectionRadius()	<<	"\n";
	s << "\tconnected: " << (isConnected() ? "true" : "false");
	return s.str();
}

} //vhc