cgma
|
00001 //------------------------------------------------------------------------- 00002 // Filename : SphereEvaluator.hpp 00003 // 00004 // Purpose : Provide evaluators for a spherical surface. Since a sphere 00005 // is an analytic primitive, its evaluators can be overwritten 00006 // rather than using the OCC, or Facet based evaluators. 00007 // 00008 // Special Notes : 00009 // 00010 // Creator : Matthew Staten 00011 // 00012 // Creation Date : 09/14/04 00013 // 00014 // Owner : Matthew Staten 00015 //------------------------------------------------------------------------- 00016 00017 #ifndef SPHERE_EVALUATOR_HPP 00018 #define SPHERE_EVALUATOR_HPP 00019 00020 #include "CubitEvaluator.hpp" 00021 #include "CubitDefines.h" 00022 #include "CubitVector.hpp" 00023 #include "GeometryDefines.h" 00024 00025 class CUBIT_GEOM_EXPORT SphereEvaluatorData : public CubitEvaluatorData 00026 { 00027 public: 00028 double radius; 00029 CubitVector center; 00030 00031 virtual GeometryType ask_type() const { return SPHERE_SURFACE_TYPE; } 00032 }; 00033 00034 class CUBIT_GEOM_EXPORT SphereEvaluator: public CubitEvaluator 00035 { 00036 00037 private: 00038 00039 SphereEvaluatorData mEvalData; 00040 00041 protected: 00042 00043 public : 00044 00045 00046 SphereEvaluator( const SphereEvaluatorData *data ) { mEvalData = *data; } 00047 00048 virtual ~SphereEvaluator() 00049 {} 00050 00051 virtual GeometryType ask_type() { return SPHERE_SURFACE_TYPE; } 00052 virtual CubitBoolean is_parametric() const { return CUBIT_TRUE; } 00053 virtual CubitBoolean is_periodic() const { return CUBIT_TRUE; } 00054 virtual CubitBoolean is_periodic_in_U( double &period ) const { period = 2*CUBIT_PI; 00055 return CUBIT_TRUE; } 00056 virtual CubitBoolean is_periodic_in_V( double &period ) const { period = 2*CUBIT_PI; 00057 return CUBIT_FALSE; } 00058 virtual CubitBoolean is_singular_in_U() const { return CUBIT_FALSE; } 00059 virtual CubitBoolean is_singular_in_V() const { return CUBIT_TRUE; } 00060 virtual CubitBoolean is_closed_in_U() const { return CUBIT_TRUE; } 00061 virtual CubitBoolean is_closed_in_V() const { return CUBIT_FALSE; } 00062 virtual CubitBoolean get_param_range_U( double& lower_bound, 00063 double& upper_bound ) const; 00064 virtual CubitBoolean get_param_range_V( double& lower_bound, 00065 double& upper_bound ) const; 00066 00067 virtual const CubitEvaluatorData* evaluator_data() const; 00068 virtual CubitVector position_from_u_v( double u, double v ) const; 00069 virtual CubitStatus u_v_from_position( CubitVector const& location, 00070 double& u, 00071 double& v, 00072 CubitVector* closest_location ) const; 00073 00074 virtual CubitBox bounding_box() const; 00075 //- Return the bounding obox of this sphere. 00076 00077 virtual CubitStatus principal_curvatures( CubitVector const& location, 00078 double& curvature_1, 00079 double& curvature_2, 00080 CubitVector* closest_location = NULL ); 00081 //R CubitStatus 00082 //R- CUBIT_SUCCESS/FAILURE 00083 //I location 00084 //I- The point at which the curvatures are being requested -- it is also 00085 //I- the point to which the closest point on the surface is returned. 00086 //I- curvatures. 00087 //O closest_location 00088 //O- The point on the surface, closest to the input location (this 00089 //O- might not be on the surface). This is input as a reference 00090 //O- so that the function can modify its contents. 00091 //O curvature_1/2 00092 //O- Returned principal curvature magnitudes. 00093 //- This functions computes the point on the surface that is closest 00094 //- to the input location and then calculates the magnitudes of the 00095 //- principal curvatures at this (possibly, new) point on the surface. 00096 00097 virtual CubitStatus closest_point( CubitVector const& location, 00098 CubitVector* closest_location = NULL, 00099 CubitVector* unit_normal_ptr = NULL, 00100 CubitVector* curvature1_ptr = NULL, 00101 CubitVector* curvature2_ptr = NULL ) const; 00102 //R CubitStatus 00103 //R- CUBIT_SUCCESS/FAILURE 00104 //I location 00105 //I- The point to which the closest point on the surface is desired. 00106 //O closest_location 00107 //O- The point on the Surface, closest to the 00108 //O- input location (which might not be on the Surface). This is 00109 //O- input as a reference so that the function can modify its 00110 //O- contents. 00111 //O unit_normal_ptr 00112 //O- The normal (represented as a unit vector) at the closest_location. 00113 //O- If this pointer is NULL, the normal is not returned. 00114 //O curvature1_ptr 00115 //O- The first principal curvature of the surface at closest_location. 00116 //O- If this pointer is NULL, this curvature is not returned. 00117 //O curvature2_ptr 00118 //O- The second principal curvature of the surface at closest_location. 00119 //O- If this pointer is NULL, this curvature is not returned. 00120 //- This function computes the point on the surface closest to the input 00121 //- location -- i.e., closest_location. 00122 //- The first Facet FACE in the list 00123 //- is queried. 00124 //- 00125 //- If the input pointer values of unit_normal, curvature1 and 00126 //- curvature2 00127 //- are non-NULL, the normal and principal curvatures, too, are 00128 //- returned. These are computed at closest_location, not at the 00129 //- input location. 00130 //- 00131 //- NOTE: 00132 //- It is assumed that if the calling code needs the normal or the 00133 //- principal curvatures, it will *allocate* space for the CubitVectors 00134 //- before sending in the pointers. 00135 00136 }; 00137 00138 00139 // ********** BEGIN INLINE FUNCTIONS ********** 00140 // ********** END INLINE FUNCTIONS ********** 00141 00142 // ********** BEGIN FRIEND FUNCTIONS ********** 00143 // ********** END FRIEND FUNCTIONS ********** 00144 00145 // ********** BEGIN EXTERN FUNCTIONS ********** 00146 // ********** END EXTERN FUNCTIONS ********** 00147 00148 #endif 00149