1 // Created on: 1991-12-02 2 // Created by: Laurent PAINNOT 3 // Copyright (c) 1991-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 _AppParCurves_MultiCurve_HeaderFile 18 #define _AppParCurves_MultiCurve_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <AppParCurves_HArray1OfMultiPoint.hxx> 25 #include <Standard_Integer.hxx> 26 #include <AppParCurves_Array1OfMultiPoint.hxx> 27 #include <TColgp_Array1OfPnt.hxx> 28 #include <TColgp_Array1OfPnt2d.hxx> 29 #include <Standard_Real.hxx> 30 #include <Standard_OStream.hxx> 31 class AppParCurves_MultiPoint; 32 class gp_Pnt; 33 class gp_Pnt2d; 34 class gp_Vec; 35 class gp_Vec2d; 36 37 38 //! This class describes a MultiCurve approximating a Multiline. 39 //! As a Multiline is a set of n lines, a MultiCurve is a set 40 //! of n curves. These curves are Bezier curves. 41 //! A MultiCurve is composed of m MultiPoint. 42 //! The approximating degree of these n curves is the same for 43 //! each one. 44 //! 45 //! Example of a MultiCurve composed of MultiPoints: 46 //! 47 //! P1______P2_____P3______P4________........_____PNbMPoints 48 //! 49 //! Q1______Q2_____Q3______Q4________........_____QNbMPoints 50 //! . . 51 //! . . 52 //! . . 53 //! R1______R2_____R3______R4________........_____RNbMPoints 54 //! 55 //! Pi, Qi, ..., Ri are points of dimension 2 or 3. 56 //! 57 //! (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints. 58 //! each MultiPoint has got NbPol Poles. 59 class AppParCurves_MultiCurve 60 { 61 public: 62 63 DEFINE_STANDARD_ALLOC 64 65 66 //! returns an indefinite MultiCurve. 67 Standard_EXPORT AppParCurves_MultiCurve(); 68 69 //! creates a MultiCurve, describing Bezier curves all 70 //! containing the same number of MultiPoint. 71 //! An exception is raised if Degree < 0. 72 Standard_EXPORT AppParCurves_MultiCurve(const Standard_Integer NbPol); 73 74 //! creates a MultiCurve, describing Bezier curves all 75 //! containing the same number of MultiPoint. 76 //! Each MultiPoint must have NbCurves Poles. 77 Standard_EXPORT AppParCurves_MultiCurve(const AppParCurves_Array1OfMultiPoint& tabMU); 78 Standard_EXPORT virtual ~AppParCurves_MultiCurve(); 79 80 //! The number of poles of the MultiCurve 81 //! will be set to <nbPoles>. 82 Standard_EXPORT void SetNbPoles (const Standard_Integer nbPoles); 83 84 //! sets the MultiPoint of range Index to the value 85 //! <MPoint>. 86 //! An exception is raised if Index <0 or Index >NbMPoint. 87 Standard_EXPORT void SetValue (const Standard_Integer Index, const AppParCurves_MultiPoint& MPoint); 88 89 //! Returns the number of curves resulting from the 90 //! approximation of a MultiLine. 91 Standard_EXPORT Standard_Integer NbCurves() const; 92 93 //! Returns the number of poles on curves resulting from the approximation of a MultiLine. 94 Standard_EXPORT virtual Standard_Integer NbPoles() const; 95 96 //! returns the degree of the curves. 97 Standard_EXPORT virtual Standard_Integer Degree() const; 98 99 //! returns the dimension of the CuIndex curve. 100 //! An exception is raised if CuIndex<0 or CuIndex>NbCurves. 101 Standard_EXPORT Standard_Integer Dimension (const Standard_Integer CuIndex) const; 102 103 //! returns the Pole array of the curve of range CuIndex. 104 //! An exception is raised if the dimension of the curve 105 //! is 2d. 106 Standard_EXPORT void Curve (const Standard_Integer CuIndex, TColgp_Array1OfPnt& TabPnt) const; 107 108 //! returns the Pole array of the curve of range CuIndex. 109 //! An exception is raised if the dimension of the curve 110 //! is 3d. 111 Standard_EXPORT void Curve (const Standard_Integer CuIndex, TColgp_Array1OfPnt2d& TabPnt) const; 112 113 //! returns the Index MultiPoint. 114 //! An exception is raised if Index <0 or Index >Degree+1. 115 Standard_EXPORT const AppParCurves_MultiPoint& Value (const Standard_Integer Index) const; 116 117 //! returns the Nieme pole of the CuIndex curve. 118 //! the curve must be a 3D curve. 119 Standard_EXPORT const gp_Pnt& Pole (const Standard_Integer CuIndex, const Standard_Integer Nieme) const; 120 121 //! returns the Nieme pole of the CuIndex curve. 122 //! the curve must be a 2D curve. 123 Standard_EXPORT const gp_Pnt2d& Pole2d (const Standard_Integer CuIndex, const Standard_Integer Nieme) const; 124 125 //! Applies a transformation to the curve of range 126 //! <CuIndex>. 127 //! newx = x + dx*oldx 128 //! newy = y + dy*oldy for all points of the curve. 129 //! newz = z + dz*oldz 130 Standard_EXPORT void Transform (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy, const Standard_Real z, const Standard_Real dz); 131 132 //! Applies a transformation to the Curve of range 133 //! <CuIndex>. 134 //! newx = x + dx*oldx 135 //! newy = y + dy*oldy for all points of the curve. 136 Standard_EXPORT void Transform2d (const Standard_Integer CuIndex, const Standard_Real x, const Standard_Real dx, const Standard_Real y, const Standard_Real dy); 137 138 //! returns the value of the point with a parameter U 139 //! on the Bezier curve number CuIndex. 140 //! An exception is raised if CuIndex <0 or > NbCurves. 141 //! An exception is raised if the curve dimension is 2d. 142 Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt) const; 143 144 //! returns the value of the point with a parameter U 145 //! on the Bezier curve number CuIndex. 146 //! An exception is raised if CuIndex <0 or > NbCurves. 147 //! An exception is raised if the curve dimension is 3d. 148 Standard_EXPORT virtual void Value (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt) const; 149 150 //! returns the value of the point with a parameter U 151 //! on the Bezier curve number CuIndex. 152 //! An exception is raised if CuIndex <0 or > NbCurves. 153 //! An exception is raised if the curve dimension is 3d. 154 Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1) const; 155 156 //! returns the value of the point with a parameter U 157 //! on the Bezier curve number CuIndex. 158 //! An exception is raised if CuIndex <0 or > NbCurves. 159 //! An exception is raised if the curve dimension is 2d. 160 Standard_EXPORT virtual void D1 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1) const; 161 162 //! returns the value of the point with a parameter U 163 //! on the Bezier curve number CuIndex. 164 //! An exception is raised if CuIndex <0 or > NbCurves. 165 //! An exception is raised if the curve dimension is 3d. 166 Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt& Pt, gp_Vec& V1, gp_Vec& V2) const; 167 168 //! returns the value of the point with a parameter U 169 //! on the Bezier curve number CuIndex. 170 //! An exception is raised if CuIndex <0 or > NbCurves. 171 //! An exception is raised if the curve dimension is 2d. 172 Standard_EXPORT virtual void D2 (const Standard_Integer CuIndex, const Standard_Real U, gp_Pnt2d& Pt, gp_Vec2d& V1, gp_Vec2d& V2) const; 173 174 //! Prints on the stream o information on the current 175 //! state of the object. 176 //! Is used to redefine the operator <<. 177 Standard_EXPORT virtual void Dump (Standard_OStream& o) const; 178 179 180 181 182 protected: 183 184 185 186 Handle(AppParCurves_HArray1OfMultiPoint) tabPoint; 187 188 189 private: 190 191 192 193 194 195 }; 196 197 198 199 200 201 202 203 #endif // _AppParCurves_MultiCurve_HeaderFile 204