63 template <
typename T2>
89 template <
typename T2>
96 template <
typename T2>
163 #define AGX_BOUND_VEC2_OVERRIDE(VecType) \
165 AGX_FORCE_INLINE bool BoundT<VecType>::contains(const VecType& value) const \
167 return value[0] >= m_min[0] && value[1] >= m_min[1] && \
168 value[0] <= m_max[0] && value[1] <= m_max[1]; \
171 AGX_FORCE_INLINE bool BoundT<VecType>::hasOverlap(const BoundT<VecType>& other) const \
173 const bool overlaps = \
174 (m_max[0] >= other.min()[0]) && (other.max()[0] >= m_min[0]) && \
175 (m_max[1] >= other.min()[1]) && (other.max()[1] >= m_min[1]); \
179 AGX_FORCE_INLINE bool BoundT<VecType>::isValid() const \
181 return (m_min[0] <= m_max[0] && m_min[1] <= m_max[1]); \
184 AGX_FORCE_INLINE BoundT<VecType> BoundT<VecType>::calculateOverlap(const BoundT<VecType>& other) const \
186 return BoundT<VecType>( \
187 VecType(std::max(m_min[0], other.min()[0]), std::max(m_min[1], other.min()[1])), \
188 VecType(std::min(m_max[0], other.max()[0]), std::min(m_max[1], other.max()[1]))); \
191 #define AGX_BOUND_VEC3_OVERRIDE(VecType) \
193 AGX_FORCE_INLINE bool BoundT<VecType>::contains(const VecType& value) const \
195 return value[0] >= m_min[0] && value[1] >= m_min[1] && value[2] >= m_min[2] && \
196 value[0] <= m_max[0] && value[1] <= m_max[1] && value[2] <= m_max[2]; \
199 AGX_FORCE_INLINE bool BoundT<VecType>::hasOverlap(const BoundT<VecType>& other) const \
201 const bool overlaps = \
202 (m_max[0] >= other.min()[0]) && (other.max()[0] >= m_min[0]) && \
203 (m_max[1] >= other.min()[1]) && (other.max()[1] >= m_min[1]) && \
204 (m_max[2] >= other.min()[2]) && (other.max()[2] >= m_min[2]); \
208 AGX_FORCE_INLINE bool BoundT<VecType>::isValid() const \
210 return (m_min[0] <= m_max[0] && m_min[1] <= m_max[1] && m_min[2] <= m_max[2]); \
213 AGX_FORCE_INLINE BoundT<VecType> BoundT<VecType>::calculateOverlap(const BoundT<VecType>& other) const \
215 return BoundT<VecType>( \
216 VecType(std::max(m_min[0], other.m_min[0]), std::max(m_min[1], other.m_min[1]), std::max(m_min[2], other.m_min[2])), \
217 VecType(std::min(m_max[0], other.m_max[0]), std::max(m_min[1], other.m_min[1]), std::max(m_min[2], other.m_min[2]))); \
239 template <
typename T>
template <
typename T2>
242 template <
typename T>
245 template <
typename T>
248 template <
typename T>
251 template <
typename T>
254 template <
typename T>
257 template <
typename T>
260 template <
typename T>
263 template <
typename T>
266 template <
typename T>
269 template <
typename T>
272 std::is_same_v<T, agx::Vec2i64> ||
273 std::is_same_v<T, agx::Vec3i64> ||
274 std::is_same_v<T, agx::Vec4i64> )
275 return static_cast<T
>( ( m_min + m_max ) / 2 );
277 return static_cast<T
>( ( m_min + m_max ) * 0.5 );
280 template <
typename T>
284 template <
typename T>
template <
typename T2>
288 T halfSize = this->size() * scale * 0.5;
289 m_min = mid - halfSize;
290 m_max = mid + halfSize;
294 template <
typename T>
template <
typename T2>
297 BoundT bound(m_min, m_max);
302 template <
typename T>
305 template <
typename T>
311 template <
typename T>
314 agxAbort1(
"Type specific implementation missing");
318 template <
typename T>
321 return BoundT(m_min + offset, m_max + offset);
324 template <
typename T>
327 return m_min == other.
m_min && m_max == other.
m_max;
331 template <
typename T>
340 template <
typename T>
343 return m_min != other.
m_min || m_max != other.
m_max;
349 output << bound.
min() <<
" : " << bound.
max();
#define AGX_BOUND_VEC3_OVERRIDE(VecType)
#define AGX_BOUND_VEC2_OVERRIDE(VecType)
#define AGX_TYPE_BINDING(_Type, _Name)
A BoundT represents a range defined by a minimum and a maximum value.
BoundT calculateOverlap(const BoundT &other) const
bool contains(const T &value) const
BoundT & operator=(const BoundT &other)
bool hasOverlap(const BoundT &other) const
BoundT()
Create a bound initialized to the empty range located at the type's default value.
BoundT & operator*=(T2 scale)
Scale the bound so that is size is changed according to the given scale, but the midpoint remains unc...
bool operator==(const BoundT &other) const
BoundT translate(const T &offset) const
Move the bound's midpoint without altering its size.
BoundT(const BoundT &other)
void set(const T &min, const T &max)
Relocate the bound to the new location.
BoundT operator*(T2 scale)
Create a new bound that has the same midpoint as the current bound, but with a size that is scaled ac...
BoundT(const T &min, const T &max)
bool operator!=(const BoundT &other) const
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
BoundT< Vec3i64 > Bound3i64
BoundT< Vec2i32 > Bound2i32
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
BoundT< Vec2u64 > Bound2u64
BoundT< Int32 > Bound1i32
std::ostream & operator<<(std::ostream &os, const agx::AddedMassInteraction::Matrix6x6 &m)
BoundT< Vec3u64 > Bound3u64
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
BoundT< Vec2i64 > Bound2i64
BoundT< Vec3i32 > Bound3i32
BoundT< Vec2u32 > Bound2u32
BoundT< Int64 > Bound1i64
BoundT< UInt32 > Bound1u32
BoundT< Vec3u32 > Bound3u32
BoundT< UInt64 > Bound1u64