MeshLib C++ Docs
Loading...
Searching...
No Matches
MRCalcDims.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
MRVoxelsFwd.h
"
4
#include <
MRMesh/MRVector3.h
>
5
#include <
MRMesh/MRBox.h
>
6
7
namespace
MR
8
{
9
11
struct
OriginAndDimensions
12
{
13
Vector3f origin;
14
Vector3i dimensions;
15
};
16
18
inline
OriginAndDimensions
calcOriginAndDimensions
(
const
Box3f
& box,
float
voxelSize )
19
{
20
const
auto
expansion =
Vector3f::diagonal
( 2 * voxelSize );
21
const
auto
origin = box.min - expansion;
22
return
23
{
24
.origin = origin,
25
.dimensions =
Vector3i
( ( box.max + expansion - origin ) / voxelSize ) +
Vector3i::diagonal
( 1 )
26
};
27
}
28
29
}
//namespace MR
30
MRBox.h
MRVector3.h
MRVoxelsFwd.h
MR::OriginAndDimensions
Definition
MRCalcDims.h:12
MR
Definition
MRCameraOrientationPlugin.h:8
MR::calcOriginAndDimensions
OriginAndDimensions calcOriginAndDimensions(const Box3f &box, float voxelSize)
computes origin and dimensions of voxel-grid to cover given 3D box with given spacing (voxelSize)
Definition
MRCalcDims.h:18
MR::Box3f
MR::Vector3f::diagonal
static MR.Vector3f diagonal(float a)
MR::Vector3i
MR::Vector3i::diagonal
static MR.Vector3i diagonal(int a)
MeshLib
source
MRVoxels
MRCalcDims.h
Generated by
1.11.0