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