/**************************************************************************/ /* quaternion.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #include "quaternion.h" #include "core/math/basis.h" #include "core/string/ustring.h" real_t Quaternion::angle_to(const Quaternion &p_to) const { … } Vector3 Quaternion::get_euler(EulerOrder p_order) const { … } void Quaternion::operator*=(const Quaternion &p_q) { … } Quaternion Quaternion::operator*(const Quaternion &p_q) const { … } bool Quaternion::is_equal_approx(const Quaternion &p_quaternion) const { … } bool Quaternion::is_finite() const { … } real_t Quaternion::length() const { … } void Quaternion::normalize() { … } Quaternion Quaternion::normalized() const { … } bool Quaternion::is_normalized() const { … } Quaternion Quaternion::inverse() const { … } Quaternion Quaternion::log() const { … } Quaternion Quaternion::exp() const { … } Quaternion Quaternion::slerp(const Quaternion &p_to, real_t p_weight) const { … } Quaternion Quaternion::slerpni(const Quaternion &p_to, real_t p_weight) const { … } Quaternion Quaternion::spherical_cubic_interpolate(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, real_t p_weight) const { … } Quaternion Quaternion::spherical_cubic_interpolate_in_time(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, real_t p_weight, real_t p_b_t, real_t p_pre_a_t, real_t p_post_b_t) const { … } operator String() Vector3 Quaternion::get_axis() const { … } real_t Quaternion::get_angle() const { … } Quaternion::Quaternion(const Vector3 &p_axis, real_t p_angle) { … } // Euler constructor expects a vector containing the Euler angles in the format // (ax, ay, az), where ax is the angle of rotation around x axis, // and similar for other axes. // This implementation uses YXZ convention (Z is the first rotation). Quaternion Quaternion::from_euler(const Vector3 &p_euler) { … }