00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : D. DALLA ROSA (Jun 2008) 00022 **=======================================================================*/ 00023 00024 #ifndef _SB_TRANSFORMPROJECTION_ 00025 #define _SB_TRANSFORMPROJECTION_ 00026 00027 00028 #include <Inventor/projection/SbProjection.h> 00029 #include <Inventor/nodes/SoTransformProjection.h> 00030 00031 #if defined(_WIN32) 00032 #pragma warning( push ) 00033 #pragma warning( disable: 4251 ) 00034 #endif 00035 00036 00057 //--------------------------------------------------------------------------- 00058 class SbTransformProjection : public SbProjection 00059 { 00060 public: 00061 00065 SbTransformProjection( SoProjection *node ); 00066 00070 virtual ~SbTransformProjection() {}; 00071 00077 virtual bool getProjectedBoundingBox( SbBox3f& bbox ); 00078 00079 SoEXTENDER_Documented private: 00083 virtual void apply( SbVec3f &point ); 00084 }; 00085 00086 00087 //--------------------------------------------------------------------------- 00088 inline 00089 SbTransformProjection::SbTransformProjection( SoProjection *node ) 00090 :SbProjection( node ) 00091 { 00092 } 00093 00094 00095 //--------------------------------------------------------------------------- 00096 inline void 00097 SbTransformProjection::apply( SbVec3f &point ) 00098 { 00099 // Ok there is our projection node. 00100 SoTransformProjection* projection = (SoTransformProjection *)getProjectionNode(); 00101 00102 // We get some values from the configuration ndoe. 00103 float scaleFactor = projection->scaleFactor.getValue(); 00104 SbVec3f centerPosition = projection->centerPosition.getValue(); 00105 00106 // We translate the point. 00107 point -= centerPosition; 00108 00109 // We rescale it. 00110 point *= scaleFactor; 00111 } 00112 00113 inline bool 00114 SbTransformProjection::getProjectedBoundingBox( SbBox3f& bbox ) 00115 { 00116 SbVec3f boundary[2]; 00117 bbox.getBounds(boundary[0],boundary[1]); 00118 project(boundary[0]); 00119 project(boundary[1]); 00120 bbox.setBounds(boundary[0],boundary[1]); 00121 return true; 00122 } 00123 00124 #ifdef _WIN32 00125 #pragma warning(pop) 00126 #endif 00127 00128 //--------------------------------------------------------------------------- 00129 00130 #endif /* _SB_TRANSFORMPROJECTION_ */ 00131 00132