1 // Created on: 1992-01-30 2 // Created by: Didier PIFFAULT 3 // Copyright (c) 1992-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _TopTrans_CurveTransition_HeaderFile 18 #define _TopTrans_CurveTransition_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <gp_Dir.hxx> 25 #include <Standard_Real.hxx> 26 #include <Standard_Boolean.hxx> 27 #include <TopAbs_Orientation.hxx> 28 #include <TopAbs_State.hxx> 29 #include <Standard_Integer.hxx> 30 class gp_Dir; 31 32 33 //! This algorithm is used to compute the transition 34 //! of a Curve intersecting a curvilinear boundary. 35 //! 36 //! The geometric elements are described locally at 37 //! the intersection point by a second order 38 //! development. 39 //! 40 //! The curve is described by the intersection point, 41 //! the tangent vector and the curvature. 42 //! 43 //! The boundary is described by a set of curve 44 //! elements, a curve element is either : 45 //! 46 //! - A curve. 47 //! 48 //! - A curve and an orientation called a half-curve, 49 //! the boundary of the curve is before or after the 50 //! intersection point depending on the orientation. 51 class TopTrans_CurveTransition 52 { 53 public: 54 55 DEFINE_STANDARD_ALLOC 56 57 58 //! Create an empty Curve Transition. 59 Standard_EXPORT TopTrans_CurveTransition(); 60 61 //! Initialize a Transition with the local description 62 //! of a Curve. 63 Standard_EXPORT void Reset (const gp_Dir& Tgt, const gp_Dir& Norm, const Standard_Real Curv); 64 65 //! Initialize a Transition with the local description 66 //! of a straigth line. 67 Standard_EXPORT void Reset (const gp_Dir& Tgt); 68 69 //! Add a curve element to the boundary. If Or is 70 //! REVERSED the curve is before the intersection, 71 //! else if Or is FORWARD the curv is after the 72 //! intersection and if Or is INTERNAL the 73 //! intersection is in the middle of the curv. 74 Standard_EXPORT void Compare (const Standard_Real Tole, const gp_Dir& Tang, const gp_Dir& Norm, const Standard_Real Curv, const TopAbs_Orientation S, const TopAbs_Orientation Or); 75 76 //! returns the state of the curve before the 77 //! intersection, this is the position relative to the 78 //! boundary of a point very close to the intersection 79 //! on the negative side of the tangent. 80 Standard_EXPORT TopAbs_State StateBefore() const; 81 82 //! returns the state of the curve after the 83 //! intersection, this is the position relative to the 84 //! boundary of a point very close to the intersection 85 //! on the positive side of the tangent. 86 Standard_EXPORT TopAbs_State StateAfter() const; 87 88 89 90 91 protected: 92 93 94 95 96 97 private: 98 99 100 //! Compare two curvature and return true if N1,C1 is 101 //! before N2,C2 in the edge orientation 102 Standard_EXPORT Standard_Boolean IsBefore (const Standard_Real Tole, const Standard_Real Angl, const gp_Dir& Nor1, const Standard_Real Cur1, const gp_Dir& Nor2, const Standard_Real Cur2) const; 103 104 //! Compare two angles at tolerance Tole 105 Standard_EXPORT Standard_Integer Compare (const Standard_Real Ang1, const Standard_Real Ang2, const Standard_Real Tole) const; 106 107 108 gp_Dir myTgt; 109 gp_Dir myNorm; 110 Standard_Real myCurv; 111 Standard_Boolean Init; 112 gp_Dir TgtFirst; 113 gp_Dir NormFirst; 114 Standard_Real CurvFirst; 115 TopAbs_Orientation TranFirst; 116 gp_Dir TgtLast; 117 gp_Dir NormLast; 118 Standard_Real CurvLast; 119 TopAbs_Orientation TranLast; 120 121 122 }; 123 124 125 126 127 128 129 130 #endif // _TopTrans_CurveTransition_HeaderFile 131