Celeritas 0.7.0-dev.79+develop.b3dc2e108
|
General quadric expression but with no off-axis terms. More...
#include <SimpleQuadric.hh>
Type aliases | |
using | Intersections = Array< real_type, 2 > |
Surface type identifier. | |
using | StorageSpan = Span< real_type const, 7 > |
Surface type identifier. | |
using | SpanConstReal3 = Span< real_type const, 3 > |
Surface type identifier. | |
static CELER_CONSTEXPR_FUNCTION SurfaceType | surface_type () |
Surface type identifier. | |
static CELER_CONSTEXPR_FUNCTION bool | simple_safety () |
Safety is not the intersection along surface normal. | |
SimpleQuadric (Real3 const &abc, Real3 const &def, real_type g) | |
Construct with coefficients. | |
template<class R > | |
CELER_FUNCTION | SimpleQuadric (Span< R, StorageSpan::extent >) |
Construct from raw data. | |
SimpleQuadric (Plane const &other) noexcept(!CELERITAS_DEBUG) | |
Promote from a plane. | |
template<Axis T> | |
SimpleQuadric (CylAligned< T > const &other) noexcept | |
Promote from an axis-aligned cylinder. | |
SimpleQuadric (Sphere const &other) noexcept(!CELERITAS_DEBUG) | |
Promote from a sphere. | |
template<Axis T> | |
SimpleQuadric (ConeAligned< T > const &other) noexcept | |
Promote from an axis-aligned cone. | |
CELER_FUNCTION SpanConstReal3 | second () const |
Second-order terms. | |
CELER_FUNCTION SpanConstReal3 | first () const |
First-order terms. | |
CELER_FUNCTION real_type | zeroth () const |
Zeroth-order term. | |
CELER_FUNCTION StorageSpan | data () const |
Get a view to the data for type-deleted storage. | |
CELER_FUNCTION SignedSense | calc_sense (Real3 const &pos) const |
Determine the sense of the position relative to this surface. | |
CELER_FUNCTION Intersections | calc_intersections (Real3 const &pos, Real3 const &dir, SurfaceState on_surface) const |
Calculate all possible straight-line intersections with this surface. | |
CELER_FUNCTION Real3 | calc_normal (Real3 const &pos) const |
Calculate outward normal at a position. | |
General quadric expression but with no off-axis terms.
Stored:
\[ ax^2 + by^2 + cz^2 + dx + ey + fz + g = 0 \]
This can represent axis-aligned hyperboloids, ellipsoids, elliptical cylinders, etc. The quadric is ill-defined if all non-constants are zero.
Even though this equation can be scaled arbitrarily, the quadratic solver is sensitive to the scale of the coefficients to avoid numerical precision loss. If present, the first-order coefficients should be on the length scale of the problem (i.e., translations avoid catastrophic precision loss). In most non-pathological cases, the scale of the second-order components should be unity, as is the case when promoting spheres, cones, and cylinders.
Promote from a plane.
Note that the plane is written as \( ax + by + cz - d = 0 \) whereas the simple quadric has a different sign for the constant: \( dx + ey + fz + g = 0 \) .
Promote from a sphere.
x^2 + y^2 + z^2 - 2x_0 - 2y_0 - 2z_0 + x_0^2 + y_0^2 + z_0^2 - r^2 = 0 *