MeshLib Documentation
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
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::OriginAndDimensions
shift of zero voxel in 3D space and dimensions of voxel-grid
Definition
MRCalcDims.h:12
MR::OriginAndDimensions::origin
Vector3f origin
Definition
MRCalcDims.h:13
MR::OriginAndDimensions::dimensions
Vector3i dimensions
Definition
MRCalcDims.h:14
MeshLib
source
MRVoxels
MRCalcDims.h
Generated by
1.11.0