[Bf-blender-cvs] [24d32a796ab] geometry-nodes-curve-support: Geometry Nodes Curves: Add incomplete quaternion header

Hans Goudey noreply at git.blender.org
Mon Apr 5 20:15:17 CEST 2021


Commit: 24d32a796ab270d72b2b0680934f0e80c36e6dfa
Author: Hans Goudey
Date:   Mon Apr 5 13:15:09 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rB24d32a796ab270d72b2b0680934f0e80c36e6dfa

Geometry Nodes Curves: Add incomplete quaternion header

===================================================================

A	source/blender/blenlib/BLI_quaternion.hh

===================================================================

diff --git a/source/blender/blenlib/BLI_quaternion.hh b/source/blender/blenlib/BLI_quaternion.hh
new file mode 100644
index 00000000000..85b738b4d23
--- /dev/null
+++ b/source/blender/blenlib/BLI_quaternion.hh
@@ -0,0 +1,62 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include <iostream>
+
+#include "BLI_float3.hh"
+#include "BLI_math_rotation.h"
+
+namespace blender {
+
+struct Quaternion {
+  float values[4];
+
+  Quaternion() = default;
+
+  static Quaternion unit()
+  {
+    Quaternion unit;
+    unit_qt(unit);
+    return unit;
+  }
+
+  bool is_zero()
+  {
+    return values[0] == 0.0f && values[1] == 0.0f && values[2] == 0.0f && values[3] == 0.0f;
+  }
+
+  Quaternion(const float *ptr) : values[0]{ptr[0]}, y{ptr[1]}, z{ptr[2]}
+  {
+  }
+
+  Quaternion(const float (*ptr)[4]) : Quaternion(static_cast<const float *>(ptr[0]))
+  {
+  }
+
+  operator const float *() const
+  {
+    return values;
+  }
+
+  operator float *()
+  {
+    return values;
+  }
+};
+
+}  // namespace blender



More information about the Bf-blender-cvs mailing list