FieldMapping.cpp File Reference

Contains the FieldMapping base class and the NullFieldMapping and MatrixFieldMapping subclass implementations. More...

`#include <iostream>`
`#include <vector>`
`#include "Field.h"`
`#include "FieldMapping.h"`
`#include "Types.h"`

Go to the source code of this file.

## Namespaces

namespace | FIELD3D_NAMESPACE_OPEN

## Functions

template<class Matrix_T>
bool | FIELD3D_NAMESPACE_OPEN::checkMatricesIdentical (const Matrix_T &m1, const Matrix_T &m2, double tolerance)
const string | FIELD3D_NAMESPACE_OPEN::k_frustumMappingName ("FrustumFieldMapping")
const string | FIELD3D_NAMESPACE_OPEN::k_mappingName ("FieldMapping")
const string | FIELD3D_NAMESPACE_OPEN::k_matrixMappingName ("MatrixFieldMapping")
const string | FIELD3D_NAMESPACE_OPEN::k_nullMappingName ("NullFieldMapping")
void | transformBounds (const M44d &mtx, const Box3d &fromBounds, Box3d &toBounds)
| Transforms a bounding box by a 4x4 matrix This is done by transforming each corner vertex from world to voxel space and bounding the result.
void | worldToVoxel (const Field3D::FieldMapping *mapping, const Box3d &wsBounds, Box3d &vsBounds)
| Computes a voxel space bounds given a bounding box in world space. This is done by transforming each corner vertex from world to voxel space and bounding the result.

## Detailed Description

Contains the FieldMapping base class and the NullFieldMapping and MatrixFieldMapping subclass implementations.

Definition in file FieldMapping.cpp.

## Function Documentation

## worldToVoxel()

void worldToVoxel | ( | const Field3D::FieldMapping * | mapping,
|  | const Box3d & | wsBounds,
|  | Box3d & | vsBounds )

Computes a voxel space bounds given a bounding box in world space. This is done by transforming each corner vertex from world to voxel space and bounding the result.

Todo
  Make this integrate over time

Definition at line 173 of file FieldMapping.cpp.

{
V3d test1, test2;
mapping->worldToVoxel(test1, test2);
V3d wsVerts[] = {
V3d(wsBounds.min.x, wsBounds.min.y, wsBounds.min.z),
V3d(wsBounds.max.x, wsBounds.min.y, wsBounds.min.z),
V3d(wsBounds.min.x, wsBounds.max.y, wsBounds.min.z),
V3d(wsBounds.max.x, wsBounds.max.y, wsBounds.min.z),
V3d(wsBounds.min.x, wsBounds.min.y, wsBounds.max.z),
V3d(wsBounds.max.x, wsBounds.min.y, wsBounds.max.z),
V3d(wsBounds.min.x, wsBounds.max.y, wsBounds.max.z),
V3d(wsBounds.max.x, wsBounds.max.y, wsBounds.max.z)
};
vsBounds.makeEmpty();
V3d vsP;
for (int i = 0; i < 8; i++) {
mapping->worldToVoxel(wsVerts[i], vsP);
vsBounds.extendBy(vsP);
}
}
V3d
Imath::V3d V3d
Definition SpiMathLib.h:74

Referenced by FieldSampler< WrapperVec_T, Dims_T >::getMinMax(), FieldSampler< WrapperVec_T, Dims_T >::getMinMaxMIP(), and FieldSampler< WrapperVec_T, Dims_T >::getMinMaxPrefilt().

## transformBounds()

void transformBounds | ( | const M44d & | mtx,
|  | const Box3d & | fromBounds,
|  | Box3d & | toBounds )

Transforms a bounding box by a 4x4 matrix This is done by transforming each corner vertex from world to voxel space and bounding the result.

Definition at line 200 of file FieldMapping.cpp.

{
V3d verts[] = {
V3d(fromBounds.min.x, fromBounds.min.y, fromBounds.min.z),
V3d(fromBounds.max.x, fromBounds.min.y, fromBounds.min.z),
V3d(fromBounds.min.x, fromBounds.max.y, fromBounds.min.z),
V3d(fromBounds.max.x, fromBounds.max.y, fromBounds.min.z),
V3d(fromBounds.min.x, fromBounds.min.y, fromBounds.max.z),
V3d(fromBounds.max.x, fromBounds.min.y, fromBounds.max.z),
V3d(fromBounds.min.x, fromBounds.max.y, fromBounds.max.z),
V3d(fromBounds.max.x, fromBounds.max.y, fromBounds.max.z)
};
toBounds.makeEmpty();
V3d toP;
for (int i = 0; i < 8; i++) {
mtx.multVecMatrix(verts[i], toP);
toBounds.extendBy(toP);
}
}

Referenced by FieldSampler< WrapperVec_T, Dims_T >::getMinMax(), FieldSampler< WrapperVec_T, Dims_T >::getMinMaxMIP(), and FieldSampler< WrapperVec_T, Dims_T >::getMinMaxPrefilt().