12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #pragma once
- #include <Mathematics/Hyperellipsoid.h>
- #include <Mathematics/Line.h>
- namespace WwiseGTE
- {
-
-
-
- template <typename Real>
- void Project(Ellipse2<Real> const& ellipse, Line2<Real> const& line,
- Real& smin, Real& smax)
- {
-
- Real center = Dot(line.direction, ellipse.center - line.origin);
-
- Real tmp[2] =
- {
- ellipse.extent[0] * Dot(line.direction, ellipse.axis[0]),
- ellipse.extent[1] * Dot(line.direction, ellipse.axis[1])
- };
- Real rSqr = tmp[0] * tmp[0] + tmp[1] * tmp[1];
- Real radius = std::sqrt(rSqr);
- smin = center - radius;
- smax = center + radius;
- }
-
-
-
- template <typename Real>
- void Project(Ellipsoid3<Real> const& ellipsoid,
- Line3<Real> const& line, Real& smin, Real& smax)
- {
-
- Real center = Dot(line.direction, ellipsoid.center - line.origin);
-
- Real tmp[3] =
- {
- ellipsoid.extent[0] * Dot(line.direction, ellipsoid.axis[0]),
- ellipsoid.extent[1] * Dot(line.direction, ellipsoid.axis[1]),
- ellipsoid.extent[2] * Dot(line.direction, ellipsoid.axis[2])
- };
- Real rSqr = tmp[0] * tmp[0] + tmp[1] * tmp[1] + tmp[2] * tmp[2];
- Real radius = std::sqrt(rSqr);
- smin = center - radius;
- smax = center + radius;
- }
- }
|