Path: blob/master/thirdparty/jolt_physics/Jolt/Geometry/OrientedBox.h
9913 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Geometry/Triangle.h>7#include <Jolt/Geometry/IndexedTriangle.h>8#include <Jolt/Geometry/AABox.h>9#include <Jolt/Math/Mat44.h>1011JPH_NAMESPACE_BEGIN1213class AABox;1415/// Oriented box16class JPH_EXPORT_GCC_BUG_WORKAROUND [[nodiscard]] OrientedBox17{18public:19JPH_OVERRIDE_NEW_DELETE2021/// Constructor22OrientedBox() = default;23OrientedBox(Mat44Arg inOrientation, Vec3Arg inHalfExtents) : mOrientation(inOrientation), mHalfExtents(inHalfExtents) { }2425/// Construct from axis aligned box and transform. Only works for rotation/translation matrix (no scaling / shearing).26OrientedBox(Mat44Arg inOrientation, const AABox &inBox) : OrientedBox(inOrientation.PreTranslated(inBox.GetCenter()), inBox.GetExtent()) { }2728/// Test if oriented box overlaps with axis aligned box each other29bool Overlaps(const AABox &inBox, float inEpsilon = 1.0e-6f) const;3031/// Test if two oriented boxes overlap each other32bool Overlaps(const OrientedBox &inBox, float inEpsilon = 1.0e-6f) const;3334Mat44 mOrientation; ///< Transform that positions and rotates the local space axis aligned box into world space35Vec3 mHalfExtents; ///< Half extents (half the size of the edge) of the local space axis aligned box36};3738JPH_NAMESPACE_END394041