GteIntrPlane3Ellipsoid3.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
13 #include <Mathematics/GteTIQuery.h>
14 
15 namespace gte
16 {
17 
18 template <typename Real>
19 class TIQuery<Real, Plane3<Real>, Ellipsoid3<Real>>
20 {
21 public:
22  struct Result
23  {
24  bool intersect;
25  };
26 
27  Result operator()(Plane3<Real> const& plane,
28  Ellipsoid3<Real> const& ellipsoid);
29 };
30 
31 
32 template <typename Real>
35  Plane3<Real> const& plane, Ellipsoid3<Real> const& ellipsoid)
36 {
37  Result result;
38  Matrix3x3<Real> MInverse;
39  ellipsoid.GetMInverse(MInverse);
40  Real discr = Dot(plane.normal, MInverse * plane.normal);
41  Real root = sqrt(std::max(discr, (Real)0));
43  Real distance = vpQuery(ellipsoid.center, plane).distance;
44  result.intersect = (distance <= root);
45  return result;
46 }
47 
48 
49 }
GLsizei GLsizei GLfloat distance
Definition: glext.h:9704
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)
GLuint64EXT * result
Definition: glext.h:10003


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00