Field3D
FieldMapping.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------//
2 
3 /*
4  * Copyright (c) 2009 Sony Pictures Imageworks Inc
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution. Neither the name of Sony Pictures Imageworks nor the
18  * names of its contributors may be used to endorse or promote
19  * products derived from this software without specific prior written
20  * permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33  * OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 //----------------------------------------------------------------------------//
37 
44 //----------------------------------------------------------------------------//
45 
46 #ifndef _INCLUDED_Field3D_FieldMapping_H_
47 #define _INCLUDED_Field3D_FieldMapping_H_
48 
49 #include <vector>
50 #include <algorithm>
51 
52 #include "Curve.h"
53 #include "Exception.h"
54 #include "RefCount.h"
55 #include "Types.h"
56 
57 //----------------------------------------------------------------------------//
58 
59 #include "ns.h"
60 
62 
63 //----------------------------------------------------------------------------//
64 // FieldMapping
65 //----------------------------------------------------------------------------//
66 
84 //----------------------------------------------------------------------------//
85 
87 {
88  public:
89 
90  // Typedefs ------------------------------------------------------------------
91 
92  typedef boost::intrusive_ptr<FieldMapping> Ptr;
93 
94  // RTTI replacement ----------------------------------------------------------
95 
98 
99  static const char* staticClassType()
100  {
101  return "FieldMapping";
102  }
103 
104  // Ctors, dtor ---------------------------------------------------------------
105 
108 
110  FieldMapping();
112  FieldMapping(const Box3i &extents);
114  virtual ~FieldMapping();
115 
117 
118  // Main methods --------------------------------------------------------------
119 
125  void setExtents(const Box3i &extents);
126 
128  const V3d& origin() const
129  { return m_origin; }
131  const V3d& resolution() const
132  { return m_res; }
133 
134  // To be implemented by subclasses -------------------------------------------
135 
138 
141  virtual Ptr clone() const = 0;
142 
144  virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const = 0;
145  virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float time) const = 0;
147  virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const = 0;
148  virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float time) const = 0;
150  virtual void worldToLocal(const V3d &wsP, V3d &lsP) const = 0;
151  virtual void worldToLocal(const V3d &wsP, V3d &lsP, float time) const = 0;
153  virtual void localToWorld(const V3d &lsP, V3d &wsP) const = 0;
154  virtual void localToWorld(const V3d &lsP, V3d &wsP, float time) const = 0;
155 
157  virtual V3d wsVoxelSize(int i, int j, int k) const = 0;
158 
161  virtual void extentsChanged()
162  { /* Empty */ }
163 
165  virtual std::string className() const = 0;
166 
168  virtual bool isIdentical(FieldMapping::Ptr other,
169  double tolerance = 0.0) const = 0;
170 
172 
173  // Transform calls -----------------------------------------------------------
174 
177 
180  void localToVoxel(const V3d &lsP, V3d &vsP) const;
182  void voxelToLocal(const V3d &vsP, V3d &lsP) const;
183 
185 
186 protected:
187 
194 
195 private:
196 
197  // Typedefs ------------------------------------------------------------------
198 
200  typedef RefBase base;
201 
202 };
203 
204 //----------------------------------------------------------------------------//
205 // Utilities
206 //----------------------------------------------------------------------------//
207 
211 void worldToVoxel(const Field3D::FieldMapping* mapping,
212  const Box3d &wsBounds,
213  Box3d &vsBounds);
214 
218 void transformBounds(const M44d &mtx,
219  const Box3d &fromBounds,
220  Box3d &toBounds);
221 
222 //----------------------------------------------------------------------------//
223 // NullFieldMapping
224 //----------------------------------------------------------------------------//
225 
234 //----------------------------------------------------------------------------//
235 
237 {
238 public:
239 
240  // Typedefs ------------------------------------------------------------------
241 
243  typedef boost::intrusive_ptr<NullFieldMapping> Ptr;
244 
245  // RTTI replacement ----------------------------------------------------------
246 
249 
250  static const char* staticClassType()
251  {
252  return "NullFieldMapping";
253  }
254 
255  // Ctors, dtor ---------------------------------------------------------------
256 
259 
261  : FieldMapping()
262  { /* Empty */ }
263  NullFieldMapping(const Box3i &extents)
264  : FieldMapping(extents)
265  { /* Empty */ }
266 
268 
269  // From FieldMapping ---------------------------------------------------------
270 
273 
274  virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
275  { localToVoxel(wsP, vsP); }
276  virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float /*time*/) const
277  { localToVoxel(wsP, vsP); }
278 
279  virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
280  { voxelToLocal(vsP, wsP); }
281  virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float /*time*/) const
282  { voxelToLocal(vsP, wsP); }
283 
284  virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
285  { lsP = wsP; }
286  virtual void worldToLocal(const V3d &wsP, V3d &lsP, float /*time*/) const
287  { lsP = wsP; }
288 
289  virtual void localToWorld(const V3d &lsP, V3d &wsP) const
290  { wsP = lsP; }
291  virtual void localToWorld(const V3d &lsP, V3d &wsP, float /*time*/) const
292  { wsP = lsP; }
293 
294  virtual std::string className() const;
295 
296  virtual bool isIdentical(FieldMapping::Ptr other,
297  double tolerance = 0.0) const;
298 
299  virtual V3d wsVoxelSize(int /*i*/, int /*j*/, int /*k*/) const
300  { return V3d(1.0 / m_res.x, 1.0 / m_res.y, 1.0 / m_res.z); }
301 
302  virtual FieldMapping::Ptr clone() const;
303 
305 
306 private:
307 
308  // Typedefs ------------------------------------------------------------------
309 
311  typedef FieldMapping base;
312 
313 };
314 
315 //----------------------------------------------------------------------------//
316 // MatrixFieldMapping
317 //----------------------------------------------------------------------------//
318 
332 //----------------------------------------------------------------------------//
333 
335 {
336 public:
337 
338  // Typedefs ------------------------------------------------------------------
339 
341  typedef boost::intrusive_ptr<MatrixFieldMapping> Ptr;
344 
345  // RTTI replacement ----------------------------------------------------------
346 
349 
350  static const char* staticClassType()
351  {
352  return "MatrixFieldMapping";
353  }
354 
355  // Ctors, dtor ---------------------------------------------------------------
356 
359 
361  MatrixFieldMapping(const Box3i &extents);
362 
364 
365  // Main methods --------------------------------------------------------------
366 
370  void setLocalToWorld(const M44d &lsToWs);
372  void setLocalToWorld(float t, const M44d &lsToWs);
373 
376  const M44d& localToWorld() const
377  { return m_lsToWs; }
378 
381  const M44d& worldToVoxel() const
382  { return m_wsToVs; }
383 
385  M44d worldToVoxel(float time) const
386  {
387  if (!m_isTimeVarying) {
388  return m_wsToVs;
389  } else {
390  return m_vsToWsCurve.linear(time).inverse();
391  }
392  }
393 
396  const M44d& voxelToWorld() const
397  { return m_vsToWs; }
398 
401  { return m_lsToWsCurve.samples(); }
402 
405  void makeIdentity();
406 
407  // From FieldMapping ---------------------------------------------------------
408 
411 
412  virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
413  { m_wsToVs.multVecMatrix(wsP, vsP); }
414  virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float time) const
415  {
416  if (!m_isTimeVarying) {
417  m_wsToVs.multVecMatrix(wsP, vsP);
418  } else {
419  M44d wsToVs = m_vsToWsCurve.linear(time).inverse();
420  wsToVs.multVecMatrix(wsP, vsP);
421  }
422  }
423 
424  virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
425  { m_vsToWs.multVecMatrix(vsP, wsP); }
426  virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float time) const
427  {
428  if (!m_isTimeVarying) {
429  m_vsToWs.multVecMatrix(vsP, wsP);
430  } else {
431  M44d vsToWs = m_vsToWsCurve.linear(time);
432  vsToWs.multVecMatrix(vsP, wsP);
433  }
434  }
435 
436  virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
437  { m_wsToLs.multVecMatrix(wsP, lsP); }
438  virtual void worldToLocal(const V3d &wsP, V3d &lsP,
439  float time) const
440  {
441  if (!m_isTimeVarying) {
442  m_wsToLs.multVecMatrix(wsP, lsP);
443  } else {
444  M44d wsToLs = m_lsToWsCurve.linear(time).inverse();
445  wsToLs.multVecMatrix(wsP, lsP);
446  }
447  }
448 
449  virtual void localToWorld(const V3d &lsP, V3d &wsP) const
450  { m_lsToWs.multVecMatrix(lsP, wsP); }
451  virtual void localToWorld(const V3d &lsP, V3d &wsP, float time) const
452  {
453  if (!m_isTimeVarying) {
454  m_lsToWs.multVecMatrix(lsP, wsP);
455  } else {
456  M44d lsToWs = m_lsToWsCurve.linear(time);
457  lsToWs.multVecMatrix(lsP, wsP);
458  }
459  }
460 
462  void worldToVoxelDir(const V3d &wsV, V3d &vsV) const
463  { m_wsToVs.multDirMatrix(wsV, vsV); }
464 
466  void voxelToWorldDir(const V3d &vsV, V3d &wsV) const
467  { m_vsToWs.multDirMatrix(vsV, wsV); }
468 
470  void worldToLocalDir(const V3d &wsV, V3d &lsV) const
471  { m_wsToLs.multDirMatrix(wsV, lsV); }
472 
474  void localToWorldDir(const V3d &lsV, V3d &wsV) const
475  { m_lsToWs.multDirMatrix(lsV, wsV); }
476 
477  virtual void extentsChanged();
478 
479  virtual std::string className() const;
480 
481  virtual bool isIdentical(FieldMapping::Ptr other,
482  double tolerance = 0.0) const;
483 
484  virtual V3d wsVoxelSize(int /*i*/, int /*j*/, int /*k*/) const
485  { return m_wsVoxelSize; }
486 
487  virtual FieldMapping::Ptr clone() const;
488 
490 
491 private:
492 
494  void updateTransform();
495 
497  void getLocalToVoxelMatrix(M44d &result);
498 
499  // Data members -------------------------------------------------------------
500 
513 
518 
522 
526 
527  // Typedefs ------------------------------------------------------------------
528 
530  typedef FieldMapping base;
531 };
532 
533 //----------------------------------------------------------------------------//
534 // FrustumFieldMapping
535 //----------------------------------------------------------------------------//
536 
562 //----------------------------------------------------------------------------//
563 
565 {
566 public:
567 
568  // Typedefs ------------------------------------------------------------------
569 
571  typedef boost::intrusive_ptr<FrustumFieldMapping> Ptr;
576 
577  // Exceptions ----------------------------------------------------------------
578 
580 
581  // Enums ---------------------------------------------------------------------
582 
583 
584  enum ZDistribution {
587  UniformDistribution
588  };
589 
590  // RTTI replacement ----------------------------------------------------------
591 
594 
595  static const char* staticClassType()
596  {
597  return "FrustumFieldMapping";
598  }
599 
600  // Ctors, dtor ---------------------------------------------------------------
601 
604 
606  FrustumFieldMapping(const Box3i &extents);
607 
609 
610  // Main methods --------------------------------------------------------------
611 
618  void setTransforms(const M44d &ssToWs, const M44d &csToWs);
623  void setTransforms(float t, const M44d &ssToWs, const M44d &csToWs);
624 
627  { m_zDistribution = dist; }
630  { return m_zDistribution; }
631 
634  const M44d screenToWorld() const
635  { return m_ssToWsCurve.linear(0.0); }
636 
639  const M44d cameraToWorld() const
640  { return m_csToWsCurve.linear(0.0); }
641 
644  { return m_ssToWsCurve.samples(); }
645 
648  { return m_csToWsCurve.samples(); }
649 
652  { return m_nearCurve.samples(); }
653 
656  { return m_farCurve.samples(); }
657 
659  double nearPlane() const
660  { return m_nearCurve.linear(0.0); }
661 
663  double farPlane() const
664  { return m_farCurve.linear(0.0); }
665 
669  void reset();
670 
671  // From FieldMapping ---------------------------------------------------------
672 
675 
676  virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const;
677  virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float time) const;
678 
679  virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const;
680  virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float time) const;
681 
682  virtual void worldToLocal(const V3d &wsP, V3d &lsP) const;
683  virtual void worldToLocal(const V3d &wsP, V3d &lsP, float time) const;
684 
685  virtual void localToWorld(const V3d &lsP, V3d &wsP) const;
686  virtual void localToWorld(const V3d &lsP, V3d &wsP, float time) const;
687 
688  virtual void extentsChanged();
689 
690  virtual std::string className() const;
691 
692  virtual bool isIdentical(FieldMapping::Ptr other,
693  double tolerance = 0.0) const;
694 
695  virtual V3d wsVoxelSize(int i, int j, int k) const;
696 
697  virtual FieldMapping::Ptr clone() const;
698 
700 
701 private:
702 
704  void computeVoxelSize();
705 
707  void getLocalToVoxelMatrix(M44d &result);
708 
711  void clearCurves();
712 
713  // Data members -------------------------------------------------------------
714 
717 
731 
734  std::vector<V3d> m_wsVoxelSize;
735 
741 
742  // Typedefs ------------------------------------------------------------------
743 
746 
747 };
748 
749 //----------------------------------------------------------------------------//
750 
752 
753 //----------------------------------------------------------------------------//
754 
755 #endif // Include guard
MatrixFieldMapping::worldToVoxel
const M44d & worldToVoxel() const
Returns a reference to the world to voxel space transform.
Definition: FieldMapping.h:381
MatrixFieldMapping::DEFINE_FIELD_RTTI_CONCRETE_CLASS
DEFINE_FIELD_RTTI_CONCRETE_CLASS
Definition: FieldMapping.h:348
FIELD3D_NAMESPACE_HEADER_CLOSE
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition: ns.h:58
MatrixFieldMapping::voxelToWorld
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
Transform from voxel space position into world space.
Definition: FieldMapping.h:424
FrustumFieldMapping::DEFINE_FIELD_RTTI_CONCRETE_CLASS
DEFINE_FIELD_RTTI_CONCRETE_CLASS
Definition: FieldMapping.h:593
FieldMapping::extentsChanged
virtual void extentsChanged()
Implement this if the subclass needs to update itself when the resolution changes.
Definition: FieldMapping.h:161
MatrixFieldMapping::m_wsToLs
M44d m_wsToLs
World space to local space.
Definition: FieldMapping.h:506
V3d
Imath::V3d V3d
Definition: SpiMathLib.h:74
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 ...
Definition: FieldMapping.cpp:200
NullFieldMapping::localToWorld
virtual void localToWorld(const V3d &lsP, V3d &wsP) const
Transform from local space position into world space.
Definition: FieldMapping.h:289
Types.h
Contains typedefs for the commonly used types in Field3D.
NullFieldMapping::DEFINE_FIELD_RTTI_CONCRETE_CLASS
DEFINE_FIELD_RTTI_CONCRETE_CLASS
Definition: FieldMapping.h:248
NullFieldMapping::voxelToWorld
virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float) const
Definition: FieldMapping.h:281
FrustumFieldMapping::setZDistribution
void setZDistribution(ZDistribution dist)
Sets the z slice distribution.
Definition: FieldMapping.h:626
NullFieldMapping::base
FieldMapping base
Convenience typedef for referring to base class.
Definition: FieldMapping.h:311
FieldMapping::m_res
V3d m_res
The integer voxel-space resolution of the underlying Field object. Is equal to field....
Definition: FieldMapping.h:193
NullFieldMapping::Ptr
boost::intrusive_ptr< NullFieldMapping > Ptr
Convenience typedef.
Definition: FieldMapping.h:243
FrustumFieldMapping::FloatCurve
Curve< double > FloatCurve
Time-varying float.
Definition: FieldMapping.h:575
NullFieldMapping::staticClassType
static const char * staticClassType()
Definition: FieldMapping.h:250
FrustumFieldMapping::m_farCurve
FloatCurve m_farCurve
Time-varying far plane. Computed from m_lpsToWsCurve.
Definition: FieldMapping.h:730
MatrixFieldMapping::voxelToWorld
const M44d & voxelToWorld() const
Returns a reference to the voxel to world space transform.
Definition: FieldMapping.h:396
NullFieldMapping
Trivial class, world space is equal to local space, i.e. the field is contained in the unit cube [0....
Definition: FieldMapping.h:237
FrustumFieldMapping::class_type
FrustumFieldMapping class_type
Definition: FieldMapping.h:592
FieldMapping::Ptr
boost::intrusive_ptr< FieldMapping > Ptr
Definition: FieldMapping.h:92
FieldMapping::DEFINE_FIELD_RTTI_ABSTRACT_CLASS
DEFINE_FIELD_RTTI_ABSTRACT_CLASS
Definition: FieldMapping.h:97
MatrixFieldMapping::m_wsToVs
M44d m_wsToVs
World space to voxel space.
Definition: FieldMapping.h:512
FieldMapping::isIdentical
virtual bool isIdentical(FieldMapping::Ptr other, double tolerance=0.0) const =0
Whether the mapping is identical to another mapping.
NullFieldMapping::worldToVoxel
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
Transform from world space position into voxel space.
Definition: FieldMapping.h:274
FrustumFieldMapping::screenToWorldSamples
const MatrixCurve::SampleVec & screenToWorldSamples() const
Returns a vector of all motion samples for screen to world transform.
Definition: FieldMapping.h:643
FieldMapping::wsVoxelSize
virtual V3d wsVoxelSize(int i, int j, int k) const =0
Returns world-space size of a voxel at the specified coordinate.
RefCount.h
Contains base class for reference counting with Mutex.
MatrixFieldMapping::voxelToWorldDir
void voxelToWorldDir(const V3d &vsV, V3d &wsV) const
Definition: FieldMapping.h:466
FieldMapping::staticClassType
static const char * staticClassType()
Definition: FieldMapping.h:99
FieldMapping::voxelToWorld
virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float time) const =0
FieldMapping::worldToLocal
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const =0
Transform from world space position into local space.
Curve< Imath::M44d >
NullFieldMapping::voxelToWorld
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const
Transform from voxel space position into world space.
Definition: FieldMapping.h:279
FrustumFieldMapping::zDistribution
ZDistribution zDistribution() const
Returns the z slice distribution.
Definition: FieldMapping.h:629
FrustumFieldMapping::m_zDistribution
ZDistribution m_zDistribution
Slice distribution type.
Definition: FieldMapping.h:716
FieldMapping::className
virtual std::string className() const =0
Returns the FieldMapping type name. Used when writing/reading from disk.
Definition: FieldMapping.cpp:139
FieldMapping::voxelToLocal
void voxelToLocal(const V3d &vsP, V3d &lsP) const
Inverse of localToVoxel.
Definition: FieldMapping.cpp:162
MatrixFieldMapping::worldToVoxel
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const
Transform from world space position into voxel space.
Definition: FieldMapping.h:412
MatrixFieldMapping::worldToVoxel
virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float time) const
Definition: FieldMapping.h:414
FieldMapping
Base class for mapping between world-, local- and voxel coordinates.
Definition: FieldMapping.h:87
FrustumFieldMapping::screenToWorld
const M44d screenToWorld() const
Returns a reference to the screen to world space transform.
Definition: FieldMapping.h:634
FieldMapping::localToWorld
virtual void localToWorld(const V3d &lsP, V3d &wsP, float time) const =0
ns.h
Exception.h
Contains Exception base class.
MatrixFieldMapping::localToWorld
const M44d & localToWorld() const
Returns a reference to the local to world transform.
Definition: FieldMapping.h:376
Exc::Exception
Definition: Exception.h:74
NullFieldMapping::NullFieldMapping
NullFieldMapping()
Definition: FieldMapping.h:260
FrustumFieldMapping::farPlaneSamples
const FloatCurve::SampleVec & farPlaneSamples() const
Returns a vector of all motion samples for far plane.
Definition: FieldMapping.h:655
FrustumFieldMapping::Ptr
boost::intrusive_ptr< FrustumFieldMapping > Ptr
Convenience typedef.
Definition: FieldMapping.h:571
FrustumFieldMapping::m_csToWsCurve
MatrixCurve m_csToWsCurve
Time-varying camera to world space transform.
Definition: FieldMapping.h:723
FrustumFieldMapping::MatrixCurve
Curve< Imath::M44d > MatrixCurve
Time-varying matrix.
Definition: FieldMapping.h:573
MatrixFieldMapping::staticClassType
static const char * staticClassType()
Definition: FieldMapping.h:350
FieldMapping::base
RefBase base
Convenience typedef for referring to base class.
Definition: FieldMapping.h:200
FieldMapping::m_origin
V3d m_origin
The integer voxel-space origin of the underlying Field object. Is equal to field.extents....
Definition: FieldMapping.h:190
MatrixFieldMapping::m_lsToWsCurve
MatrixCurve m_lsToWsCurve
Time-varying local to world space transform.
Definition: FieldMapping.h:515
MatrixFieldMapping::class_type
MatrixFieldMapping class_type
Definition: FieldMapping.h:347
FrustumFieldMapping::m_ssToWsCurve
MatrixCurve m_ssToWsCurve
Time-varying local perspective to world space transform This is not used in calculations,...
Definition: FieldMapping.h:721
MatrixFieldMapping::m_lsToWs
M44d m_lsToWs
Local space to world space.
Definition: FieldMapping.h:503
MatrixFieldMapping::base
FieldMapping base
Convenience typedef for referring to base class.
Definition: FieldMapping.h:530
NullFieldMapping::worldToLocal
virtual void worldToLocal(const V3d &wsP, V3d &lsP, float) const
Definition: FieldMapping.h:286
Box3d
Imath::Box3d Box3d
Definition: SpiMathLib.h:79
FrustumFieldMapping::cameraToWorldSamples
const MatrixCurve::SampleVec & cameraToWorldSamples() const
Returns a vector of all motion samples for camera to world transform.
Definition: FieldMapping.h:647
MatrixFieldMapping::localToWorld
virtual void localToWorld(const V3d &lsP, V3d &wsP) const
Transform from local space position into world space.
Definition: FieldMapping.h:449
FrustumFieldMapping::nearPlaneSamples
const FloatCurve::SampleVec & nearPlaneSamples() const
Returns a vector of all motion samples for near plane.
Definition: FieldMapping.h:651
FrustumFieldMapping::m_lpsToWsCurve
MatrixCurve m_lpsToWsCurve
Time-varying local perspective to world space transform. Computed from m_ssToWsCurve.
Definition: FieldMapping.h:726
MatrixFieldMapping::worldToLocalDir
void worldToLocalDir(const V3d &wsV, V3d &lsV) const
Definition: FieldMapping.h:470
FieldMapping::worldToLocal
virtual void worldToLocal(const V3d &wsP, V3d &lsP, float time) const =0
FieldMapping::clone
virtual Ptr clone() const =0
Returns a pointer to a copy of the mapping, pure virtual so ensure derived classes properly implement...
MatrixFieldMapping::MatrixCurve
Curve< Imath::M44d > MatrixCurve
Time-varying matrix.
Definition: FieldMapping.h:343
MatrixFieldMapping::m_wsVoxelSize
V3d m_wsVoxelSize
Precomputed world-space voxel size. Calculations may assume orthogonal transformation for efficiency.
Definition: FieldMapping.h:525
FrustumFieldMapping::farPlane
double farPlane() const
Returns the far plane.
Definition: FieldMapping.h:663
FieldMapping::worldToVoxel
virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float time) const =0
MatrixFieldMapping::worldToVoxel
M44d worldToVoxel(float time) const
Returns the world to voxel space transform at a given time.
Definition: FieldMapping.h:385
FrustumFieldMapping::m_defaultState
bool m_defaultState
Boolean to tell us if the mapping is in its 'default' state. This is needed because the class has a d...
Definition: FieldMapping.h:740
MatrixFieldMapping
Represents the mapping of a field by a matrix transform.
Definition: FieldMapping.h:335
NullFieldMapping::localToWorld
virtual void localToWorld(const V3d &lsP, V3d &wsP, float) const
Definition: FieldMapping.h:291
MatrixFieldMapping::localToWorldSamples
const MatrixCurve::SampleVec & localToWorldSamples() const
Returns a vector of all motion samples for local to world transform.
Definition: FieldMapping.h:400
MatrixFieldMapping::wsVoxelSize
virtual V3d wsVoxelSize(int, int, int) const
Returns world-space size of a voxel at the specified coordinate.
Definition: FieldMapping.h:484
FieldMapping::class_type
FieldMapping class_type
Definition: FieldMapping.h:96
MatrixFieldMapping::worldToLocal
virtual void worldToLocal(const V3d &wsP, V3d &lsP, float time) const
Definition: FieldMapping.h:438
MatrixFieldMapping::worldToVoxelDir
void worldToVoxelDir(const V3d &wsV, V3d &vsV) const
Definition: FieldMapping.h:462
NullFieldMapping::worldToLocal
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
Transform from world space position into local space.
Definition: FieldMapping.h:284
FrustumFieldMapping::ZDistribution
ZDistribution
Enumerates the Z slice distribution. .f3d files will store values as an int, so be very careful not t...
Definition: FieldMapping.h:585
FieldMapping::voxelToWorld
virtual void voxelToWorld(const V3d &vsP, V3d &wsP) const =0
Transform from voxel space position into world space.
M44d
Imath::M44d M44d
Definition: SpiMathLib.h:82
MatrixFieldMapping::m_vsToWs
M44d m_vsToWs
Voxel space to world space.
Definition: FieldMapping.h:509
Curve< Imath::M44d >::SampleVec
std::vector< Sample > SampleVec
Definition: Curve.h:85
FrustumFieldMapping::cameraToWorld
const M44d cameraToWorld() const
Returns a reference to the camera to world space transform.
Definition: FieldMapping.h:639
FieldMapping::localToWorld
virtual void localToWorld(const V3d &lsP, V3d &wsP) const =0
Transform from local space position into world space.
NullFieldMapping::wsVoxelSize
virtual V3d wsVoxelSize(int, int, int) const
Returns world-space size of a voxel at the specified coordinate.
Definition: FieldMapping.h:299
NullFieldMapping::NullFieldMapping
NullFieldMapping(const Box3i &extents)
Definition: FieldMapping.h:263
Curve.h
Contains the Curve class which is used to interpolate attributes in time.
FIELD3D_API
#define FIELD3D_API
Definition: ns.h:77
FIELD3D_NAMESPACE_OPEN
Definition: FieldMapping.cpp:74
FrustumFieldMapping::staticClassType
static const char * staticClassType()
Definition: FieldMapping.h:595
MatrixFieldMapping::worldToLocal
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
Transform from world space position into local space.
Definition: FieldMapping.h:436
Box3i
Imath::Box3i Box3i
Definition: SpiMathLib.h:77
MatrixFieldMapping::voxelToWorld
virtual void voxelToWorld(const V3d &vsP, V3d &wsP, float time) const
Definition: FieldMapping.h:426
FrustumFieldMapping::m_nearCurve
FloatCurve m_nearCurve
Time-varying near plane. Computed from m_lpsToWsCurve.
Definition: FieldMapping.h:728
NullFieldMapping::class_type
NullFieldMapping class_type
Definition: FieldMapping.h:247
MatrixFieldMapping::Ptr
boost::intrusive_ptr< MatrixFieldMapping > Ptr
Convenience typedef.
Definition: FieldMapping.h:341
FieldMapping::resolution
const V3d & resolution() const
Returns the resolution.
Definition: FieldMapping.h:131
MatrixFieldMapping::localToWorld
virtual void localToWorld(const V3d &lsP, V3d &wsP, float time) const
Definition: FieldMapping.h:451
MatrixFieldMapping::m_vsToWsCurve
MatrixCurve m_vsToWsCurve
Time-varying voxel to world space transform.
Definition: FieldMapping.h:517
FrustumFieldMapping::base
FieldMapping base
Convenience typedef for referring to base class.
Definition: FieldMapping.h:745
RefBase
Definition: RefCount.h:107
FieldMapping::localToVoxel
void localToVoxel(const V3d &lsP, V3d &vsP) const
Transform from local space to voxel space. This is just a multiplication by the resolution of the Fie...
Definition: FieldMapping.cpp:155
FrustumFieldMapping
Represents the mapping of a field by a perspective transform.
Definition: FieldMapping.h:565
FieldMapping::origin
const V3d & origin() const
Returns the origin.
Definition: FieldMapping.h:128
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 ...
Definition: FieldMapping.cpp:173
FieldMapping::worldToVoxel
virtual void worldToVoxel(const V3d &wsP, V3d &vsP) const =0
Transform from world space position into voxel space.
DECLARE_FIELD3D_GENERIC_EXCEPTION
#define DECLARE_FIELD3D_GENERIC_EXCEPTION(name, base_class)
Used to declare a generic but named exception.
Definition: Exception.h:107
MatrixFieldMapping::m_isTimeVarying
bool m_isTimeVarying
Stores whether the curve has more than one time sample.
Definition: FieldMapping.h:521
MatrixFieldMapping::localToWorldDir
void localToWorldDir(const V3d &lsV, V3d &wsV) const
Definition: FieldMapping.h:474
FrustumFieldMapping::m_wsVoxelSize
std::vector< V3d > m_wsVoxelSize
Precomputed world-space voxel size. Calculations may assume orthogonal transformation for efficiency.
Definition: FieldMapping.h:734
FrustumFieldMapping::PerspectiveDistribution
@ PerspectiveDistribution
Definition: FieldMapping.h:586
NullFieldMapping::worldToVoxel
virtual void worldToVoxel(const V3d &wsP, V3d &vsP, float) const
Definition: FieldMapping.h:276
FrustumFieldMapping::nearPlane
double nearPlane() const
Returns the near plane.
Definition: FieldMapping.h:659