Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-04-05 21:15:09 +0300
committerHans Goudey <h.goudey@me.com>2021-04-05 21:15:09 +0300
commit24d32a796ab270d72b2b0680934f0e80c36e6dfa (patch)
tree009a7e6792e7f22137c076f4429a802417c59e5a /source/blender/blenlib
parentd1519df6a85eda5be2e6831c21f0a43995c7b633 (diff)
Geometry Nodes Curves: Add incomplete quaternion header
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_quaternion.hh62
1 files changed, 62 insertions, 0 deletions
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