gwnavruntime/queries/utils/triangleintersector.h Source File

triangleintersector.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 // Primary contact: JUBA - secondary contact: NOBODY
9 #ifndef Navigation_TriangleIntersector_H
10 #define Navigation_TriangleIntersector_H
11 
14 
15 namespace Kaim
16 {
17 
18 /*
19 class TriangleIntersector
20 */
21 class TriangleIntersector
22 {
23  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Query)
24 
25 public:
26  TriangleIntersector(const Vec3f& a, const Vec3f& b, const Vec3f& c, KyFloat32 integerPrecision)
27  {
28  m_a = a;
29  m_b = b;
30  m_c = c;
31  m_integerPrecision = integerPrecision;
32  }
33 
34  bool DoesIntersectEdge(const CoordPos64& startEdgeCoordPos, const CoordPos64& endEdgeCoordPos)
35  {
36  const Vec3f startEdgePos(startEdgeCoordPos.x * m_integerPrecision, startEdgeCoordPos.y * m_integerPrecision, 0.f);
37  const Vec3f endEdgePos(endEdgeCoordPos.x * m_integerPrecision, endEdgeCoordPos.y * m_integerPrecision, 0.f);
38 
39  return Intersections::SegmentVsTriangle2d(startEdgePos, endEdgePos, m_a, m_b, m_c);
40  }
41 
42 private:
43  Vec3f m_a;
44  Vec3f m_b;
45  Vec3f m_c;
46  KyFloat32 m_integerPrecision;
47 };
48 
49 
50 }
51 
52 
53 #endif //Navigation_TriangleIntersector_H
54 
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:19
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43