MeshLib C++ Docs
Loading...
Searching...
No Matches

Classes

struct  MR::Box< V >
 Box given by its min- and max- corners. More...

Functions

template<typename T>
std::array< Vector3< T >, 8 > MR::getCorners (const Box< Vector3< T > > &box)
 returns all corners of given box
template<typename T>
std::array< Vector2< T >, 4 > MR::getCorners (const Box< Vector2< T > > &box)
template<typename V>
MinMax< typename Box< V >::T > MR::getTouchPlanes (const Box< V > &box, const V &n)
template<typename V>
Box< V > MR::transformed (const Box< V > &box, const AffineXf< V > &xf)
 find the tightest box enclosing this one after transformation
template<typename V>
Box< V > MR::transformed (const Box< V > &box, const AffineXf< V > *xf)
 this version returns input box as is if pointer to transformation is null
template<typename V>
auto MR::width (const Box< V > &box)
 returns size along x axis
template<typename V>
auto MR::height (const Box< V > &box)
 returns size along y axis
template<typename V>
auto MR::depth (const Box< V > &box)
 returns size along z axis
template<typename V>
auto MR::findSortedBoxDims (const Box< V > &box) -> typename VectorTraits< V >::template ChangeBaseType< int >
template<size_t I, typename V>
constexpr const V & MR::get (const Box< V > &box) noexcept
 get<0> returns min, get<1> returns max
template<size_t I, typename V>
constexpr V & MR::get (Box< V > &box) noexcept

Detailed Description

Function Documentation

◆ depth()

template<typename V>
auto MR::depth ( const Box< V > & box)
inline

#include <MRMesh/MRBox.h>

returns size along z axis

◆ findSortedBoxDims()

template<typename V>
auto MR::findSortedBoxDims ( const Box< V > & box) -> typename VectorTraits<V>::template ChangeBaseType<int>
inline

#include <MRMesh/MRBox.h>

returns a vector with unique integer values, each representing a dimension of the box; the dimensions are sorted according to the sizes of the box along each dimension: the dimension with the smallest size is first, largest size - last. E.g. findSortedBoxDims( Box3f( {0, 0, 0}, {2, 1, 3} ) ) == Vector3i(1, 0, 2)

bubble sort (optimal for small array)

◆ get() [1/2]

template<size_t I, typename V>
V & MR::get ( Box< V > & box)
constexprnoexcept

#include <MRMesh/MRBox.h>

◆ get() [2/2]

template<size_t I, typename V>
const V & MR::get ( const Box< V > & box)
constexprnoexcept

#include <MRMesh/MRBox.h>

get<0> returns min, get<1> returns max

◆ getCorners() [1/2]

template<typename T>
std::array< Vector2< T >, 4 > MR::getCorners ( const Box< Vector2< T > > & box)
inline

#include <MRMesh/MRBox.h>

◆ getCorners() [2/2]

template<typename T>
std::array< Vector3< T >, 8 > MR::getCorners ( const Box< Vector3< T > > & box)
inline

#include <MRMesh/MRBox.h>

returns all corners of given box

◆ getTouchPlanes()

template<typename V>
MinMax< typename Box< V >::T > MR::getTouchPlanes ( const Box< V > & box,
const V & n )

#include <MRMesh/MRBox.h>

among all planes with given normal and arbitrary shift: dot(n,x) = d finds minimal and maximal touching planes for given box, and returns them as { min_d, max_d }

◆ height()

template<typename V>
auto MR::height ( const Box< V > & box)
inline

#include <MRMesh/MRBox.h>

returns size along y axis

◆ transformed() [1/2]

template<typename V>
Box< V > MR::transformed ( const Box< V > & box,
const AffineXf< V > & xf )
inline

#include <MRMesh/MRBox.h>

find the tightest box enclosing this one after transformation

every coordinate of xf( p ) is monotone in each coordinate of p, even with rounding, so its minimum and maximum over the corners of the box are reached at the corners selected by the signs of the matrix row

◆ transformed() [2/2]

template<typename V>
Box< V > MR::transformed ( const Box< V > & box,
const AffineXf< V > * xf )
inline

#include <MRMesh/MRBox.h>

this version returns input box as is if pointer to transformation is null

◆ width()

template<typename V>
auto MR::width ( const Box< V > & box)
inline

#include <MRMesh/MRBox.h>

returns size along x axis