Branch data Line data Source code
1 : : //-------------------------------------------------------------------------
2 : : // Filename : OCCSurface.hpp
3 : : //
4 : : // Purpose :
5 : : //
6 : : // Special Notes :
7 : : //
8 : : // Creator : Jane Hu
9 : : //
10 : : // Creation Date :
11 : : //
12 : : // Owner :
13 : : //-------------------------------------------------------------------------
14 : :
15 : : #ifndef SURFACE_OCC_HPP
16 : : #define SURFACE_OCC_HPP
17 : :
18 : :
19 : : // ********** BEGIN STANDARD INCLUDES **********
20 : : // ********** END STANDARD INCLUDES **********
21 : :
22 : : // ********** BEGIN OCC INCLUDES **********
23 : :
24 : : #include "TopoDS_Face.hxx"
25 : :
26 : : // ********** END OCC INCLUDES **********
27 : :
28 : :
29 : : // ********** BEGIN CUBIT INCLUDES **********
30 : :
31 : : #include "CubitDefines.h"
32 : : #include "Surface.hpp"
33 : :
34 : : // ********** END CUBIT INCLUDES **********
35 : :
36 : : class TopologyEntity;
37 : : class RefVolume;
38 : : class RefFace;
39 : : class RefVolume;
40 : : class OCCShell;
41 : : class OCCAttrib;
42 : :
43 : : class OCCBody;
44 : : class OCCLump;
45 : : class OCCLoop;
46 : : class OCCCoEdge;
47 : : class OCCCurve;
48 : : class OCCPoint;
49 : : class BRepBuilderAPI_MakeShape;
50 : : class BRepAlgoAPI_BooleanOperation;
51 : : class BRepBuilderAPI_ModifyShape;
52 : : class LocOpe_SplitShape;
53 : : class TopoDS_Vertex;
54 : : //// class CubitTransformMatrix;
55 : :
56 : : class OCCSurface : public Surface
57 : : {
58 : :
59 : : public :
60 : :
61 : : OCCSurface(TopoDS_Face *theFace);
62 : :
63 : : virtual ~OCCSurface() ;
64 : : //- The destructor
65 : :
66 : : //if op is of BRepFilletAPI_MakeFillet2d type, need to input the
67 : : //removed_vertex for update.
68 : : static CubitStatus update_OCC_entity(TopoDS_Face& old_surface,
69 : : TopoDS_Shape& new_surface,
70 : : BRepBuilderAPI_MakeShape *op,
71 : : TopoDS_Vertex* removed_vertex = NULL,
72 : : LocOpe_SplitShape* sp = NULL);
73 : :
74 : : virtual CubitStatus closest_point_along_vector(CubitVector& from_point,
75 : : CubitVector& along_vector,
76 : : CubitVector& point_on_surface); //This function has not been implemented.
77 : :
78 : :
79 : 0 : void add_hardpoint(OCCPoint* HardPoint){myHardPoints.append(HardPoint);}
80 : : void remove_hardpoint(OCCPoint* HardPoint){myHardPoints.remove(HardPoint);}
81 : 15428 : DLIList<OCCPoint*> get_hardpoints() {return myHardPoints;}
82 : :
83 : : virtual void append_simple_attribute_virt(const CubitSimpleAttrib&);
84 : : //R void
85 : : //I
86 : : //I-
87 : : //I- that is to be appended to this OSME object.
88 : : //- The purpose of this function is to append a
89 : : //- attribute to the OSME. The is attached to each of the
90 : : //- underlying solid model entities this one points to.
91 : :
92 : : virtual void remove_simple_attribute_virt(const CubitSimpleAttrib&);
93 : : //R void
94 : : //I CubitSimpleAttrib*
95 : : //I- A reference to a CubitSimpleAttrib object which is the object
96 : : //I- that is to be removed to this OSME object.
97 : : //- The purpose of this function is to remove a simple
98 : : //- attribute from the OSME. The attribute is attached to each of the
99 : : //- underlying solid model entities this one points to.
100 : :
101 : : virtual void remove_all_simple_attribute_virt();
102 : : //R void
103 : : //I-
104 : : //- The purpose of this function is to remove all simple
105 : : //- attributes from the OSME.
106 : :
107 : : virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib>&);
108 : : virtual CubitStatus get_simple_attribute(const CubitString& name,
109 : : DLIList<CubitSimpleAttrib>&);
110 : : //R CubitSimpleAttrib*
111 : : //R- the returned cubit simple attribute.
112 : : //- The purpose of this function is to get the attributes
113 : : //- of the geometry entity. The name is attached to the underlying solid
114 : : //- model entity(ies) this one points to.
115 : : //- MJP Note:
116 : : //- This is the code that implements the requirement that names
117 : : //- of VGI Entities propagate across solid model boolean
118 : : //- operations. The success of this relies, of course, on the underlying
119 : : //- solid modeler being able to propagate attributes across
120 : : //- such operations on its entities. If it cannot, then "names"
121 : : //- of VGI entities will not propagate.
122 : :
123 : : virtual CubitBox bounding_box() const ;
124 : : // see comments in GeometryEntity.hpp
125 : :
126 : : virtual GeometryQueryEngine*
127 : : get_geometry_query_engine() const;
128 : : //R GeometryQueryEngine*
129 : : //R- A pointer to the geometric modeling engine associated with
130 : : //R- the object.
131 : : //- This function returns a pointer to the geometric modeling engine
132 : : //- associated with the object.
133 : :
134 : : // Added by CAT
135 : : virtual CubitStatus get_point_normal( CubitVector& ,
136 : : CubitVector& );
137 : : //- Only valid for planar surfaces
138 : : //- Finds the underlying plane's origin and normal vector
139 : : //- Returns CubitFailure if not a plane. The origin and normal
140 : : //- are returned directly from the underlying format for a plane.
141 : :
142 : : virtual void closest_point_trimmed(CubitVector from_point,
143 : : CubitVector& point_on_surface);
144 : : //R void
145 : : //I CubitVector
146 : : //I- point from which to find closest point on trimmed surface
147 : : //O CubitVector
148 : : //O- point on trimmed surface closest to passed-in point
149 : : //- This function finds the closest point on a TRIMMED surface to the
150 : : //- passed-in point.
151 : :
152 : : virtual CubitStatus closest_point_uv_guess(
153 : : CubitVector const& location,
154 : : double &u, double &v,
155 : : CubitVector* closest_location = NULL,
156 : : CubitVector* unit_normal = NULL );
157 : :
158 : : virtual CubitSense get_shell_sense(ShellSM*) const;
159 : :
160 : : virtual CubitStatus closest_point(
161 : : CubitVector const& location,
162 : : CubitVector* closest_location = NULL,
163 : : CubitVector* unit_normal_ptr = NULL,
164 : : CubitVector* curvature1_ptr = NULL,
165 : : CubitVector* curvature2_ptr = NULL);
166 : : //R CubitStatus
167 : : //R- CUBIT_SUCCESS/FAILURE
168 : : //I location
169 : : //I- The point to which the closest point on the surface is desired.
170 : : //O closest_location
171 : : //O- The point on the Surface, closest to the
172 : : //O- input location (which might not be on the Surface). This is
173 : : //O- input as a reference so that the function can modify its
174 : : //O- contents.
175 : : //O unit_normal_ptr
176 : : //O- The normal (represented as a unit vector) at the closest_location.
177 : : //O- If this pointer is NULL, the normal is not returned.
178 : : //O curvature1_ptr
179 : : //O- The first principal curvature of the surface at closest_location.
180 : : //O- If this pointer is NULL, this curvature is not returned.
181 : : //O curvature2_ptr
182 : : //O- The second principal curvature of the surface at closest_location.
183 : : //O- If this pointer is NULL, this curvature is not returned.
184 : : //- This function computes the point on the surface closest to the input
185 : : //- location -- i.e., closest_location.
186 : : //- The first Facet FACE in the list
187 : : //- is queried.
188 : : //-
189 : : //- If the input pointer values of unit_normal, curvature1 and
190 : : //- curvature2
191 : : //- are non-NULL, the normal and principal curvatures, too, are
192 : : //- returned. These are computed at closest_location, not at the
193 : : //- input location.
194 : : //-
195 : : //- NOTE:
196 : : //- It is assumed that if the calling code needs the normal or the
197 : : //- principal curvatures, it will *allocate* space for the CubitVectors
198 : : //- before sending in the pointers.
199 : :
200 : : virtual CubitStatus principal_curvatures(
201 : : CubitVector const& location,
202 : : double& curvature_1,
203 : : double& curvature_2,
204 : : CubitVector* closest_location = NULL );
205 : : //R CubitStatus
206 : : //R- CUBIT_SUCCESS/FAILURE
207 : : //I location
208 : : //I- The point at which the curvatures are being requested -- it is also
209 : : //I- the point to which the closest point on the surface is returned.
210 : : //I- curvatures.
211 : : //O closest_location
212 : : //O- The point on the surface, closest to the input location (this
213 : : //O- might not be on the surface). This is input as a reference
214 : : //O- so that the function can modify its contents.
215 : : //O curvature_1/2
216 : : //O- Returned principal curvature magnitudes.
217 : : //- This functions computes the point on the surface that is closest
218 : : //- to the input location and then calculates the magnitudes of the
219 : : //- principal curvatures at this (possibly, new) point on the surface.
220 : :
221 : : virtual CubitStatus evaluate( double u, double v,
222 : : CubitVector *position,
223 : : CubitVector *normal,
224 : : CubitVector *curvature1,
225 : : CubitVector *curvature2 );
226 : :
227 : :
228 : :
229 : : virtual CubitVector position_from_u_v (double u, double v);
230 : : //R CubitVector
231 : : //R- Returned position vector.
232 : : //I u, v
233 : : //I- Input point in {u.v} space
234 : : //- This function returns the coordinates in world space of a point
235 : : //- in the parameter space of this Surface object.
236 : :
237 : : virtual CubitStatus u_v_from_position (CubitVector const& location,
238 : : double& u,
239 : : double& v,
240 : : CubitVector*
241 : : closest_location = NULL );
242 : : //R CubitStatus
243 : : //R- CUBIT_SUCCESS/FAILURE
244 : : //I location
245 : : //I- The input point in global space
246 : : //O closest_point
247 : : //O- The point on the Surface closest to the input location
248 : : //O u, v
249 : : //O- The returned u, v coordinate values (in local parametric space)
250 : : //O- of the closest_point
251 : : //I refvolume_ptr
252 : : //- This function returns the {u, v} coordinates of the point
253 : : //- on the Surface closest to the input point (specified in global
254 : : //- space). The closest_location is also returned.
255 : :
256 : : virtual CubitBoolean is_periodic();
257 : : //R CubitBoolean
258 : : //R- CUBIT_TRUE/CUBIT_FALSE
259 : : //- This function determines whether the underlying geometry of the
260 : : //- OCCSurface is periodic or not. Returns CUBIT_TRUE if it is and
261 : : //- CUBIT_FALSE if it is not.
262 : : //- MJP NOTE:
263 : : //- The first Facet FACE in the list is queried. It is assumed
264 : : //- that all the FACEs have the same underlying surface.
265 : :
266 : : virtual CubitBoolean is_periodic_in_U( double& period );
267 : : //R CubitBoolean
268 : : //R- CUBIT_TRUE/CUBIT_FALSE
269 : : //O period
270 : : //O- The value of the period in the U direction.
271 : : //- Determines whether the Facet surface object associated
272 : : //- with one of the FACEs of this OCCSurface object is
273 : : //- periodic in the U direction or not. If it is, it
274 : : //- returns CUBIT_TRUE and the value of the period. Otherwise,
275 : : //- it returns CUBIT_FALSE and a value of 0.0 or the period.
276 : : //- MJP NOTE:
277 : : //- The first Facet FACE in the list is queried. It is assumed
278 : : //- that all the FACEs have the same underlying surface.
279 : :
280 : : virtual CubitBoolean is_periodic_in_V( double& period );
281 : : //R CubitBoolean
282 : : //R- CUBIT_TRUE/CUBIT_FALSE
283 : : //O period
284 : : //O- The value of the period in the V direction.
285 : : //- Determines whether the Facet surface object associated
286 : : //- with one of the FACEs of this OCCSurface object is
287 : : //- periodic in the V direction or not. If it is, it
288 : : //- returns CUBIT_TRUE and the value of the period. Otherwise,
289 : : //- it returns CUBIT_FALSE and a value of 0.0 or the period.
290 : : //- MJP NOTE:
291 : : //- The first Facet FACE in the list is queried. It is assumed
292 : : //- that all the FACEs have the same underlying surface.
293 : :
294 : : virtual CubitBoolean is_singular_in_U( double u_param );
295 : : virtual CubitBoolean is_singular_in_V( double v_param );
296 : : //R CubitBoolean
297 : : //R- CUBIT_TRUE/CUBIT_FALSE
298 : : //I double u/v parameter value.
299 : : //- Determines if the surface is singular in a given direction
300 : : //- at a given parameter value.
301 : :
302 : : virtual CubitBoolean is_closed_in_U();
303 : : virtual CubitBoolean is_closed_in_V();
304 : : //R CubitBoolean
305 : : //R- CUBIT_TRUE/CUBIT_FALSE
306 : : //- Determines if the surface is closed, smoothly or not in the
307 : : //- given parameter direction.
308 : : //- A periodic surface is always closed but a closed surface is
309 : : //- is not always periodic.
310 : :
311 : : virtual CubitStatus uv_derivitives( double u_param,
312 : : double v_param,
313 : : CubitVector &du,
314 : : CubitVector &dv );
315 : : //R CubitStatus
316 : : //R- CUBIT_SUCCESS/CUBIT_FAILURE
317 : : //O- du, dv
318 : : //- Determines the u and v derivitives from the given parameter
319 : : //- values.
320 : :
321 : 120243 : TopoDS_Face *get_TopoDS_Face()
322 [ + - ][ + - ]: 120243 : {if (myTopoDSFace && !myTopoDSFace->IsNull()) assert (myTopoDSFace->ShapeType() == TopAbs_FACE); return myTopoDSFace;}
[ + - ][ - + ]
323 : : void set_TopoDS_Face(TopoDS_Face& face);
324 : :
325 : : int get_loops(DLIList<OCCLoop*>&);
326 : :
327 : : int get_coedges(DLIList<OCCCoEdge*>&);
328 : :
329 : : int get_curves(DLIList<OCCCurve*>&);
330 : :
331 : : int get_points(DLIList<OCCPoint*>& points);
332 : :
333 : 34158 : void set_shell(OCCShell* shell)
334 : 34158 : { myShell = shell;}
335 : :
336 : 16450 : void set_lump(OCCLump* lump)
337 : 16450 : { myLump = lump;}
338 : :
339 : 16725 : void set_body(OCCBody* body)
340 : 16725 : { myBody = body;}
341 : :
342 : 46880 : OCCShell* my_shell() {return myShell;}
343 : :
344 : 10058 : OCCLump* my_lump() {return myLump;}
345 : :
346 : 21042 : OCCBody* my_body() {return myBody;}
347 : :
348 : : CubitStatus get_bodies(DLIList<OCCBody*> &bodies);
349 : :
350 : : virtual CubitBoolean is_parametric();
351 : : //R CubitBoolean
352 : : //R- CUBIT_TRUE/CUBIT_FALSE
353 : : //- This method returns CUBIT_TRUE if a parametric representation
354 : : //- is available for the surface
355 : :
356 : : virtual CubitBoolean get_param_range_U( double& lower_bound,
357 : : double& upper_bound );
358 : : //R CubitBoolean
359 : : //R- CUBIT_TRUE/CUBIT_FALSE
360 : : //O lower_bound
361 : : //O- The lower bound of the parametric range in the U direction.
362 : : //O- This is set to 0.0 if the surface is not parametric.
363 : : //O upper_bound
364 : : //O- The upper bound of the parametric range in the U direction.
365 : : //O- This is set to 0.0 if the surface is not parametric.
366 : : //- Returns the lower and upper parametric bounds of the
367 : : //- surface in U, if it is parametric. Otherwise, it returns
368 : : //- CUBIT_FALSE and zeroes for the upper and lower parametric
369 : : //- bounds.
370 : : //- MJP NOTE:
371 : : //- The first Facet FACE in the list is queried. It is assumed
372 : : //- that all the FACEs have the same underlying surface.
373 : :
374 : : virtual CubitBoolean get_param_range_V( double& lower_bound,
375 : : double& upper_bound );
376 : : //R CubitBoolean
377 : : //R- CUBIT_TRUE/CUBIT_FALSE
378 : : //O lower_bound
379 : : //O- The lower bound of the parametric range in the V direction.
380 : : //O- This is set to 0.0 if the surface is not parametric.
381 : : //O upper_bound
382 : : //O- The upper bound of the parametric range in the V direction.
383 : : //O- This is set to 0.0 if the surface is not parametric.
384 : : //- Returns the lower and upper parametric bounds of the
385 : : //- surface in V, if it is parametric. Otherwise, it returns
386 : : //- CUBIT_FALSE and zeroes for the upper and lower parametric
387 : : //- bounds.
388 : : //- MJP NOTE:
389 : : //- The first Facet FACE in the list is queried. It is assumed
390 : : //- that all the FACEs have the same underlying surface.
391 : :
392 : : virtual CubitBoolean is_position_on( CubitVector &test_position );
393 : : //R CubitBoolean
394 : : //R- CUBIT_TRUE/CUBIT_FALSE
395 : : //I CubitVector
396 : : //I- position, point where we want to test, whether or not it
397 : : //- is on the surface.
398 : :
399 : : virtual CubitPointContainment point_containment( const CubitVector &point );
400 : : virtual CubitPointContainment point_containment( double u, double v );
401 : :
402 : : virtual CubitStatus get_projected_distance_on_surface( CubitVector *pos1,
403 : : CubitVector *pos2,
404 : : double &distance );
405 : :
406 : : virtual CubitStatus get_nurb_params( bool &rational,
407 : : int °ree_u,
408 : : int °ree_v,
409 : : int &num_cntrl_pts_u,
410 : : int &num_cntrl_pts_v,
411 : : DLIList<CubitVector> &cntrl_pts,
412 : : DLIList<double> &weights,
413 : : DLIList<double> &u_knots,
414 : : DLIList<double> &v_knots ) const ;
415 : : //- Only valid for nurbs surfaces
416 : : //O rational
417 : : //O- True if the nurb is rational
418 : : //O degree_u
419 : : //O- The degree of the nurb in the u direction
420 : : //O degree_v
421 : : //O- The degree of the nurb in the v direction
422 : : //O num_cntrl_pts_u
423 : : //O- Number of control points in the u direction
424 : : //O num_cntrl_pts_v
425 : : //O- Number of control points in the v direction
426 : : //O cntrl_pts
427 : : //O- The control points stored as
428 : : //O- cntrl_pts[0 ] = pt[u=0][v=0]
429 : : //O- cntrl_pts[1 ] = pt[u=1][v=0]
430 : : //O- ...
431 : : //O- cntrl_pts[num_cntrl_pts_u-1] = pt[u=?][v=0]
432 : : //O- cntrl_pts[num_cntrl_pts_u ] = pt[u=0][v=1]
433 : : //O- ...
434 : : //O weights
435 : : //O- If rational, weights for each control point, stored in the same
436 : : //O- order as the control points. No weights are returned if
437 : : //O- rational == false
438 : : //O u_knots
439 : : //O- knot vector in the u direction
440 : : //O v_knots
441 : : //O- knot vector in the v direction
442 : :
443 : : virtual CubitStatus get_sphere_params( CubitVector ¢er,
444 : : double &radius ) const ;
445 : : //- Only valid for spherical surfaces
446 : : //O center
447 : : //O- The center of the sphere
448 : : //O radius
449 : : //O- The radius of the sphere
450 : :
451 : : virtual CubitStatus get_cone_params( CubitVector ¢er,
452 : : CubitVector &normal,
453 : : CubitVector &major_axis,
454 : : double &radius_ratio,
455 : : double &sine_angle,
456 : : double &cos_angle ) const ;
457 : : //- Only valid for conical surfaces. Cylinders are a special case of conicals.
458 : : //O center
459 : : //O-
460 : : //O normal
461 : : //O-
462 : : //O major_axis
463 : : //O-
464 : : //O radius_ratio
465 : : //O-
466 : : //O sine_angle
467 : : //O-
468 : : //O cos_angle
469 : : //O-
470 : :
471 : : virtual CubitStatus get_torus_params( CubitVector ¢er,
472 : : CubitVector &normal,
473 : : double &major_radius,
474 : : double &minor_radius ) const ;
475 : : //- Only valid for torus surfaces.
476 : : //O center
477 : : //O-
478 : : //O normal
479 : : //O-
480 : : //O major_radius
481 : : //O-
482 : : //O minor_radius
483 : : //O-
484 : :
485 : : GeometryType geometry_type();
486 : : //R GeometryType (enum)
487 : : //R- The enumerated type of the geometric representation
488 : :
489 : : virtual double measure();
490 : : //R double
491 : : //R- The numeric value of the measure (its units depend on the dimension
492 : : //R- of the RefEntity being "measured")
493 : : //- A generic geometric extent function.
494 : : //- Returns volume for Lump, area for Surface, length for Curve and
495 : : //- 1.0 for Point
496 : :
497 : : CubitVector center_point();
498 : : virtual CubitSense get_geometry_sense();
499 : : //- Return the relative surface sense. (see below)
500 : :
501 : : virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
502 : : virtual void get_children_virt( DLIList<TopologyBridge*>& children );
503 : :
504 : : CubitBoolean is_flat(); //// Not in Surface
505 : : CubitBoolean is_spherical(); //// Not in Surface
506 : : CubitBoolean is_conical(); //// Not in Surface
507 : :
508 : : CubitStatus update_OCC_entity( BRepBuilderAPI_ModifyShape *aBRepTrsf,
509 : : BRepAlgoAPI_BooleanOperation *op = NULL);
510 : : protected:
511 : :
512 : : private:
513 : : //CubitSense sense_;
514 : : //- The sense of the RefFace that owns this Surface with respect
515 : : //- to the positive sense of the first FACE in FACEPtrList_.
516 : : //- When a Surface is first constructed, this value is arbitrarily
517 : : //- set to CUBIT_FORWARD.
518 : : //- In the case of Surfaces, the normal is used in determining
519 : : //- the relative sense value.
520 : : //- MJP NOTE:
521 : : //- Not only does the RefFace have a sense wrt its Surface, but each
522 : : //- Facet FACE has a sense wrt its underlying "surface" object.
523 : :
524 : : TopoDS_Face *myTopoDSFace;
525 : :
526 : : //Following 3 members are only for sheeted body.
527 : : OCCShell* myShell;
528 : : OCCLump* myLump;
529 : : OCCBody* myBody;
530 : : DLIList<OCCPoint*> myHardPoints;
531 : :
532 : : };
533 : :
534 : :
535 : : // ********** BEGIN INLINE FUNCTIONS **********
536 : : // ********** END INLINE FUNCTIONS **********
537 : :
538 : : // ********** BEGIN FRIEND FUNCTIONS **********
539 : : // ********** END FRIEND FUNCTIONS **********
540 : :
541 : : // ********** BEGIN EXTERN FUNCTIONS **********
542 : : // ********** END EXTERN FUNCTIONS **********
543 : :
544 : : #endif
545 : :
|