1 // Created on: 1993-01-09 2 // Created by: Kiran 3 // Copyright (c) 1993-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 _IGESGeom_BSplineCurve_HeaderFile 18 #define _IGESGeom_BSplineCurve_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_Type.hxx> 22 23 #include <Standard_Integer.hxx> 24 #include <Standard_Boolean.hxx> 25 #include <TColStd_HArray1OfReal.hxx> 26 #include <TColgp_HArray1OfXYZ.hxx> 27 #include <Standard_Real.hxx> 28 #include <gp_XYZ.hxx> 29 #include <IGESData_IGESEntity.hxx> 30 class gp_Pnt; 31 32 33 class IGESGeom_BSplineCurve; 34 DEFINE_STANDARD_HANDLE(IGESGeom_BSplineCurve, IGESData_IGESEntity) 35 36 //! defines IGESBSplineCurve, Type <126> Form <0-5> 37 //! in package IGESGeom 38 //! A parametric equation obtained by dividing two summations 39 //! involving weights (which are real numbers), the control 40 //! points, and B-Spline basis functions 41 class IGESGeom_BSplineCurve : public IGESData_IGESEntity 42 { 43 44 public: 45 46 47 Standard_EXPORT IGESGeom_BSplineCurve(); 48 49 //! This method is used to set the fields of the class 50 //! BSplineCurve. Beware about indexation of arrays 51 //! - anIndex : Upper index of the sum 52 //! - aDegree : Degree of basis functions 53 //! - aPlanar : 0 = nonplanar curve, 1 = planar curve 54 //! - aClosed : 0 = open curve, 1 = closed curve 55 //! - aPolynom : 0 = rational, 1 = polynomial 56 //! - aPeriodic : 0 = nonperiodic, 1 = periodic 57 //! - allKnots : Knot sequence values [-Degree,Index+1] 58 //! - allWeights : Array of weights [0,Index] 59 //! - allPoles : X, Y, Z coordinates of all control points 60 //! [0,Index] 61 //! - aUmin, aUmax : Starting and ending parameter values 62 //! - aNorm : Unit normal (if the curve is planar) 63 //! raises exception if allWeights & allPoles are not of same size. 64 Standard_EXPORT void Init (const Standard_Integer anIndex, const Standard_Integer aDegree, const Standard_Boolean aPlanar, const Standard_Boolean aClosed, const Standard_Boolean aPolynom, const Standard_Boolean aPeriodic, const Handle(TColStd_HArray1OfReal)& allKnots, const Handle(TColStd_HArray1OfReal)& allWeights, const Handle(TColgp_HArray1OfXYZ)& allPoles, const Standard_Real aUmin, const Standard_Real aUmax, const gp_XYZ& aNorm); 65 66 //! Changes FormNumber (indicates the Shape of the Curve) 67 //! Error if not in range [0-5] 68 Standard_EXPORT void SetFormNumber (const Standard_Integer form); 69 70 //! returns the upper index of the sum (see Knots,Poles) 71 Standard_EXPORT Standard_Integer UpperIndex() const; 72 73 //! returns the degree of basis functions 74 Standard_EXPORT Standard_Integer Degree() const; 75 76 //! returns True if the curve is Planar, False if non-planar 77 Standard_EXPORT Standard_Boolean IsPlanar() const; 78 79 //! returns True if the curve is closed, False if open 80 Standard_EXPORT Standard_Boolean IsClosed() const; 81 82 //! returns True if the curve is polynomial, False if rational 83 //! <flag> False (D) : computed from the list of weights 84 //! (all must be equal) 85 //! <flag> True : as recorded 86 Standard_EXPORT Standard_Boolean IsPolynomial (const Standard_Boolean flag = Standard_False) const; 87 88 //! returns True if the curve is periodic, False otherwise 89 Standard_EXPORT Standard_Boolean IsPeriodic() const; 90 91 //! returns the number of knots (i.e. Degree + UpperIndex + 2) 92 Standard_EXPORT Standard_Integer NbKnots() const; 93 94 //! returns the knot referred to by anIndex, 95 //! inside the range [-Degree,UpperIndex+1] 96 //! raises exception if 97 //! anIndex < -Degree() or anIndex > (NbKnots() - Degree()) 98 //! Note : Knots are numbered from -Degree (not from 1) 99 Standard_EXPORT Standard_Real Knot (const Standard_Integer anIndex) const; 100 101 //! returns number of poles (i.e. UpperIndex + 1) 102 Standard_EXPORT Standard_Integer NbPoles() const; 103 104 //! returns the weight referred to by anIndex, in [0,UpperIndex] 105 //! raises exception if anIndex < 0 or anIndex > UpperIndex() 106 Standard_EXPORT Standard_Real Weight (const Standard_Integer anIndex) const; 107 108 //! returns the pole referred to by anIndex, in [0,UpperIndex] 109 //! raises exception if anIndex < 0 or anIndex > UpperIndex() 110 Standard_EXPORT gp_Pnt Pole (const Standard_Integer anIndex) const; 111 112 //! returns the anIndex'th pole after applying Transf. Matrix 113 //! raises exception if an Index < 0 or an Index > UpperIndex() 114 Standard_EXPORT gp_Pnt TransformedPole (const Standard_Integer anIndex) const; 115 116 //! returns starting parameter value 117 Standard_EXPORT Standard_Real UMin() const; 118 119 //! returns ending parameter value 120 Standard_EXPORT Standard_Real UMax() const; 121 122 //! if the curve is nonplanar then (0, 0, 0) is returned 123 Standard_EXPORT gp_XYZ Normal() const; 124 125 126 127 128 DEFINE_STANDARD_RTTIEXT(IGESGeom_BSplineCurve,IGESData_IGESEntity) 129 130 protected: 131 132 133 134 135 private: 136 137 138 Standard_Integer theIndex; 139 Standard_Integer theDegree; 140 Standard_Boolean isPlanar; 141 Standard_Boolean isClosed; 142 Standard_Boolean isPolynomial; 143 Standard_Boolean isPeriodic; 144 Handle(TColStd_HArray1OfReal) theKnots; 145 Handle(TColStd_HArray1OfReal) theWeights; 146 Handle(TColgp_HArray1OfXYZ) thePoles; 147 Standard_Real theUmin; 148 Standard_Real theUmax; 149 gp_XYZ theNorm; 150 151 152 }; 153 154 155 156 157 158 159 160 #endif // _IGESGeom_BSplineCurve_HeaderFile 161