Branch data Line data Source code
1 : : //-------------------------------------------------------------------------
2 : : // Filename : SphereEvaluator.hpp
3 : : //
4 : : // Purpose : Provide evaluators for a spherical surface. Since a sphere
5 : : // is an analytic primitive, its evaluators can be overwritten
6 : : // rather than using the OCC, or Facet based evaluators.
7 : : //
8 : : // Special Notes :
9 : : //
10 : : // Creator : Matthew Staten
11 : : //
12 : : // Creation Date : 09/14/04
13 : : //
14 : : // Owner : Matthew Staten
15 : : //-------------------------------------------------------------------------
16 : :
17 : : #ifndef SPHERE_EVALUATOR_HPP
18 : : #define SPHERE_EVALUATOR_HPP
19 : :
20 : : #include "CubitEvaluator.hpp"
21 : : #include "CubitDefines.h"
22 : : #include "CubitVector.hpp"
23 : : #include "GeometryDefines.h"
24 : :
25 [ # # ][ # # ]: 0 : class CUBIT_GEOM_EXPORT SphereEvaluatorData : public CubitEvaluatorData
[ # # ]
26 : : {
27 : : public:
28 : : double radius;
29 : : CubitVector center;
30 : :
31 : 0 : virtual GeometryType ask_type() const { return SPHERE_SURFACE_TYPE; }
32 : : };
33 : :
34 : : class CUBIT_GEOM_EXPORT SphereEvaluator: public CubitEvaluator
35 : : {
36 : :
37 : : private:
38 : :
39 : : SphereEvaluatorData mEvalData;
40 : :
41 : : protected:
42 : :
43 : : public :
44 : :
45 : :
46 [ # # ][ # # ]: 0 : SphereEvaluator( const SphereEvaluatorData *data ) { mEvalData = *data; }
47 : :
48 : 0 : virtual ~SphereEvaluator()
49 [ # # ][ # # ]: 0 : {}
50 : :
51 : 0 : virtual GeometryType ask_type() { return SPHERE_SURFACE_TYPE; }
52 : 0 : virtual CubitBoolean is_parametric() const { return CUBIT_TRUE; }
53 : 0 : virtual CubitBoolean is_periodic() const { return CUBIT_TRUE; }
54 : 0 : virtual CubitBoolean is_periodic_in_U( double &period ) const { period = 2*CUBIT_PI;
55 : 0 : return CUBIT_TRUE; }
56 : 0 : virtual CubitBoolean is_periodic_in_V( double &period ) const { period = 2*CUBIT_PI;
57 : 0 : return CUBIT_FALSE; }
58 : 0 : virtual CubitBoolean is_singular_in_U() const { return CUBIT_FALSE; }
59 : 0 : virtual CubitBoolean is_singular_in_V() const { return CUBIT_TRUE; }
60 : 0 : virtual CubitBoolean is_closed_in_U() const { return CUBIT_TRUE; }
61 : 0 : virtual CubitBoolean is_closed_in_V() const { return CUBIT_FALSE; }
62 : : virtual CubitBoolean get_param_range_U( double& lower_bound,
63 : : double& upper_bound ) const;
64 : : virtual CubitBoolean get_param_range_V( double& lower_bound,
65 : : double& upper_bound ) const;
66 : :
67 : : virtual const CubitEvaluatorData* evaluator_data() const;
68 : : virtual CubitVector position_from_u_v( double u, double v ) const;
69 : : virtual CubitStatus u_v_from_position( CubitVector const& location,
70 : : double& u,
71 : : double& v,
72 : : CubitVector* closest_location ) const;
73 : :
74 : : virtual CubitBox bounding_box() const;
75 : : //- Return the bounding obox of this sphere.
76 : :
77 : : virtual CubitStatus principal_curvatures( CubitVector const& location,
78 : : double& curvature_1,
79 : : double& curvature_2,
80 : : CubitVector* closest_location = NULL );
81 : : //R CubitStatus
82 : : //R- CUBIT_SUCCESS/FAILURE
83 : : //I location
84 : : //I- The point at which the curvatures are being requested -- it is also
85 : : //I- the point to which the closest point on the surface is returned.
86 : : //I- curvatures.
87 : : //O closest_location
88 : : //O- The point on the surface, closest to the input location (this
89 : : //O- might not be on the surface). This is input as a reference
90 : : //O- so that the function can modify its contents.
91 : : //O curvature_1/2
92 : : //O- Returned principal curvature magnitudes.
93 : : //- This functions computes the point on the surface that is closest
94 : : //- to the input location and then calculates the magnitudes of the
95 : : //- principal curvatures at this (possibly, new) point on the surface.
96 : :
97 : : virtual CubitStatus closest_point( CubitVector const& location,
98 : : CubitVector* closest_location = NULL,
99 : : CubitVector* unit_normal_ptr = NULL,
100 : : CubitVector* curvature1_ptr = NULL,
101 : : CubitVector* curvature2_ptr = NULL ) const;
102 : : //R CubitStatus
103 : : //R- CUBIT_SUCCESS/FAILURE
104 : : //I location
105 : : //I- The point to which the closest point on the surface is desired.
106 : : //O closest_location
107 : : //O- The point on the Surface, closest to the
108 : : //O- input location (which might not be on the Surface). This is
109 : : //O- input as a reference so that the function can modify its
110 : : //O- contents.
111 : : //O unit_normal_ptr
112 : : //O- The normal (represented as a unit vector) at the closest_location.
113 : : //O- If this pointer is NULL, the normal is not returned.
114 : : //O curvature1_ptr
115 : : //O- The first principal curvature of the surface at closest_location.
116 : : //O- If this pointer is NULL, this curvature is not returned.
117 : : //O curvature2_ptr
118 : : //O- The second principal curvature of the surface at closest_location.
119 : : //O- If this pointer is NULL, this curvature is not returned.
120 : : //- This function computes the point on the surface closest to the input
121 : : //- location -- i.e., closest_location.
122 : : //- The first Facet FACE in the list
123 : : //- is queried.
124 : : //-
125 : : //- If the input pointer values of unit_normal, curvature1 and
126 : : //- curvature2
127 : : //- are non-NULL, the normal and principal curvatures, too, are
128 : : //- returned. These are computed at closest_location, not at the
129 : : //- input location.
130 : : //-
131 : : //- NOTE:
132 : : //- It is assumed that if the calling code needs the normal or the
133 : : //- principal curvatures, it will *allocate* space for the CubitVectors
134 : : //- before sending in the pointers.
135 : :
136 : : };
137 : :
138 : :
139 : : // ********** BEGIN INLINE FUNCTIONS **********
140 : : // ********** END INLINE FUNCTIONS **********
141 : :
142 : : // ********** BEGIN FRIEND FUNCTIONS **********
143 : : // ********** END FRIEND FUNCTIONS **********
144 : :
145 : : // ********** BEGIN EXTERN FUNCTIONS **********
146 : : // ********** END EXTERN FUNCTIONS **********
147 : :
148 : : #endif
149 : :
|