cgma
SplitSurfaceTool.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : SplitSurfaceTool.hpp
00003 //
00004 // Purpose       : Split a single or chain of surfaces (e.g., split a fillet 
00005 //                 down the middle so that a mesh sweep can occur, or split
00006 //                 across a surface).  Used by the "split surface" commands.
00007 //
00008 // Special Notes : 
00009 //
00010 // Creator       : Steve Storm
00011 //
00012 // Creation Date : 10/06/2002
00013 //-------------------------------------------------------------------------
00014 
00015 #ifndef SPLITSURFACETOOL_HPP
00016 #define SPLITSURFACETOOL_HPP
00017 
00018 #include "CubitDefines.h"
00019 #include "RefEdge.hpp"
00020 #include "RefVertex.hpp"
00021 #include "CoEdge.hpp"
00022 class Cubit2DPoint;
00023 class RefVertex;
00024 class RefEdge;
00025 class RefFace;
00026 class TDSplitSurface;
00027 //class Curve;
00028 class GeometryModifyEngine;
00029 
00030 template <class X> class DLIList;
00031 
00033 class CUBIT_GEOM_EXPORT SplitSurfaceTool
00034 {
00035 
00036   public:
00037 
00038     SplitSurfaceTool();
00039     ~SplitSurfaceTool(){}
00040 
00048     CubitStatus preview( RefFace *ref_face_ptr,
00049                          DLIList<CubitVector*> &locations,
00050                          DLIList<DLIList<CubitVector*>*> &vec_lists,
00051                          CubitBoolean create_ref_edges_flg,
00052                          CubitBoolean clear_previous_previews = CUBIT_TRUE );
00053 
00055     CubitStatus preview( DLIList<RefFace*> &ref_face_list,
00056                          DLIList<CubitVector*> &locations,
00057                          DLIList<DLIList<DLIList<CubitVector*>*>*> &list_of_vec_lists,
00058                          CubitBoolean create_ref_edges_flg,
00059                          CubitBoolean clear_previous_previews = CUBIT_TRUE );
00060    
00062 
00063 
00064 
00065 
00066     CubitStatus calculate_split_curves( RefFace *ref_face_ptr,
00067                                         DLIList<DLIList<CubitVector*>*> &vec_lists,
00068                                         DLIList<Curve*> &curve_list );
00069     CubitStatus calculate_split_curves( Surface *surf_ptr,
00070                                         DLIList<DLIList<CubitVector*>*> &vec_lists,
00071                                         DLIList<Curve*> &curve_list );
00073 
00109     CubitStatus calculate_split_curves( DLIList<RefFace*> &ref_face_list, 
00110                                         int num_segs, double fraction, 
00111                                         double distance, RefEdge *from_curve_ptr,
00112                                         DLIList<RefVertex*> &corner_vertex_list,
00113                                         DLIList<RefVertex*> &through_vertex_list,
00114                                         RefEdge *curve_dir_ptr,
00115                                         CubitBoolean preview_flg,
00116                                         CubitBoolean create_ref_edges_flg,
00117                                         CubitBoolean just_curves_flg,
00118                                         DLIList<DLIList<Curve*>*> &curve_lists_list ); 
00119 
00125     CubitStatus split_surface( RefFace *ref_face_ptr,
00126                                DLIList<DLIList<CubitVector*>*> &vec_lists );
00127 
00129     CubitStatus split_surface( DLIList<RefFace*> &ref_face_list, 
00130                                DLIList<DLIList<DLIList<CubitVector*>*>*> &list_of_vec_lists );
00131 
00133     CubitStatus split_surface( RefFace *ref_face_ptr, DLIList<Curve*> &curve_list);
00134     
00170     CubitStatus split_surfaces( DLIList<RefFace*> &ref_face_list,
00171                                 int num_segs,
00172                                 double fraction,
00173                                 double distance,
00174                                 RefEdge *from_curve_ptr,
00175                                 DLIList<RefVertex*> &corner_vertex_list,
00176                                 DLIList<RefVertex*> &through_vertex_list,
00177                                 RefEdge *curve_dir_ptr = NULL,
00178                                 CubitBoolean preview_flg = CUBIT_FALSE,
00179                                 CubitBoolean create_ref_edges_flg = CUBIT_FALSE );
00180 
00187     CubitStatus split_surfaces( DLIList<RefFace*> &ref_face_list,
00188                                 int num_segs,
00189                                 double fraction,
00190                                 double distance,
00191                                 RefEdge *from_curve_ptr,
00192                                 DLIList<RefVertex*> &corner_vertex_list,
00193                                 DLIList<RefVertex*> &through_vertex_list,
00194                                 RefEdge *curve_dir_ptr,
00195                                 DLIList<DLIList<Curve*>*> &curve_lists_list );
00196 
00198     CubitStatus split_surfaces( DLIList<RefFace*> &ref_face_list,
00199                                 int num_segs,
00200                                 double fraction,
00201                                 double distance,
00202                                 RefEdge *from_curve_ptr,
00203                                 DLIList<RefVertex*> &corner_vertex_list,
00204                                 DLIList<RefVertex*> &through_vertex_list,
00205                                 RefEdge *curve_dir_ptr,
00206                                 DLIList<Curve*> &curve_list );
00207 
00230     CubitStatus split_surfaces_extend( DLIList<RefFace*> &ref_face_list,
00231                                      DLIList<RefVertex*> &ref_vertex_list,
00232                                      CubitBoolean preview_flg = CUBIT_FALSE,
00233                                      CubitBoolean create_ref_edges_flg = CUBIT_FALSE );
00234 
00238     void free_curves_lists( DLIList<DLIList<Curve*>*> &curve_lists_list,
00239                             CubitBoolean free_curves_flg = CUBIT_TRUE );
00240 
00242     static void set_tolerance( double tol );
00243 
00254     static double get_tolerance();
00255 
00257     static void set_auto_detect_triangles_flg( CubitBoolean auto_detect_flg );
00258 
00260     static CubitBoolean get_auto_detect_triangles_flg();
00261 
00263     static void set_side_angle_threshold( double angle );
00264 
00268     static double get_side_angle_threshold();
00269 
00271     static void set_point_angle_threshold( double tol );
00272 
00276     static double get_point_angle_threshold();
00277 
00279     static void set_parametric_flg( CubitBoolean parametric_flg );
00280 
00290     static CubitBoolean get_parametric_flg();
00291 
00293     static void set_extend_gap_threshold( double threshold = CUBIT_DBL_MAX );
00294 
00296     static double get_extend_gap_threshold();
00297 
00301     static void set_extend_tolerance( double tol );
00302 
00304     static double get_extend_tolerance();
00305 
00309     static void set_extend_normal_flg( CubitBoolean extend_normal_flg );
00310 
00312     static CubitBoolean get_extend_normal_flg();
00313 
00315     static void initialize_settings();
00316 
00318     CubitStatus draw_preview( DLIList<Curve*> &curve_list, int color=CUBIT_BLUE_INDEX );
00319 
00320     Curve *create_curve( DLIList<CubitVector*> &vec_list,
00321                          Surface *surf_ptr,
00322                          double tolerance = GEOMETRY_RESABS,
00323                          CubitBoolean iterate = CUBIT_FALSE,
00324                          CubitBoolean draw_pnts = CUBIT_FALSE,
00325                          CubitBoolean project_curve = CUBIT_TRUE );
00326     //- Creates a curve given the input points.  The function will attempt
00327     //- to use a straight line or arc, if possible.  In order to create
00328     //- a straight line or arc, all of the input points must lie within
00329     //- 0.5*tolerance of a line or arc (0.5 to minimize the total deviation,
00330     //- exception - if tolerance==GEOMETRY_RESABS do not take 0.5), and the
00331     //- line or arc must lie within resabs of the surface (so that imprinting
00332     //- can occur).  If iterate is TRUE, if a line or arc cannot be created,
00333     //- the function will iterate until a spline is created that lies within
00334     //- tolerance of the line segments input in vec_list (i.e., the resultant
00335     //- spline approximates a series of line segments).  If draw_pnts is TRUE,
00336     //- the function will draw the resultant spline points.  If project_curve
00337     //- is CUBIT_TRUE, project the curve to the surface (this option was
00338     //- added to speed up previewing - for that we skip the project).
00339 
00340   private:
00341 
00342     CubitStatus split_surfaces( DLIList<RefFace*> &ref_face_list,
00343                                 int num_segs,
00344                                 double fraction,
00345                                 double distance,
00346                                 RefEdge *from_curve_ptr,
00347                                 DLIList<RefVertex*> &corner_vertex_list,
00348                                 DLIList<RefVertex*> &through_vertex_list,
00349                                 RefEdge *curve_dir_ptr,
00350                                 CubitBoolean preview_flg,
00351                                 CubitBoolean create_ref_edges_flg,
00352                                 CubitBoolean just_curves_flg,
00353                                 DLIList<DLIList<Curve*>*> &curve_lists_list );
00354     //- Main workhorse function for automatic splitting.  See above for 
00355     //- description of inputs.  Note if just_curves_flg==CUBIT_TRUE, the 
00356     //- preview_flg and create_ref_edges_flg are ignored.  See above for
00357     //- description of the inputs.
00358 
00359     CubitStatus check_valid_faces();
00360     //- Check each face for multiple loops, hardlines and against looping on
00361     //- themselves (if more than one face).
00362 
00363     CubitStatus order_face_list();
00364     //- Order the refFaceChain from one end of surface chain to the other.
00365     //- This function also detects the isLoop condition (a continuous loop
00366     //- of surfaces).
00367 
00368     CubitStatus get_neighbors( RefFace *seed_ref_face, 
00369                                DLIList<RefFace*> &input_ref_faces,
00370                                DLIList<RefFace*> &neighbor_ref_faces );
00371     //- Get all the neighbors of the input seed RefFace.  Note second
00372     //- list is intended to be copied in.
00373 
00374     CubitStatus get_outer_loops();
00375     //- Get all of the outer loops - outerCurveLoop, outerCoEdgeLoop,
00376     //- outerVertexList.  Make sure they start at the start surface
00377     //- in the chain.
00378 
00379     CubitStatus get_outer_coedge_loop();
00380     //- Given the ordered refFaceChain, finds the outerCoEdgeLoop.  
00381 
00382     CubitStatus find_loop_start( CoEdge *&start_co_edge_ptr );
00383     //- Finds the start of the loop when constructing the outerCoEdgeLoop
00384 
00385     CubitStatus get_outer_vertices( DLIList<RefVertex*> &ref_vertex_list );
00386     //- Fill the given vertex list using the outerCoEdgeLoop.  This is
00387     //- simply an ordered list of the vertices in the loop.
00388 
00389     CubitStatus get_outer_curves( DLIList<RefEdge*> &ref_edge_list  );
00390     //- Fill the given refedge list using the outerCoEdgeLoop.  This is 
00391     //- simply an ordered list of refedges in the loop.
00392     
00393     CubitStatus pick_4_corners();
00394     //- For a chain of surfaces.  Uses angle angle criteria to pick the 
00395     //- corner vertices so that a mapping algorithm can be used to find 
00396     //- the split locations on the surfaces.  Two vertices must be on
00397     //- the start surface, and two on the end.
00398 
00399     CubitStatus pick_expanded_corners( RefFace *ref_face_ptr,
00400                                        DLIList<CoEdge*> &co_edge_list,
00401                                        int &offset, double epsilon, 
00402                                        int &A_i, int &B_i );
00403     //- Used by pick_4_corners.  Finds the two best corners on the given
00404     //- RefFace (which will be either the start or the end surface of the
00405     //- chain).  If there are multiple vertices with the same angle, it
00406     //- will find the pair that are the farthest from the center.
00407 
00408     CubitStatus pick_4_corners_simple();
00409     //- For a single surface.  Just finds the 4 corners closest to PI/2.
00410 
00411     CubitStatus update_corners_for_triangle();
00412     //- Determines whether any corners are close to 180 degrees (above
00413     //- angleTolerance).  On a single surface, the corner that is 
00414     //- closest to 180 and above angleTolerance is removed.  The next
00415     //- angle farthest from PI/2 is chosen as the corner of the triangle.
00416     //- For a chain, both ends of the chain are checked.
00417 
00418     CubitStatus remove_corner( int corner_to_remove, int collapsed_corner,
00419                                CubitBoolean set_collapsed_first );
00420     //- Removes a corner making a triangle.  If set_collapsed_first is
00421     //- CUBIT_TRUE, then the collapsed side is set to the first corner,
00422     //- meaning the split will originate there.
00423 
00424     CubitStatus fill_corners( int best_corner_1, int best_corner_2,
00425                               int best_corner_3, int best_corner_4 );
00426     //- Fill the cornerCoEdge array given the position of the corners
00427 
00428     CubitStatus fill_side_intervals( int best_corner_1, int best_corner_2,
00429                                      int best_corner_3, int best_corner_4 );
00430     //- Fill sideInterval array given teh position of the corners
00431 
00432     CubitStatus order_selected_corners( DLIList<RefVertex*> &outer_vertex_list );
00433     //- If the user specified corners, this function will reorient the lists
00434     //- so that the desired split direction will occur.  It also does error
00435     //- checking on the users selected corners.
00436 
00437     int number_in_list( DLIList<RefVertex*> &corner_vertex_list, 
00438                         RefVertex *ref_vertex_ptr );
00439     //- Count the number of times the given RefVertex exists in the list
00440 
00441     CubitBoolean is_in_outer_loop( RefVertex *ref_vertex_ptr );
00442     //- Determines whether the given vertex exists in the outer loop
00443 
00444     CubitStatus compute_angles( double *&angles, double &turn_angle_sum );
00445     //- This finds an array of angles around the outer loop for finding
00446     //- corners.  Note the angles array is allocated - the calling function
00447     //- must free it.  turn_angle_sum is currently not used.
00448 
00449     void order_corners( int &corner_1, int &corner_2,
00450                                 int &corner_3, int &corner_4 );
00451     void order_corners( int &corner_1, int &corner_2,
00452                                 int &corner_3 );
00453     //- Given the best corners in any order, these functions just sort them
00454     //- from lowest to highest.
00455 
00456     CubitStatus adjust_for_split_direction( RefEdge *curve_dir_ptr,
00457                                             RefEdge *from_curve_ptr,
00458                                             DLIList<RefVertex*> &corner_vertex_list );
00459     //- Adjust the lists so that the split direction is proper.  See function
00460     //- for logic details (i.e., always split along chains of surfaces, attempt
00461     //- to split along highest aspect ratio for single surfaces, etc.).
00462 
00463     double get_side_length( int side );
00464     //- Determines the length of a given side of the logical rectangle.
00465 
00466     double compute_next_angle( DLIList<CoEdge*> &co_edge_list );
00467     //- Finds the next angle when walking around outerCoEdgeLoop finding 
00468     //- angles for corner picking.  It steps the list.
00469 
00470     CubitStatus reorient_loop( int start_offset );
00471     //- Reorients the global loop (outerCoEdgeLoop) so that it starts at the beginning.
00472 
00473     CubitStatus shuffle_corners_forward();
00474     //- This shuffles the outer loop, side interval and corner array forward
00475     //- by sideInterval[0] (ie., useful when changing the split direction for
00476     //- a single surface).
00477 
00478     CubitStatus shuffle_zero_side_forward();
00479     //- This shuffles the zero interval side (present on triangles) forward.
00480     //- Side interval and corner array affected.  This function is necessary
00481     //- if user specifies a 'direction' or 'from' curve when splitting a triangle.
00482 
00483     CubitStatus populate_curve_loops();
00484     //- Populates the CoEdge lists in the surface tooldatas.  The CoEdge lists
00485     //- are organized by side of the logical rectangle on each surface in
00486     //- refFaceChain.
00487 
00488     CubitBoolean is_edge_in_list( RefEdge *ref_edge_ptr, DLIList<CoEdge*> &co_edge_list );
00489     //- Determines if the given RefEdge is the child of any of the CoEdges in co_edge_list
00490 
00491     CubitStatus check_face_loop( RefFace *ref_face_ptr, CubitBoolean &is_loop );
00492     //- Checks a single surface to see if it is a loop.
00493 
00494     CubitStatus check_for_loop( RefFace *ref_face_ptr1, RefFace *ref_face_ptr2, 
00495                                 CubitBoolean &is_loop, 
00496                                 CoEdge *&start_co_edge_ptr );
00497     //- Checks a two-surface chain to see if it is a loop.  If it is a loop, it can
00498     //- return the starting coedge as well (warning - if not a loop, the starting 
00499     //- coedge is not set).
00500 
00501     CubitStatus ordered_co_edges( RefFace *ref_face_ptr, DLIList<CoEdge*> &co_edge_list );
00502     //- Get an ordered list of coedges from the RefFace.  The RefFace must only
00503     //- contain one loop.
00504 
00505     CoEdge *get_next_co_edge( CoEdge *prev_co_edge_ptr, DLIList<CoEdge*> &co_edge_list );
00506     //- Given the previous CoEdge, get the next CoEdge using the CoEdges in 
00507     //- the given list.
00508 
00509     RefVertex *start_vertex( CoEdge *co_edge_ptr );
00510     //- Get the starting vertex of the given CoEdge.
00511 
00512     RefVertex *end_vertex( CoEdge *co_edge_ptr );
00513     //- Get the ending vertex of the given CoEdge.
00514 
00515     CoEdge *get_complimentary_co_edge( CoEdge *co_edge_ptr, 
00516                                        DLIList<CoEdge*> co_edge_list );
00517     //- Find the CoEdge from co_edge_list that shares a common RefEdge with
00518     //- the input co_edge_ptr.  Returns NULL if no complimentary CoEdge is
00519     //- found.  Note the input co_edge_list is copied so that it's list 
00520     //- position is not changed.
00521 
00522     CubitStatus get_attached_coedges_start( CoEdge *co_edge_ptr,
00523                                             DLIList<CoEdge*> &co_edge_list,
00524                                             DLIList<CoEdge*> &attached_co_edge_list );
00525     //- Get coedges from co_edge_list whose start vertices are attached to the start 
00526     //- vertex of co_edge_ptr
00527 
00528     CubitStatus remove_other_corner_coedges( CoEdge *co_edge_1, CoEdge *co_edge_2, 
00529                                              DLIList<CoEdge*> &all_co_edge_list,
00530                                              DLIList<CoEdge*> &att_co_edge_list );
00531     //- For isLoop situation, removes CoEdges from the "attached_co_edge_list" 
00532     //- that are connected to the other shared corner.  The inputs are the 
00533     //- previous and next CoEdges surrounding this (not the other) corner.
00534 
00535     CubitStatus add_tooldata( DLIList<CoEdge*> &co_edge_list, int vertex_type );
00536     //- Add a tooldata to each of the CoEdges in co_edge_list containing the 
00537     //- vertex_type at the start of the CoEdge.
00538 
00539     CubitBoolean is_vertex_on_side( RefVertex *ref_vertex_ptr, int side );
00540     //- Determines if the given vertex lies on the given side.  Note the
00541     //- vertex is checked spatially, not literally as if in the vertices
00542     //- in the outer loop.
00543 
00544     CubitBoolean is_vertex_in_surface( RefVertex *ref_vertex_ptr, RefFace *ref_face );
00545     //- Determines if the given vertex is in the given RefFace.
00546 
00547     CubitBoolean is_curve_in_outer_loop( RefEdge *ref_edge_ptr );
00548     //- Determines if the given curve lies in the outer loop of curves.
00549 
00550     CubitBoolean is_curve_on_side( RefEdge *ref_edge_ptr, int side );
00551     //- Determines if the given curve lies on the given side.
00552 
00553     CubitBoolean is_chain_two_triangles();
00554     //- Determines wheither the chain of surfaces is actually two connected
00555     //- triangles (see diagram in function).
00556 
00557     CubitBoolean is_triangle();
00558     //- Determines if a single surface chain is a triangle
00559 
00560     CubitStatus check_through_vertices( const char *type );
00561     //- Determines if the through vertices are on valid sides of the surface.
00562     //- Call this function after adjusting for a Curve direction.
00563     //- This function only checks - it gives an error if through vertices are 
00564     //- on invalid sides.  Type is either "direction" or "from", for the error
00565     //- message ("direction" if the direction exists and was checked previously, 
00566     //- "from" if only a from curve was given).
00567 
00568     CoEdge* prev_co_edge( CoEdge *co_edge_ptr );
00569     //- From the outerCoEdgeLoop, get the CoEdge previous to the one given.
00570 
00571     CubitStatus position_co_edge_list( int i, DLIList<CoEdge*> &co_edge_list );
00572     //- Position the co_edge_list to the start of the loop
00573 
00574     CubitStatus get_a_coedges( DLIList<CoEdge*> &co_edge_list, 
00575                                DLIList<CoEdge*> &a_coedges );
00576     CubitStatus get_b_coedges( DLIList<CoEdge*> &co_edge_list, 
00577                                DLIList<CoEdge*> &b_coedges );
00578     CubitStatus get_c_coedges( DLIList<CoEdge*> &co_edge_list, 
00579                                DLIList<CoEdge*> &c_coedges );
00580     CubitStatus get_d_coedges( DLIList<CoEdge*> &co_edge_list, 
00581                                int num_so_far, DLIList<CoEdge*> &d_coedges );
00582     //- These functions find the coedges on each side of the logical rectangle,
00583     //- using the vertex classifications
00584 
00585     CubitStatus find_spline_curves( RefFace *ref_face_ptr, int num_segs, 
00586                                     double distance, 
00587                                     DLIList<Curve*> *curve_list_ptr,
00588                                     double tolerance,
00589                                     CubitBoolean parametric_flg = CUBIT_FALSE,
00590                                     CubitBoolean preview_flg = CUBIT_FALSE,
00591                                     CubitBoolean create_ref_edges_flg = CUBIT_FALSE );
00592     //- Uses a mapping algorithm to calculate the interior points to pass
00593     //- spline(s) through and creates the Curve(s) for the surface.  By default, 
00594     //- it will do the mapping in the 3D space of the surface.  It can be
00595     //- overridden to use the parametric space if a surface parametric space
00596     //- exists.  If preview_flg is TRUE, then the interior spline points are
00597     //- drawn for the user to query.  This setting, along with the create_ref_edges_flg
00598     //- also helps to determine whether to project the curves to the surface.
00599     //- In OCC, projecting is very slow, so we skip it when previewing; however
00600     //- we use it if the user is ultimately creating RefEdges (note the RefEdges
00601     //- will not be created within this function).
00602 
00603     CubitStatus fill_boundary_coords( TDSplitSurface *tdss, int nr, int nc, 
00604                                       CubitVector ***coords );
00605     //- Fills the boundary array for the mapping algorithm in 3D
00606 
00607     CubitStatus draw_boundary_coords( TDSplitSurface *tdss );
00608     //- Debug function - just draws the coords for each side, if debug 100 is on
00609 
00610     CubitStatus smooth_interior_coords( RefFace *ref_face_ptr,
00611                                         TDSplitSurface *tdss,
00612                                         double tolerance,
00613                                         int nr, int nc, double distance,
00614                                         CubitVector ***coords );
00615     //- Smooths the interior coords in 3D so that the split location is correct.
00616     //- Respect distance if not -1.0.
00617 
00618     CubitStatus fill_interior_coords( TDSplitSurface *tdss, int nr, int nc,
00619                                       CubitVector ***coords );
00620     //- Fills the interior coordinates using a mapping algorithm in 3D
00621 
00622     CubitVector *make_interior_coord( CubitVector ***coords, int nr, int nc,
00623                                       double ada, double tse, int j, int i );
00624     //- Calculates an interior coordinate using the mapping algorithm in 3D
00625 
00626     CubitStatus fill_boundary_coords( TDSplitSurface *tdss, int nr, int nc, 
00627                                       Cubit2DPoint ***coords );
00628     //- Fills the boundary array for the mapping algorithm in 2D
00629 
00630     Cubit2DPoint *get_uv_point( RefFace *ref_face_ptr, CubitVector *vec_ptr );
00631     //- Given an input 3D point gets a UV point on the given surface
00632 
00633     CubitStatus fill_interior_coords( TDSplitSurface *tdss, int nr, int nc,
00634                                       Cubit2DPoint ***coords );
00635     //- Fills the interior coordinates using a mapping algorithm in 2D
00636 
00637     CubitStatus get_tse_array( TDSplitSurface *tdss, int tse_ints,
00638                                DLIList<double> &tse_array );
00639     //- For the mapping algorithm, finds an array of tse which are the
00640     //- average fractional distances across the AC direction of the surface
00641 
00642     Cubit2DPoint *make_interior_coord( Cubit2DPoint ***coords, int nr, int nc,
00643                                        double ada, double tse, int j, int i );
00644     //- Calculates an interior coordinate using the mapping algorithm in 2D
00645 
00646     CubitStatus draw_points( DLIList<CubitVector*> &pnt_list, int color, 
00647                              int flush = CUBIT_TRUE );
00648     CubitStatus draw_point( CubitVector &pnt, int color, int flush = CUBIT_FALSE );
00649     //- Draw points
00650 
00651     CubitStatus draw_preview( Curve *curve_ptr, CubitBoolean flush=CUBIT_TRUE,
00652       int color=CUBIT_BLUE_INDEX );
00653     //- Draw the curves
00654 
00655     CubitStatus create_ref_edges( DLIList<Curve*> &curve_list, 
00656                                   DLIList<RefEdge*> &ref_edge_list );
00657     //- Create RefEdges from the given Curves.  Appends to the output list.
00658 
00659     int number_coedges( RefEdge *ref_edge_ptr, RefFace *ref_face_ptr );
00660     //- Finds the number of coedges for the given edge on the given surface
00661 
00662     void delete_surf_tooldatas( DLIList<RefFace*> &ref_face_list );
00663     //- Deletes tooldatas from the given ref_face_list
00664 
00665     void delete_coedge_tooldatas( DLIList<CoEdge*> &co_edge_list );
00666     //- Deletes tooldatas from the given co_edge_list
00667 
00668     void delete_vertex_tooldatas( DLIList<RefVertex*> &ref_vertex_list );
00669     //- Deletes tooldatas from the given ref_vertex_list
00670 
00671     void list_sides_debug();
00672     //- Lists the sides for debugging purposes
00673 
00674     CubitBoolean check_points_straight( Surface *surf_ptr,
00675                                         DLIList<CubitVector*> &point_list,
00676                                         double tolerance );
00677     //- Check to see if the points approximate a straight line, within
00678     //- tolerance.  Also, if surface is not a plane, all points are projected
00679     //- to the resultant line and checked to make sure they lie within resabs
00680     //- (GEOMETRY_RESABS or a user specified tolerance) to the surf_ptr so
00681     //- that an imprint will be successful.  If only two points are input, 
00682     //- additional locations along the line are checked.
00683 
00684     Curve* check_points_arc( Surface *surf_ptr,
00685                              GeometryModifyEngine *gme, 
00686                              DLIList<CubitVector*> &point_list,
00687                              double resabs,
00688                              double tolerance );
00689     //- Check to see if the input points approximate an arc.  If there are
00690     //- only two input points, try to create an arc if the surface is a
00691     //- cone, sphere or torus.
00692 
00693     Curve* check_if_arc( GeometryModifyEngine *gme,
00694                          Surface *surf_ptr,
00695                          DLIList<CubitVector*> &point_list,
00696                          CubitVector &start_pnt,
00697                          CubitVector &mid_pnt,
00698                          CubitVector &end_pnt,
00699                          double resabs,
00700                          double tolerance,
00701                          double &deviation );
00702     //- Supplemental function for check_points_arc.  This function can be
00703     //- called multiple times from check_points_arc as we try to iterate
00704     //- to a solution.
00705 
00706     CubitStatus get_arc_mid_pnt( Surface *surf_ptr,
00707                                  CubitVector &start_pnt,
00708                                  CubitVector &end_pnt,
00709                                  CubitVector &mid_pnt,
00710                                  double tolerance );
00711     //- Given the start and end points, and the surface, this function finds
00712     //- a third point on the arc.
00713 
00714     Curve* create_arc_two( GeometryModifyEngine *gme,
00715                            Surface *surf_ptr,
00716                            CubitVector &start_pnt,
00717                            CubitVector &end_pnt,
00718                            double resabs,
00719                            double tolerance );
00720     //- Given the surface and two points, attempt to find an arc that lies
00721     //- on the surface.
00722 
00723     Curve* create_arc_three( GeometryModifyEngine *gme,
00724                              Surface *surf_ptr,
00725                              CubitVector &start_pnt,
00726                              CubitVector &mid_pnt,
00727                              CubitVector &end_pnt,
00728                              double resabs );
00729     //- Given the surface and three points, attempt to find an arc that lies
00730     //- on the surface.
00731 
00732     CubitStatus reflect_arc_pnt( CubitVector &vec1,
00733                                  CubitVector &vec2,
00734                                  CubitVector &vec3,
00735                                  CubitVector &pnt_to_reflect,
00736                                  CubitVector &out_pnt );
00737     //- Given three points and another input point, create an arc and
00738     //- reflect the input point about the arc center.
00739 
00740     CubitBoolean is_point_on_surface( Surface *surf_ptr, CubitVector &pnt, 
00741                                       double resabs );
00742     //- Determine if the input point is within the given resabs of the surface.
00743 
00744     int count_surfaces_in_owning_body( RefFace *ref_face_ptr, Body *&body_ptr );
00745     //- Returns: Number of surfaces in the owning body of the RefFace
00746     //-          -1 - RefFace is free (no owning body)
00747     //-          -2 - RefFace is owned by more than one body
00748     //- Also returns the owning body via argument list
00749 
00750     int count_surfaces_in_body( Body *body_ptr );
00751     //- Return number of surfaces in the body
00752 
00753     int count_curves_in_body( Body *body_ptr );
00754     //- Return number of curves in the body
00755 
00756     void cleanup_for_extend_op( DLIList<RefVertex*> &ref_vertex_list,
00757       DLIList<DLIList<Surface*>*> &body_surf_list_list,
00758       DLIList<DLIList<DLIList<Curve*>*>*> &curve_lists_lists_list,
00759       CubitBoolean free_curves_flg = CUBIT_TRUE );
00760     //- This function cleans up after the split extend operation.  It removes
00761     //- the tooldatas from the vertices and frees the lists memory.  If
00762     //- free_curves_flg is CUBIT_TRUE, free the Curves as well (however, the 
00763     //- function checks if a RefEdge is attached to the Curve - if a RefEdge
00764     //- is attached the Curve is not freed).
00765 
00766     void find_nearest_curve_for_normal_projection(
00767         RefEdge* hit_edge_ptr, CubitVector& start_loc, RefFace* face, 
00768         CubitVector& ray_dir, RefEdge*& new_edge_ptr, CubitVector& new_end_loc);
00769     //- This function is used when the split extend command is used with normal = TRUE and
00770     //- the hardline does not intersect the curve found by fire_ray at a 90 degree angle.
00771     //- This function traverses the curve's neighbors to find a curve that can be split normal.
00772 
00773     static CubitBoolean parametricFlg; // Split parametrically or not (3D)
00774     static double splitTolerance; // Length tolerance for tessellations, etc.
00775     static CubitBoolean autoDetectTriangles; // Detect triangles automatically?
00776     static double sideAngleThreshold;  // Closest corner within this threshold
00777                                        // to 180 is removed (if pointAngleThreshold
00778                                        // criteria also met)
00779     static double pointAngleThreshold; // Corner with angle below this becomes
00780                                        // the triangle point (if sideAngleThreshold
00781                                        // criteria also met)
00782 
00783     static double extendGapThreshold; // Only gaps below this value are split
00784     static CubitBoolean extendNormalFlg; // If true, extend normal to curve 
00785                                          // instead of in curve direction if 
00786                                          // distance is less
00787     static double extendTolerance; // If split end is equal or closer than this
00788                                    // to a vertex along a curve snap to the
00789                                    // vertex.
00790 
00791     DLIList<RefFace*> refFaceChain;
00792     DLIList<RefVertex*> throughVertexList;
00793     DLIList<CoEdge*> outerCoEdgeLoop;
00794     CoEdge *cornerCoEdge[4]; // Corner at start of given CoEdge
00795     CubitBoolean isLoop; // A continuous loop of surfaces?
00796     int sideInterval[4];
00797 };
00798 
00799 inline void
00800 SplitSurfaceTool::set_tolerance( double tol )
00801 { splitTolerance = tol; }
00802 
00803 inline double
00804 SplitSurfaceTool::get_tolerance()
00805 { return splitTolerance; }
00806 
00807 inline void
00808 SplitSurfaceTool::set_auto_detect_triangles_flg( CubitBoolean flg )
00809 { autoDetectTriangles = flg; }
00810 
00811 inline CubitBoolean
00812 SplitSurfaceTool::get_auto_detect_triangles_flg()
00813 { return autoDetectTriangles; }
00814 
00815 inline void
00816 SplitSurfaceTool::set_side_angle_threshold( double tol )
00817 { sideAngleThreshold = tol; }
00818 
00819 inline double
00820 SplitSurfaceTool::get_side_angle_threshold()
00821 { return sideAngleThreshold; }
00822 
00823 inline void
00824 SplitSurfaceTool::set_point_angle_threshold( double tol )
00825 { pointAngleThreshold = tol; }
00826 
00827 inline double
00828 SplitSurfaceTool::get_point_angle_threshold()
00829 { return pointAngleThreshold; }
00830 
00831 inline void
00832 SplitSurfaceTool::set_parametric_flg( CubitBoolean parametric_flg )
00833 { parametricFlg = parametric_flg; }
00834 
00835 inline CubitBoolean
00836 SplitSurfaceTool::get_parametric_flg()
00837 { return parametricFlg; }
00838 
00839 inline void
00840 SplitSurfaceTool::set_extend_gap_threshold( double gap )
00841 { extendGapThreshold = gap; }
00842 
00843 inline double
00844 SplitSurfaceTool::get_extend_gap_threshold()
00845 { return extendGapThreshold; }
00846 
00847 inline void
00848 SplitSurfaceTool::set_extend_tolerance( double tol )
00849 { extendTolerance = tol; }
00850 
00851 inline double
00852 SplitSurfaceTool::get_extend_tolerance()
00853 { return extendTolerance; }
00854 
00855 inline void
00856 SplitSurfaceTool::set_extend_normal_flg( CubitBoolean extend_normal_flg )
00857 { extendNormalFlg = extend_normal_flg; }
00858 
00859 inline CubitBoolean
00860 SplitSurfaceTool::get_extend_normal_flg()
00861 { return extendNormalFlg; }
00862 
00863 #endif
00864 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines