Field3D
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

 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 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. More...
 

Detailed Description

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

Definition in file FieldMapping.cpp.

Function Documentation

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.

Referenced by FieldSampler< WrapperVec_T, 1 >::getMinMax(), FieldSampler< WrapperVec_T, 3 >::getMinMax(), FieldSampler< WrapperVec_T, 1 >::getMinMaxMIP(), FieldSampler< WrapperVec_T, 3 >::getMinMaxMIP(), and FieldMapping::resolution().

176 {
177  V3d test1, test2;
178  mapping->worldToVoxel(test1, test2);
180  V3d wsVerts[] = {
181  V3d(wsBounds.min.x, wsBounds.min.y, wsBounds.min.z),
182  V3d(wsBounds.max.x, wsBounds.min.y, wsBounds.min.z),
183  V3d(wsBounds.min.x, wsBounds.max.y, wsBounds.min.z),
184  V3d(wsBounds.max.x, wsBounds.max.y, wsBounds.min.z),
185  V3d(wsBounds.min.x, wsBounds.min.y, wsBounds.max.z),
186  V3d(wsBounds.max.x, wsBounds.min.y, wsBounds.max.z),
187  V3d(wsBounds.min.x, wsBounds.max.y, wsBounds.max.z),
188  V3d(wsBounds.max.x, wsBounds.max.y, wsBounds.max.z)
189  };
190  vsBounds.makeEmpty();
191  V3d vsP;
192  for (int i = 0; i < 8; i++) {
193  mapping->worldToVoxel(wsVerts[i], vsP);
194  vsBounds.extendBy(vsP);
195  }
196 }
Imath::V3d V3d
Definition: SpiMathLib.h:74