IAP GITLAB

Skip to content
Snippets Groups Projects
Commit a292e6c6 authored by Ralf Ulrich's avatar Ralf Ulrich
Browse files

Merge branch 'removed_unused_file' into 'master'

remove unused file

See merge request !409
parents 785332c9 d88b1073
No related branches found
No related tags found
No related merge requests found
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#pragma once
#include <corsika/framework/geometry/Point.hpp>
#include <corsika/framework/geometry/QuantityVector.hpp>
#include <corsika/framework/geometry/Sphere.hpp>
#include <corsika/framework/geometry/Vector.hpp>
#include <corsika/media/Environment.hpp>
#include <limits>
#include <stdexcept>
#include <utility>
namespace corsika::tracking_line {
inline std::optional<std::pair<TimeType, TimeType>> TimeOfIntersection(
corsika::Line const& line, corsika::Sphere const& sphere) {
auto const delta = line.getStartPoint() - sphere.getCenter();
auto const v = line.getVelocity();
auto const vSqNorm =
v.getSquaredNorm(); // todo: get rid of this by having V0 normalized always
auto const R = sphere.getRadius();
auto const vDotDelta = v.dot(delta);
auto const discriminant =
vDotDelta * vDotDelta - vSqNorm * (delta.getSquaredNorm() - R * R);
if (discriminant.magnitude() > 0) {
auto const sqDisc = sqrt(discriminant);
auto const invDenom = 1 / vSqNorm;
return std::make_pair((-vDotDelta - sqDisc) * invDenom,
(-vDotDelta + sqDisc) * invDenom);
} else {
return {};
}
}
inline TimeType getTimeOfIntersection(Line const& vLine, Plane const& vPlane) {
auto const delta = vPlane.getCenter() - vLine.getStartPoint();
auto const v = vLine.getVelocity();
auto const n = vPlane.getNormal();
auto const c = n.dot(v);
if (c.magnitude() == 0) {
return std::numeric_limits<TimeType::value_type>::infinity() * 1_s;
} else {
return n.dot(delta) / c;
}
}
} // namespace corsika::tracking_line
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment