gwnavruntime/math/triangle3f.h Source File

triangle3f.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 #pragma once
8 
10 
11 namespace Kaim
12 {
13 
16 {
17  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
18 
19 public:
20  Triangle3f() {}
21  Triangle3f(const Vec3f& A_, const Vec3f& B_, const Vec3f& C_) : A(A_), B(B_), C(C_) {}
22 
23  void Set(const Vec3f& A_, const Vec3f& B_, const Vec3f& C_) { A = A_; B = B_; C = C_; }
24 
25  Vec3f& operator[](KyInt32 i) { return (&A)[i]; }
26  const Vec3f& operator[](KyInt32 i) const { return (&A)[i]; }
27 
28  void MoveZ(KyFloat32 deltaZ)
29  {
30  A.z += deltaZ;
31  B.z += deltaZ;
32  C.z += deltaZ;
33  }
34 
35  Triangle3f OffsetZ(KyFloat32 deltaZ) const
36  {
37  Triangle3f triangle = *this;
38  triangle.MoveZ(deltaZ);
39  return triangle;
40  }
41 
42 public:
43  Vec3f A;
44  Vec3f B;
45  Vec3f C;
46 };
47 
48 inline void SwapEndianness(Endianness::Target e, Triangle3f& self)
49 {
50  SwapEndianness(e, self.A);
51  SwapEndianness(e, self.B);
52  SwapEndianness(e, self.C);
53 }
54 
55 }
56 
57 
58 
3d triangle of 32bits floating points
Definition: triangle3f.h:15
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16