Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbTransformProjection.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : D. DALLA ROSA (Jun 2008)
22**=======================================================================*/
23
24#ifndef _SB_TRANSFORMPROJECTION_
25#define _SB_TRANSFORMPROJECTION_
26
27
30
31#if defined(_WIN32)
32#pragma warning( push )
33#pragma warning( disable: 4251 )
34#endif
35
36
57//---------------------------------------------------------------------------
59{
60public:
61
66
71
77 virtual bool getProjectedBoundingBox( SbBox3f& bbox );
78
83 virtual void apply( SbVec3f &point );
84};
85
86
87//---------------------------------------------------------------------------
88inline
93
94
95//---------------------------------------------------------------------------
96inline void
97SbTransformProjection::apply( SbVec3f &point )
98{
99 // Ok there is our projection node.
101
102 // We get some values from the configuration ndoe.
103 float scaleFactor = projection->scaleFactor.getValue();
104 SbVec3f centerPosition = projection->centerPosition.getValue();
105
106 // We translate the point.
107 point -= centerPosition;
108
109 // We rescale it.
110 point *= scaleFactor;
111}
112
113inline bool
115{
116 SbVec3f boundary[2];
117 bbox.getBounds(boundary[0],boundary[1]);
118 project(boundary[0]);
119 project(boundary[1]);
120 bbox.setBounds(boundary[0],boundary[1]);
121 return true;
122}
123
124#ifdef _WIN32
125#pragma warning(pop)
126#endif
127
128//---------------------------------------------------------------------------
129
130#endif /* _SB_TRANSFORMPROJECTION_ */
131
#define SoEXTENDER_Documented
3D box class.
Definition SbBox.h:649
void setBounds(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
Sets the corners of the box.
Definition SbBox.h:789
void getBounds(float &xmin, float &ymin, float &zmin, float &xmax, float &ymax, float &zmax) const
Gets the corners of the box.
Definition SbBox.h:802
Base class for coordinate projection classes.
void project(SbVec3f &point)
Apply the complete computation (matrix, pre-projection, projection, post-projection) to one point.
SoProjection * getProjectionNode() const
Return associated projection node.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Scale/recenter p...
virtual bool getProjectedBoundingBox(SbBox3f &bbox)
Compute projected bounding box.
SbTransformProjection(SoProjection *node)
Constructor.
virtual ~SbTransformProjection()
Destructor.
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Coordinate proje...
float getValue() const
Returns this field's value.
Definition SoSFFloat.h:81
const SbVec3f & getValue() const
Returns this field's value.
Definition SoSFVec3f.h:82
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Scale/recenter p...
SoSFFloat scaleFactor
Scale factor applied to the geometry.
SoSFVec3f centerPosition
Translation applied to the geometry.