LCOV - code coverage report
Current view: top level - geom/OCC/cgm - OCCCurve.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 6 6 100.0 %
Date: 2020-06-30 00:58:45 Functions: 5 5 100.0 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : //-------------------------------------------------------------------------
       2                 :            : // Filename      : OCCCurve.hpp
       3                 :            : //
       4                 :            : // Purpose       : 
       5                 :            : //
       6                 :            : // Special Notes :
       7                 :            : //
       8                 :            : // Creator       : Steven J. Owen
       9                 :            : //
      10                 :            : // Creation Date : 07/14/00
      11                 :            : //
      12                 :            : // Owner         : Steven J. Owen
      13                 :            : //-------------------------------------------------------------------------
      14                 :            : 
      15                 :            : #ifndef CURVE_OCC_HPP
      16                 :            : #define CURVE_OCC_HPP
      17                 :            : 
      18                 :            : // ********** BEGIN STANDARD INCLUDES      **********
      19                 :            : // ********** END STANDARD INCLUDES        **********
      20                 :            : // ********** BEGIN CUBIT INCLUDES         **********
      21                 :            : #include "CubitDefines.h"
      22                 :            : #include "Curve.hpp"
      23                 :            : #include "TopoDS_Edge.hxx"
      24                 :            : // ********** END CUBIT INCLUDES           **********
      25                 :            : 
      26                 :            : // ********** BEGIN FORWARD DECLARATIONS   **********
      27                 :            : class TopologyEntity;
      28                 :            : class OCCAttrib;
      29                 :            : class TBPoint;
      30                 :            : 
      31                 :            : class OCCBody;
      32                 :            : class OCCLump;
      33                 :            : class OCCShell;
      34                 :            : class OCCSurface;
      35                 :            : class OCCLoop;
      36                 :            : class OCCPoint;
      37                 :            : class BRepBuilderAPI_ModifyShape; 
      38                 :            : class BRepAlgoAPI_BooleanOperation;
      39                 :            : // ********** END FORWARD DECLARATIONS     **********
      40                 :            : 
      41                 :            : class OCCCurve : public Curve
      42                 :            : {
      43                 :            : public :
      44                 :            :   
      45                 :            :   OCCCurve( TopoDS_Edge* theEdge );
      46                 :            :   
      47                 :            :   virtual ~OCCCurve() ;
      48                 :            :     //- The destructor
      49                 :            : 
      50                 :       6698 :   void set_myMarked( CubitBoolean marked) {myMarked = marked;}
      51                 :            : 
      52                 :            :   void add_loop(OCCLoop* loop);   
      53                 :     436072 :   DLIList<OCCLoop*> loops() {return myLoopList;}
      54                 :      81374 :   void remove_loop(OCCLoop* loop) {myLoopList.remove(loop);}
      55                 :      43946 :   void clean_loops(){myLoopList.clean_out();}
      56                 :            : 
      57                 :            :   virtual void append_simple_attribute_virt(const CubitSimpleAttrib&);
      58                 :            :     //R void
      59                 :            :     //I 
      60                 :            :     //I- 
      61                 :            :     //I- that is to be appended to this OSME object.
      62                 :            :     //- The purpose of this function is to append a 
      63                 :            :     //- attribute to the OSME. The  is attached to each of the 
      64                 :            :     //- underlying solid model entities this one points to.
      65                 :            :   
      66                 :            :   virtual void remove_simple_attribute_virt(const CubitSimpleAttrib&);
      67                 :            :     //R void
      68                 :            :     //I CubitSimpleAttrib*
      69                 :            :     //I- A reference to a CubitSimpleAttrib object which is the object
      70                 :            :     //I- that is to be removed to this OSME object.
      71                 :            :     //- The purpose of this function is to remove a simple
      72                 :            :     //- attribute from the OSME. The attribute is attached to each of the
      73                 :            :     //- underlying solid model entities this one points to.
      74                 :            :   
      75                 :            :   virtual void remove_all_simple_attribute_virt();
      76                 :            :     //R void
      77                 :            :     //I-
      78                 :            :     //- The purpose of this function is to remove all simple
      79                 :            :     //- attributes from the OSME. 
      80                 :            :   
      81                 :            :   virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib>&);
      82                 :            :   virtual CubitStatus get_simple_attribute(const CubitString& name,
      83                 :            :                                            DLIList<CubitSimpleAttrib>&);
      84                 :            :     //R CubitSimpleAttrib*
      85                 :            :     //R- the returned cubit simple attribute.
      86                 :            :     //- The purpose of this function is to get the attributes
      87                 :            :     //- of the geometry entity. The name is attached to the underlying solid
      88                 :            :     //- model entity(ies) this one points to.
      89                 :            :     //- MJP Note:
      90                 :            :     //- This is the code that implements the requirement that names
      91                 :            :     //- of VGI Entities propagate across solid model boolean
      92                 :            :     //- operations.  The success of this relies, of course, on the underlying
      93                 :            :     //- solid modeler being able to propagate attributes across
      94                 :            :     //- such operations on its entities. If it cannot, then "names"
      95                 :            :     //- of VGI entities will not propagate.
      96                 :            :   
      97                 :            :   virtual CubitBox bounding_box() const ;
      98                 :            :     //- see comments in GeometryEntity.hpp
      99                 :            :   
     100                 :            :   virtual GeometryQueryEngine* 
     101                 :            :   get_geometry_query_engine() const;
     102                 :            :     //R GeometryQueryEngine*
     103                 :            :     //R- A pointer to the geometric modeling engine associated with
     104                 :            :     //R- the object.
     105                 :            :     //- This function returns a pointer to the geometric modeling engine
     106                 :            :     //- associated with the object.
     107                 :            :   
     108                 :            :   virtual double measure();
     109                 :            :     //R double
     110                 :            :     //R- The numeric value of the measure (its units depend on the dimension
     111                 :            :     //R- of the RefEntity being "measured")
     112                 :            :     //- A generic geometric extent function.
     113                 :            :     //- Returns volume for Lump, area for Surface, length for Curve and 
     114                 :            :     //- 1.0 for Point
     115                 :            :     //-
     116                 :            :     //- If there is an error computing the length a value of -1.0 is
     117                 :            :     //- returned.
     118                 :            :   
     119                 :            :   virtual double length_from_u( double parameter1,
     120                 :            :                                 double parameter2 );
     121                 :            :     //R double
     122                 :            :     //R- Returned length value
     123                 :            :     //I parameter1
     124                 :            :     //I- The first parameter value
     125                 :            :     //I parameter2
     126                 :            :     //I- The second parameter value
     127                 :            :     //- This function returns the arc length along the Curve starting from
     128                 :            :     //- the point represented by the parameter1 going to the point represented
     129                 :            :     //- by parameter2.
     130                 :            :     //-
     131                 :            :     //- The sign of the returned length value is always positive.
     132                 :            :   
     133                 :            :   virtual CubitBoolean is_periodic( double& period);
     134                 :            :     //R CubitBoolean
     135                 :            :     //R- CUBIT_TRUE/CUBIT_FALSE
     136                 :            :     //O period
     137                 :            :     //O- Returned period value
     138                 :            :     //- This function determines whether the underlying geometry of the
     139                 :            :     //- Curve is periodic or not.  Returns CUBIT_TRUE if it is and 
     140                 :            :     //- CUBIT_FALSE if it is not.
     141                 :            :     //-
     142                 :            :     //- If it is periodic, then it returns the period in the input
     143                 :            :     //- reference variable, "period". This value is set to 0.0 if
     144                 :            :     //- the Curve is not periodic.
     145                 :            :     //- 
     146                 :            :   
     147                 :            :   virtual CubitBoolean get_param_range( double& lower_bound,
     148                 :            :                                         double& upper_bound );
     149                 :            :     //R CubitBoolean
     150                 :            :     //R- CUBIT_TRUE/CUBIT_FALSE
     151                 :            :     //O lower_bound
     152                 :            :     //O- The lower bound of the parametric range.
     153                 :            :     //O upper_bound
     154                 :            :     //O- The upper bound of the parametric range.
     155                 :            :     //- Returns the lower and upper parametric bounds of the 
     156                 :            :     //- Curve.
     157                 :            :     //-
     158                 :            :     //- IMPORTANT NOTE:
     159                 :            :     //- Note that the lower bound is the parameter value of the start
     160                 :            :     //- location of the RefEdge that uses this Curve and the upper
     161                 :            :     //- bound is the parameter value of the end location of the RefEdge
     162                 :            :     //- that uses this Curve.  This takes into account the sense of the
     163                 :            :     //- RefEdge with respect to the Curve (which could be REVERSED).
     164                 :            :     //- Hence, the numerical value of the lower parameter bound could be
     165                 :            :     //- greater than that of the upper parameter bound.
     166                 :            :   
     167                 :            :   virtual CubitStatus get_interior_extrema(DLIList<CubitVector*>& interior_points,
     168                 :            :                                            CubitSense& return_sense);
     169                 :            :     //- Finds the extrema along this RefEdge.  An extremum is defined as
     170                 :            :     //- a local min or max in the direction of one of the primary axial directions.
     171                 :            :     //- O-interior_points: list of coordinates where the extrema occur.
     172                 :            :     //- O-return_sense: Whether the interior extrema are ordered in the
     173                 :            :     //-                 FORWARD or REVERSED direction of this RefEdge.
     174                 :            :     //-
     175                 :            :     //- ***IMPORTANT!!!***
     176                 :            :     //-    This function dynamically allocates the CubitVectors appended to
     177                 :            :     //-    interior_points.  It is the responsibility of the calling code to
     178                 :            :     //-    delete these CubitVectors (or in the case of RefEdge, to make sure
     179                 :            :     //-    that *it's* calling code knows that it should delete the CubitVectors)!
     180                 :            :   
     181                 :            :   CubitStatus get_interior_extrema_in_direction(DLIList<CubitVector*>&,
     182                 :            :                                                 CubitVector);
     183                 :            : 
     184                 :            :   virtual CubitStatus closest_point( CubitVector const& location, 
     185                 :            :                                      CubitVector& closest_location,
     186                 :            :                                      CubitVector* tangent_ptr = NULL,
     187                 :            :                                      CubitVector* curvature_ptr = NULL,
     188                 :            :                                      double *param = NULL);
     189                 :            :     //R void
     190                 :            :     //I location
     191                 :            :     //I- The point to which the closest point on the Curve is desired.
     192                 :            :     //O closest_location
     193                 :            :     //O- The point on the Curve, closest to the input location which
     194                 :            :     //O- might not be on the Curve.  This is input as a reference 
     195                 :            :     //O- so that the function can modify its contents.
     196                 :            :     //O tangent_ptr
     197                 :            :     //O- The tangent to the Curve (output as a unit vector) at the 
     198                 :            :     //O- closest_location.
     199                 :            :     //O curvature_ptr
     200                 :            :     //O- The curvature of the Curve at the closest_location.
     201                 :            :     //- This function computes the point on the Curve closest to the input 
     202                 :            :     //- location.
     203                 :            :     //-
     204                 :            :     //- If the tangent and/or curvature is required, then the calling code
     205                 :            :     //- is responsible for allocating space for the CubitVector(s) and
     206                 :            :     //- sending in the relevant non-NULL pointers.  If either of these
     207                 :            :     //- pointers is NULL, the related quantity is not computed.
     208                 :            :     //-
     209                 :            :     //- Notes:
     210                 :            :     //- The tangent direction is always in the positive direction of the 
     211                 :            :     //- *owning RefEdge*, regardless of the positive direction of the
     212                 :            :     //- underlying solid model entities.
     213                 :            :   
     214                 :            :   void get_tangent( CubitVector const& location, 
     215                 :            :                     CubitVector& tangent);
     216                 :            :     //- this function returns the tangent vector at the given location
     217                 :            :   
     218                 :            :   void get_curvature( CubitVector const& location, 
     219                 :            :                       CubitVector& curvature);
     220                 :            :     //- this function returns the curvature vector at the given location
     221                 :            :   
     222                 :            :   virtual CubitStatus position_from_u (double u_value,
     223                 :            :                                        CubitVector& output_position);
     224                 :            :     //R CubitStatus
     225                 :            :     //R- CUBIT_SUCCESS/FAILURE
     226                 :            :     //I u_value
     227                 :            :     //I- The input u parameter value
     228                 :            :     //O output_position
     229                 :            :     //O- The output position
     230                 :            :     //- This function returns the coordinates of a point in the global
     231                 :            :     //- (world) space that corresponds to the input parametric position 
     232                 :            :     //- in the local space.
     233                 :            :     //-
     234                 :            :     //- If the input parameter value is not defined for the Curve, then 
     235                 :            :     //- the input CubitVector is not modified and CUBIT_FAILURE is
     236                 :            :     //- returned. Otherwise, position is appropriately modified and
     237                 :            :     //- CUBIT_SUCCESS is returned.
     238                 :            :     //-
     239                 :            :     //- If the curve is periodic, the input u_value is first "normalized"
     240                 :            :     //- to the fundamental period of the Curve before its position
     241                 :            :     //- in global space is determined.
     242                 :            :   
     243                 :            :   double u_from_position (const CubitVector& input_position);
     244                 :            :   
     245                 :            :   virtual double u_from_arc_length ( double root_param,
     246                 :            :                                      double arc_length );
     247                 :            :     //R double
     248                 :            :     //R- Returned parameter value
     249                 :            :     //I root_param
     250                 :            :     //I- The parameter value of the "root point"
     251                 :            :     //I arc_length
     252                 :            :     //I- A distance along the Curve
     253                 :            :     //- This function returns the parameter value of the point that is
     254                 :            :     //- "arc_length" away from the root point in the
     255                 :            :     //- positive sense direction of the owning RefEdge.
     256                 :            :     //-
     257                 :            :     //- If arc_length is negative, the new point (whose parameter value is
     258                 :            :     //- being computed) is in the negative sense direction (along the 
     259                 :            :     //- RefEdge) from the root point (whose parameter value is root_param).
     260                 :            :   
     261                 :            :   virtual CubitBoolean is_position_on( const CubitVector &test_position );
     262                 :            :     //R CubitBoolean
     263                 :            :     //R- CUBIT_TRUE/CUBIT_FALSE
     264                 :            :     //I CubitVector
     265                 :            :     //I- position, point where we want to test, whether or not it
     266                 :            :     //- is on the curve.
     267                 :            :   
     268                 :            :   GeometryType geometry_type();
     269                 :            :     //R GeometryType (enum)
     270                 :            :     //R- The enumerated type of the geometric representation
     271                 :            :   
     272                 :            :   CubitStatus get_point_direction( CubitVector& origin, CubitVector& direction );
     273                 :            :   //- Only valid for straight lines
     274                 :            :   //- Finds the underlying line's origin and direction unit vector
     275                 :            :   //- Returns CUBIT_FAILURE if curve is not a line
     276                 :            : 
     277                 :            :   CubitStatus get_center_radius( CubitVector& center, double& radius );
     278                 :            :   //- Only valid for arcs
     279                 :            :   //- Finds the underlying arc's center point and radius
     280                 :            :   //- Returns CUBIT_FAILURE if curve is not an arc
     281                 :            : 
     282                 :            :   virtual double start_param();
     283                 :            :     //R double parameter
     284                 :            :     //R- start parameter of curve with respect to refEdge.
     285                 :            :   
     286                 :            :   virtual double end_param();
     287                 :            :     //R double parameter
     288                 :            :     //R- start parameter of curve with respect to refEdge.
     289                 :            :     
     290                 :            :   virtual CubitBoolean G1_discontinuous( double param,
     291                 :            :                                          CubitVector* minus_tangent = NULL,
     292                 :            :                                          CubitVector* plus_tangent = NULL );
     293                 :            :   
     294                 :            :   virtual CubitPointContainment point_containment( const CubitVector &point );
     295                 :            :     //R CubitPointContainment - is the point outside, inside or on the boundary?
     296                 :            :     //R- CUBIT_PNT_OUTSIDE, CUBIT_PNT_INSIDE, CUBIT_PNT_BOUNDARY, 
     297                 :            :     //   CUBIT_PNT_UNKNOWN
     298                 :            :     //I CubitVector
     299                 :            :     //I- position to check, known to be on the Surface
     300                 :            :     //I double
     301                 :            :     //I- u coordinate, if known (significantly faster, if this is known - however
     302                 :            :     //                           if not known let the function figure it out)
     303                 :            :     //I double
     304                 :            :     //I- v coordinate, if known (significantly faster, if this is known - however
     305                 :            :     //                           if not known let the function figure it out)
     306                 :            :     // NOTE: POINT MUST LIE ON THE SURFACE FOR THIS FUNCTION TO WORK PROPERLY.
     307                 :            : 
     308                 :            :   virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
     309                 :            :   virtual void get_children_virt( DLIList<TopologyBridge*>& children );
     310                 :            : 
     311                 :            :   //R CubitStatus
     312                 :            :   //O- true or false if spline is rational or not.
     313                 :            :   //O- the degree of this spline
     314                 :            :   //O- the control points
     315                 :            :   //O- If rational, weight for each control point
     316                 :            :   //O- the knots
     317                 :            :   virtual CubitStatus get_spline_params( bool &rational,
     318                 :            :                                          int &degree,
     319                 :            :                                          DLIList<CubitVector> &cntrl_pts,
     320                 :            :                                          DLIList<double> &cntrl_pt_weights,
     321                 :            :                                          DLIList<double> &knots
     322                 :            :                                        ) const;
     323                 :            : 
     324                 :            :   //R CubitStatus
     325                 :            :   //O- center - ellipse center point
     326                 :            :   //O- normal - normal of the plane of the ellipse
     327                 :            :   //O- major_axis - major axis of the ellipse
     328                 :            :   //O- radius_ratio - ratio of the length of the major to minor axis.
     329                 :            :   virtual CubitStatus get_ellipse_params( CubitVector &center,
     330                 :            :                                           CubitVector &normal,
     331                 :            :                                           CubitVector &major_axis,
     332                 :            :                                           double &radius_ratio ) const;
     333                 :            : 
     334                 :            :   void get_points(DLIList<OCCPoint*>& point_list);
     335                 :            :     //- Gets the list of points describing this curve.
     336                 :            : 
     337                 :      53381 :   TopoDS_Edge *get_TopoDS_Edge( )
     338         [ -  + ]:      53381 :     { assert (myTopoDSEdge->ShapeType() == TopAbs_EDGE); return myTopoDSEdge; } 
     339                 :            :   void set_TopoDS_Edge(TopoDS_Edge edge);
     340                 :            : 
     341                 :            :   //ModifyShape refers to Transform and GTransform for now. (1/10/11)
     342                 :            :   void update_OCC_entity( BRepBuilderAPI_ModifyShape *aBRepTrsf,
     343                 :            :                           BRepAlgoAPI_BooleanOperation *op = NULL );
     344                 :            :  
     345                 :            :   Curve* project_curve(Surface* face_ptr,
     346                 :            :                        DLIList<TBPoint*>&  normal_proj_points,
     347                 :            :                        CubitBoolean closed,
     348                 :            :                        const CubitVector* third_point);
     349                 :            : 
     350                 :            :   virtual CubitStatus get_spline_params( bool &rational,
     351                 :            :                                          int &degree,
     352                 :            :                                          DLIList<CubitVector> &cntrl_pts,
     353                 :            :                                          DLIList<double> &cntrl_pt_weights,
     354                 :            :                                          DLIList<double> &knots, // There should be order+cntrl_pts.size()-2 knots
     355                 :            :                                          bool &spline_is_reversed
     356                 :            :                                        ) const;
     357                 :            : protected: 
     358                 :            :   
     359                 :            : private:
     360                 :            :   
     361                 :            :   void adjust_periodic_parameter(double& param);
     362                 :            :   
     363                 :            :   TopoDS_Edge *myTopoDSEdge;
     364                 :            :   DLIList<OCCLoop*> myLoopList;
     365                 :            :   CubitBoolean myMarked ;
     366                 :            : };
     367                 :            : 
     368                 :            : // ********** BEGIN INLINE FUNCTIONS       **********
     369                 :            : // ********** END INLINE FUNCTIONS         **********
     370                 :            : 
     371                 :            : // ********** BEGIN FRIEND FUNCTIONS       **********
     372                 :            : // ********** END FRIEND FUNCTIONS         **********
     373                 :            : 
     374                 :            : // ********** BEGIN EXTERN FUNCTIONS       **********
     375                 :            : // ********** END EXTERN FUNCTIONS         **********
     376                 :            : 
     377                 :            : #endif
     378                 :            : 

Generated by: LCOV version 1.11