GteIntrPlane3OrientedBox3.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 
12 #include <Mathematics/GteFIQuery.h>
13 #include <Mathematics/GteTIQuery.h>
14 
15 namespace gte
16 {
17 
18 template <typename Real>
19 class TIQuery<Real, Plane3<Real>, OrientedBox3<Real>>
20 {
21 public:
22  struct Result
23  {
24  bool intersect;
25  };
26 
27  Result operator()(Plane3<Real> const& plane,
28  OrientedBox3<Real> const& box);
29 };
30 
31 
32 template <typename Real>
35  Plane3<Real> const& plane, OrientedBox3<Real> const& box)
36 {
37  Result result;
38 
39  Real radius =
40  std::abs(box.extent[0] * Dot(plane.normal, box.axis[0])) +
41  std::abs(box.extent[1] * Dot(plane.normal, box.axis[1])) +
42  std::abs(box.extent[2] * Dot(plane.normal, box.axis[2]));
43 
45  auto ppResult = ppQuery(box.center, plane);
46  result.intersect = (ppResult.distance <= radius);
47  return result;
48 }
49 
50 
51 }
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
Definition: GteBSNumber.h:966
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