|
Celeritas 0.7.0-dev.243+develop.3bda42b9
|
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 constexpr SurfaceType | surface_type () |
| Surface type identifier. | |
| static constexpr 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 > | |
| SimpleQuadric (Span< R, StorageSpan::extent >) | |
| Construct from raw data. | |
| SimpleQuadric (Plane const &other) noexcept(! 0) | |
| Promote from a plane. | |
| template<Axis T> | |
| SimpleQuadric (CylAligned< T > const &other) noexcept | |
| Promote from an axis-aligned cylinder. | |
| SimpleQuadric (Sphere const &other) noexcept(! 0) | |
| Promote from a sphere. | |
| template<Axis T> | |
| SimpleQuadric (ConeAligned< T > const &other) noexcept | |
| Promote from an axis-aligned cone. | |
| SpanConstReal3 | second () const |
| Second-order terms. | |
| SpanConstReal3 | first () const |
| First-order terms. | |
| real_type | zeroth () const |
| Zeroth-order term. | |
| StorageSpan | data () const |
| Get a view to the data for type-deleted storage. | |
| SignedSense | calc_sense (Real3 const &pos) const |
| Determine the sense of the position relative to this surface. | |
| Intersections | calc_intersections (Real3 const &pos, Real3 const &dir, SurfaceState on_surface) const |
| Calculate all possible straight-line intersections with this surface. | |
| 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
*