/**************************************************************************/ /* aabb.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 "aabb.h" #include "core/string/ustring.h" #include "core/variant/variant.h" real_t AABB::get_volume() const { … } bool AABB::operator==(const AABB &p_rval) const { … } bool AABB::operator!=(const AABB &p_rval) const { … } void AABB::merge_with(const AABB &p_aabb) { … } bool AABB::is_equal_approx(const AABB &p_aabb) const { … } bool AABB::is_finite() const { … } AABB AABB::intersection(const AABB &p_aabb) const { … } // Note that this routine returns the BACKTRACKED (i.e. behind the ray origin) // intersection point + normal if INSIDE the AABB. // The caller can therefore decide when INSIDE whether to use the // backtracked intersection, or use p_from as the intersection, and // carry on progressing without e.g. reflecting against the normal. bool AABB::find_intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, bool &r_inside, Vector3 *r_intersection_point, Vector3 *r_normal) const { … } bool AABB::intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_intersection_point, Vector3 *r_normal) const { … } bool AABB::intersects_plane(const Plane &p_plane) const { … } Vector3 AABB::get_longest_axis() const { … } int AABB::get_longest_axis_index() const { … } Vector3 AABB::get_shortest_axis() const { … } int AABB::get_shortest_axis_index() const { … } AABB AABB::merge(const AABB &p_with) const { … } AABB AABB::expand(const Vector3 &p_vector) const { … } AABB AABB::grow(real_t p_by) const { … } void AABB::get_edge(int p_edge, Vector3 &r_from, Vector3 &r_to) const { … } Variant AABB::intersects_segment_bind(const Vector3 &p_from, const Vector3 &p_to) const { … } Variant AABB::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const { … } operator String()