diff options
Diffstat (limited to 'src/main/StraightElement.cc')
-rw-r--r-- | src/main/StraightElement.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/StraightElement.cc b/src/main/StraightElement.cc index 420e047..05e88c6 100644 --- a/src/main/StraightElement.cc +++ b/src/main/StraightElement.cc @@ -16,8 +16,8 @@ StraightElement::StraightElement(const Vector3D& entry, const Vector3D& exit, do StraightElement::~StraightElement() {}; bool StraightElement::isBefore(const Vector3D& position) const { - const Vector3D v(position - exitPosition); - return (-getDiagonal()).dot(v) > getDiagonal().normSquare(); + const Vector3D v(position - entryPosition); + return (-getDiagonal()).dot(v) > 0;//getDiagonal().normSquare(); } bool StraightElement::isBeside(const Vector3D& position) const { @@ -27,8 +27,12 @@ bool StraightElement::isBeside(const Vector3D& position) const { }; bool StraightElement::isAfter(const Vector3D& position) const { - const Vector3D v(position - entryPosition); - return getDiagonal().dot(v) > getDiagonal().normSquare(); + const Vector3D v(position - exitPosition); + return getDiagonal().dot(v) > 0; +} + +Vector3D StraightElement::getHorizontalAt(const Vector3D& position) const { + return Vector3D::k.cross(getDiagonal()); } std::string StraightElement::getType() const {return "Straight Element";} |