Field3D
FieldInterp.cpp
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 
42 //----------------------------------------------------------------------------//
43 
44 #include "FieldInterp.h"
45 
46 //----------------------------------------------------------------------------//
47 
49 
50 //----------------------------------------------------------------------------//
51 
52 bool isPointInField(const FieldRes::Ptr f, const V3d &wsP)
53 {
54  V3d lsP;
55  f->mapping()->worldToLocal(wsP, lsP);
56  return (lsP.x > 0.0 && lsP.x <= 1.0 &&
57  lsP.y > 0.0 && lsP.y <= 1.0 &&
58  lsP.z > 0.0 && lsP.z <= 1.0);
59 }
60 
61 //----------------------------------------------------------------------------//
62 
63 bool isLegalVoxelCoord(const V3d &vsP, const Box3d &vsDataWindow)
64 {
65  return vsP.x > (vsDataWindow.min.x) &&
66  vsP.x < (vsDataWindow.max.x) &&
67  vsP.y > (vsDataWindow.min.y) &&
68  vsP.y < (vsDataWindow.max.y) &&
69  vsP.z > (vsDataWindow.min.z) &&
70  vsP.z < (vsDataWindow.max.z);
71 }
72 
73 //----------------------------------------------------------------------------//
74 
76 
77 //----------------------------------------------------------------------------//
V3d
Imath::V3d V3d
Definition: SpiMathLib.h:74
isLegalVoxelCoord
bool isLegalVoxelCoord(const V3d &vsP, const Box3d &vsDataWindow)
Checks whether the floating - point voxel coordinate is within the given (floating point) data window...
Definition: FieldInterp.cpp:63
FieldRes::Ptr
boost::intrusive_ptr< FieldRes > Ptr
Definition: Field.h:213
FieldInterp.h
Contains the FieldInterp base class and some standard interpolation classes.
isPointInField
FIELD3D_NAMESPACE_OPEN bool isPointInField(const FieldRes::Ptr f, const V3d &wsP)
Checks whether the point is within the given field.
Definition: FieldInterp.cpp:52
Box3d
Imath::Box3d Box3d
Definition: SpiMathLib.h:79
FIELD3D_NAMESPACE_SOURCE_CLOSE
#define FIELD3D_NAMESPACE_SOURCE_CLOSE
Definition: ns.h:60
FIELD3D_NAMESPACE_OPEN
Definition: FieldMapping.cpp:74