gwnavruntime/queries/utils/convexquadintersector.h Source File

convexquadintersector.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 #pragma once
9 
12 
13 namespace Kaim
14 {
15 
16 /*
17 class ConvexQuadIntersector
18 */
19 class ConvexQuadIntersector
20 {
21  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Query)
22 
23 public:
24  ConvexQuadIntersector(const Vec3f& a, const Vec3f& b, const Vec3f& c, const Vec3f& d, KyFloat32 integerPrecision)
25  {
26  m_a = a;
27  m_b = b;
28  m_c = c;
29  m_d = d;
30  m_integerPrecision = integerPrecision;
31  }
32 
33  bool DoesIntersectEdge(const CoordPos64& startEdgeCoordPos, const CoordPos64& endEdgeCoordPos)
34  {
35  const Vec3f startEdgePos(startEdgeCoordPos.x * m_integerPrecision, startEdgeCoordPos.y * m_integerPrecision, 0.f);
36  const Vec3f endEdgePos(endEdgeCoordPos.x * m_integerPrecision, endEdgeCoordPos.y * m_integerPrecision, 0.f);
37 
38  return Math::IsSegmentVsConvexQuad2f(startEdgePos, endEdgePos, m_a, m_b, m_c, m_d);
39  }
40 
41 private:
42  Vec3f m_a;
43  Vec3f m_b;
44  Vec3f m_c;
45  Vec3f m_d;
46  KyFloat32 m_integerPrecision;
47 };
48 
49 
50 }
51 
52 
53 
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:16
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
float KyFloat32
float
Definition: types.h:32