summaryrefslogtreecommitdiff
path: root/src/main/StraightElement.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/StraightElement.h')
-rw-r--r--src/main/StraightElement.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/StraightElement.h b/src/main/StraightElement.h
index 8ce4db0..cf769be 100644
--- a/src/main/StraightElement.h
+++ b/src/main/StraightElement.h
@@ -23,8 +23,22 @@ public:
Element(entry, exit, sectionRadius, next)
{};
+ // TODO avec cette mauvaise méthode, tous les éléments pointent vers l'origine...
+ /** Constructeur d'une section, où l'on donne une position d'entrée et une longueur. */
+ StraightElement(const Vector3D& entry, double l, double sectionRadius,const Vector3D& exit=Vector3D::Null, Element* next = NULL):
+ Element(entry, exit, sectionRadius, next)
+ { this->setLength(l); };
+
+ /* Affecte un longueur à la section droite, à partir de la position d'entrée. */
+ void setLength (double l) {
+ setExitPosition( entryPosition + ( l * (~(exitPosition - entryPosition))));
+ }
+
+ //TODO ! why can't you access protected variables, i.e. entryPosition won't work?!
+
virtual StraightElement* copy() const {return new StraightElement(*this);}
+
virtual bool isOutside(const Particle& particle) const {
Vector3D a(particle.getPosition() - entryPosition);
const Vector3D b = (particle.getPosition() - entryPosition);
@@ -36,6 +50,9 @@ public:
return getDiagonal().dot(v) > getDiagonal().dot(getDiagonal());
}
+ /* Retourne une chaîne de caractères de cet élément droit. */
+ virtual std::string toString () const;
+
virtual std::string getType() const {return "Straight Element";}
virtual std::string toString() const {
std::stringstream s;