aboutsummaryrefslogtreecommitdiff
path: root/tool_src/BspLib/Vertex2.h
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2026-08-24 11:16:07 +0200
committerFelix Morgner <felix.morgner@gmail.com>2026-08-24 11:16:07 +0200
commitc068f22329d5cc722622a2183bbb22eef2093df7 (patch)
tree12d56c1aede67988a55e241364606bfbb4dba933 /tool_src/BspLib/Vertex2.h
downloadopenparsec-c068f22329d5cc722622a2183bbb22eef2093df7.tar.xz
openparsec-c068f22329d5cc722622a2183bbb22eef2093df7.zip
initial importHEADmain
Diffstat (limited to 'tool_src/BspLib/Vertex2.h')
-rw-r--r--tool_src/BspLib/Vertex2.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/tool_src/BspLib/Vertex2.h b/tool_src/BspLib/Vertex2.h
new file mode 100644
index 0000000..5ebf100
--- /dev/null
+++ b/tool_src/BspLib/Vertex2.h
@@ -0,0 +1,76 @@
+//-----------------------------------------------------------------------------
+// BSPLIB HEADER: Vertex2.h
+//
+// Copyright (c) 1997 by Markus Hadwiger
+// All Rights Reserved.
+//-----------------------------------------------------------------------------
+
+#ifndef _VERTEX2_H_
+#define _VERTEX2_H_
+
+// bsplib header files
+#include "BspLibDefs.h"
+
+
+BSPLIB_NAMESPACE_BEGIN
+
+
+// conversion from Vector2 to Vertex2 -----------------------------------------
+inline Vertex2::Vertex2( const Vector2& vect )
+{
+ X = vect.X;
+ Y = vect.Y;
+ W = vect.W;
+}
+
+// operator '==' does memberwise comparison for (X,Y,W) -----------------------
+inline int operator ==( const Vertex2 v1, const Vertex2 v2 )
+{
+ return ( ( v1.X == v2.X ) && ( v1.Y == v2.Y ) && ( v1.W == v2.W ) );
+}
+
+// operator '!=' does memberwise comparison for (X,Y,W) -----------------------
+inline int operator !=( const Vertex2 v1, const Vertex2 v2 )
+{
+ return ( ( v1.X != v2.X ) || ( v1.Y != v2.Y ) || ( v1.W != v2.W ) );
+}
+
+// operator '+=' does memberwise addition for (X,Y) ---------------------------
+inline Vertex2& Vertex2::operator +=( const Vector2 v )
+{
+ X += v.X;
+ Y += v.Y;
+
+ return *this;
+}
+
+// operator '-=' does memberwise subtraction for (X,Y) ------------------------
+inline Vertex2& Vertex2::operator -=( const Vector2 v )
+{
+ X -= v.X;
+ Y -= v.Y;
+
+ return *this;
+}
+
+// check if specified vertex is in vicinity of local vertex -------------------
+inline int Vertex2::IsInVicinity( const Vertex2& vertex ) const
+{
+ return ( ( fabs( X - vertex.X ) < EPS_VERTEX_MERGE ) &&
+ ( fabs( Y - vertex.Y ) < EPS_VERTEX_MERGE ) );
+}
+
+// copy three coordinates into two plus w -------------------------------------
+inline void Vertex2::InitFromVertex3( const Vertex3& vertex )
+{
+ X = vertex.getX();
+ Y = vertex.getY();
+ W = vertex.getZ();
+}
+
+
+BSPLIB_NAMESPACE_END
+
+
+#endif // _VERTEX2_H_
+