summaryrefslogtreecommitdiff
path: root/include/cglm/struct/plane.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cglm/struct/plane.h')
-rw-r--r--include/cglm/struct/plane.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/cglm/struct/plane.h b/include/cglm/struct/plane.h
new file mode 100644
index 0000000..6a84ac7
--- /dev/null
+++ b/include/cglm/struct/plane.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c), Recep Aslantas.
+ *
+ * MIT License (MIT), http://opensource.org/licenses/MIT
+ * Full license can be found in the LICENSE file
+ */
+
+#ifndef cglms_planes_h
+#define cglms_planes_h
+
+#include "../common.h"
+#include "../types-struct.h"
+#include "../plane.h"
+#include "vec4.h"
+
+/*
+ Plane equation: Ax + By + Cz + D = 0;
+
+ It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance
+*/
+
+/*
+ Functions:
+ CGLM_INLINE vec4s glms_plane_normalize(vec4s plane);
+ */
+
+/*!
+ * @brief normalizes a plane
+ *
+ * @param[in] plane plane to normalize
+ * @returns normalized plane
+ */
+CGLM_INLINE
+vec4s
+glms_plane_normalize(vec4s plane) {
+ glm_plane_normalize(plane.raw);
+ return plane;
+}
+
+#endif /* cglms_planes_h */