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
7namespace MR
8{
9
12{
13 Vector3f origin;
14 Vector3i dimensions;
15};
16
18inline 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
Definition MRCameraOrientationPlugin.h:8
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
shift of zero voxel in 3D space and dimensions of voxel-grid
Definition MRCalcDims.h:12
Vector3f origin
Definition MRCalcDims.h:13
Vector3i dimensions
Definition MRCalcDims.h:14