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-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 #ifndef _SB_CYLINDER_ 00024 #define _SB_CYLINDER_ 00025 00026 #include <Inventor/SbBase.h> 00027 #include <Inventor/SbLine.h> 00028 00030 // 00031 // Class: SbCylinder 00032 // 00033 // Represents a cylinder in 3D space. 00034 // 00036 00037 00056 class SbCylinder { 00057 public: 00062 SbCylinder(); 00063 00067 SbCylinder(const SbLine &a, float r); 00068 00072 void setValue(const SbLine &a, float r); 00073 00077 void setAxis(const SbLine &a); 00081 void setRadius(float r); 00082 00086 const SbLine &getAxis() const { return axis; } 00090 float getRadius() const { return radius; } 00091 00096 SbBool intersect(const SbLine &l, SbVec3f &intersection) const; 00100 SbBool intersect(const SbLine &l, 00101 SbVec3f &enter, SbVec3f &exit) const; 00102 00103 private: 00104 SbLine axis; 00105 float radius; 00106 00107 static SbBool unitCylinderIntersect(const SbLine &l, 00108 SbVec3f &in, SbVec3f &out); 00109 00110 }; 00111 00112 00113 #endif /* _SB_CYLINDER_ */ 00114 00115 00116