cgma
|
00001 //------------------------------------------------------------------------- 00002 // Filename : SubSurface.hpp 00003 // 00004 // Purpose : Geoemtry for the split of a face. 00005 // 00006 // Special Notes : 00007 // 00008 // Creator : Jason Kraftcheck 00009 // 00010 // Creation Date : 06/11/98 00011 //------------------------------------------------------------------------- 00012 00013 #ifndef SUB_SURFACE_HPP 00014 #define SUB_SURFACE_HPP 00015 00016 #include "PartitionSurface.hpp" 00017 00018 class SubSurface : public PartitionSurface 00019 { 00020 public: 00021 00022 SubSurface( Surface* real_surf ); 00023 //- Constructor 00024 00025 CubitStatus combine( PartitionSurface* dead_surface ); 00026 00027 virtual ~SubSurface(); 00028 //- destructor. 00029 00030 inline Surface* partitioned_surface() const; 00031 00032 virtual CubitStatus save(CubitSimpleAttrib&); 00033 00034 //CubitBox bounding_box() const; 00035 //Use facet-based version inherited from PartitionSurface 00036 00037 double measure(); 00038 GeometryType geometry_type(); 00039 00040 00041 CubitStatus get_point_normal( CubitVector& point, CubitVector& normal ); 00042 00043 virtual CubitStatus closest_point_uv_guess( 00044 CubitVector const& location, 00045 double& u, double& v, 00046 CubitVector* closest_location = NULL, 00047 CubitVector* unit_normal = NULL ); 00048 00049 virtual CubitStatus evaluate( double u, double v, 00050 CubitVector *position, 00051 CubitVector *unit_normal, 00052 CubitVector *curvature1, 00053 CubitVector *curvature2 ); 00054 00055 CubitStatus closest_point( CubitVector const& pos, 00056 CubitVector* close = 0, CubitVector* norm = 0, 00057 CubitVector* curv1 = 0, CubitVector* curv2 = 0); 00058 void closest_point_trimmed( CubitVector from, CubitVector& result ); 00059 00060 CubitStatus closest_point_along_vector( CubitVector& from_point, 00061 CubitVector& along_vector, 00062 CubitVector& point_on_surface); 00063 00064 CubitStatus principal_curvatures( CubitVector const& loc, 00065 double& curv1, double& curv2, 00066 CubitVector* closest_location=0 ); 00067 00068 CubitVector position_from_u_v( double u, double v ); 00069 CubitStatus u_v_from_position( CubitVector const& location, 00070 double& u, double& v, 00071 CubitVector* closest_location = NULL ); 00072 00073 CubitBoolean is_periodic(); 00074 CubitBoolean is_periodic_in_U( double& period ); 00075 CubitBoolean is_periodic_in_V( double& period ); 00076 CubitBoolean is_singular_in_U( double u_param ); 00077 CubitBoolean is_singular_in_V( double v_param ); 00078 CubitBoolean is_closed_in_U(); 00079 CubitBoolean is_closed_in_V(); 00080 00081 CubitStatus uv_derivitives( double u, double v, 00082 CubitVector &du, CubitVector &dv ); 00083 CubitBoolean is_parametric(); 00084 CubitBoolean get_param_range_U( double& lo, double& hi ); 00085 CubitBoolean get_param_range_V( double& lo, double& hi ); 00086 00087 CubitBoolean is_position_on( CubitVector &test_position ); 00088 00089 CubitSense get_geometry_sense(); 00090 00091 CubitStatus get_sphere_params( CubitVector ¢er, 00092 double &radius ) const; 00093 //- Only valid for spherical surfaces 00094 //O center 00095 //O- The center of the sphere 00096 //O radius 00097 //O- The radius of the sphere 00098 00099 CubitStatus get_cone_params( CubitVector ¢er, 00100 CubitVector &normal, 00101 CubitVector &major_axis, 00102 double &radius_ratio, 00103 double &sine_angle, 00104 double &cos_angle ) const; 00105 //- Only valid for conical surfaces. Cylinders are a special case of conicals. 00106 //O center 00107 //O- 00108 //O normal 00109 //O- 00110 //O major_axis 00111 //O- 00112 //O radius_ratio 00113 //O- 00114 //O sine_angle 00115 //O- 00116 //O cos_angle 00117 //O- 00118 00119 virtual CubitStatus get_torus_params( CubitVector ¢er, 00120 CubitVector &normal, 00121 double &major_radius, 00122 double &minor_radius ) const; 00123 //- Only valid for torus surfaces. 00124 //O center 00125 //O- 00126 //O normal 00127 //O- 00128 //O major_radius 00129 //O- 00130 //O minor_radius 00131 //O- 00132 00133 virtual CubitStatus get_nurb_params( bool &rational, 00134 int °ree_u, 00135 int °ree_v, 00136 int &num_cntrl_pts_u, 00137 int &num_cntrl_pts_v, 00138 DLIList<CubitVector> &cntrl_pts, 00139 DLIList<double> &weights, 00140 DLIList<double> &u_knots, 00141 DLIList<double> &v_knots ) const; 00142 //- Only valid for nurbs surfaces 00143 //O rational 00144 //O- True if the nurb is rational 00145 //O degree_u 00146 //O- The degree of the nurb in the u direction 00147 //O degree_v 00148 //O- The degree of the nurb in the v direction 00149 //O num_cntrl_pts_u 00150 //O- Number of control points in the u direction 00151 //O num_cntrl_pts_v 00152 //O- Number of control points in the v direction 00153 //O cntrl_pts 00154 //O- The control points stored as 00155 //O- cntrl_pts[0 ] = pt[u=0][v=0] 00156 //O- cntrl_pts[1 ] = pt[u=1][v=0] 00157 //O- ... 00158 //O- cntrl_pts[num_cntrl_pts_u-1] = pt[u=?][v=0] 00159 //O- cntrl_pts[num_cntrl_pts_u ] = pt[u=0][v=1] 00160 //O- ... 00161 //O weights 00162 //O- If rational, weights for each control point, stored in the same 00163 //O- order as the control points. No weights are returned if 00164 //O- rational == false 00165 //O u_knots 00166 //O- knot vector in the u direction 00167 //O v_knots 00168 //O- knot vector in the v direction 00169 00170 void reverse_sense(); 00171 00172 protected: 00173 00174 virtual PartitionSurface* copy(); 00175 00176 private: 00177 00178 SubSurface( SubSurface* split_from ); 00179 }; 00180 00181 inline Surface* SubSurface::partitioned_surface() const 00182 { return dynamic_cast<Surface*>(partitioned_entity()); } 00183 00184 00185 #endif 00186