/**************************************************************************/ /* aabb.h */ /**************************************************************************/ /* 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. */ /**************************************************************************/ #ifndef AABB_H #define AABB_H #include "core/math/plane.h" #include "core/math/vector3.h" /** * AABB (Axis Aligned Bounding Box) * This is implemented by a point (position) and the box size. */ class Variant; struct [[nodiscard]] AABB { … }; inline bool AABB::intersects(const AABB &p_aabb) const { … } inline bool AABB::intersects_inclusive(const AABB &p_aabb) const { … } inline bool AABB::encloses(const AABB &p_aabb) const { … } Vector3 AABB::get_support(const Vector3 &p_direction) const { … } Vector3 AABB::get_endpoint(int p_point) const { … } bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const { … } bool AABB::inside_convex_shape(const Plane *p_planes, int p_plane_count) const { … } bool AABB::has_point(const Vector3 &p_point) const { … } inline void AABB::expand_to(const Vector3 &p_vector) { … } void AABB::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const { … } inline real_t AABB::get_longest_axis_size() const { … } inline real_t AABB::get_shortest_axis_size() const { … } bool AABB::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t p_t0, real_t p_t1) const { … } void AABB::grow_by(real_t p_amount) { … } void AABB::quantize(real_t p_unit) { … } AABB AABB::quantized(real_t p_unit) const { … } #endif // AABB_H