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 _AppDef_MultiPointConstraint_HeaderFile 18 #define _AppDef_MultiPointConstraint_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <AppParCurves_MultiPoint.hxx> 25 #include <TColgp_Array1OfPnt.hxx> 26 #include <TColgp_Array1OfPnt2d.hxx> 27 #include <TColgp_HArray1OfVec.hxx> 28 #include <TColgp_HArray1OfVec2d.hxx> 29 30 class gp_Vec; 31 class gp_Vec2d; 32 33 //! Describes a MultiPointConstraint used in a 34 //! Multiline. MultiPointConstraints are composed 35 //! of several two or three-dimensional points. 36 //! The purpose is to define the corresponding 37 //! points that share a common constraint in order 38 //! to compute the approximation of several lines in parallel. 39 //! Notes: 40 //! - The order of points of a MultiPointConstraints is very important. 41 //! Users must give 3D points first, and then 2D points. 42 //! - The constraints for the points included in a 43 //! MultiPointConstraint are always identical for 44 //! all points, including the parameter. 45 //! - If a MultiPointConstraint is a "tangency" 46 //! point, the point is also a "passing" point. 47 class AppDef_MultiPointConstraint : public AppParCurves_MultiPoint 48 { 49 public: 50 51 DEFINE_STANDARD_ALLOC 52 53 54 //! creates an undefined MultiPointConstraint. 55 Standard_EXPORT AppDef_MultiPointConstraint(); 56 57 //! constructs a set of Points used to approximate a Multiline. 58 //! These Points can be of 2 or 3 dimensions. 59 //! Points will be initialized with SetPoint and SetPoint2d. 60 Standard_EXPORT AppDef_MultiPointConstraint(const Standard_Integer NbPoints, const Standard_Integer NbPoints2d); 61 62 //! creates a MultiPoint only composed of 3D points. 63 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP); 64 65 //! creates a MultiPoint only composed of 2D points. 66 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP); 67 68 //! constructs a set of Points used to approximate a Multiline. 69 //! These Points can be of 2 or 3 dimensions. 70 //! Points will be initialized with SetPoint and SetPoint2d. 71 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d); 72 73 //! creates a MultiPointConstraint with a constraint of 74 //! Curvature. 75 //! An exception is raised if 76 //! (length of <tabP> + length of <tabP2d> ) is different 77 //! from (length of <tabVec> + length of <tabVec2d> ) or 78 //! from (length of <tabCur> + length of <tabCur2d> ) 79 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec& tabVec, const TColgp_Array1OfVec2d& tabVec2d, const TColgp_Array1OfVec& tabCur, const TColgp_Array1OfVec2d& tabCur2d); 80 81 //! creates a MultiPointConstraint with a constraint of 82 //! Tangency. 83 //! An exception is raised if 84 //! (length of <tabP> + length of <tabP2d> ) is different 85 //! from (length of <tabVec> + length of <tabVec2d> ) 86 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec& tabVec, const TColgp_Array1OfVec2d& tabVec2d); 87 88 //! creates a MultiPointConstraint only composed of 3d points 89 //! with constraints of curvature. 90 //! An exception is raised if the length of tabP is different 91 //! from the length of tabVec or from tabCur. 92 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfVec& tabVec, const TColgp_Array1OfVec& tabCur); 93 94 //! creates a MultiPointConstraint only composed of 3d points 95 //! with constraints of tangency. 96 //! An exception is raised if the length of tabP is different 97 //! from the length of tabVec. 98 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt& tabP, const TColgp_Array1OfVec& tabVec); 99 100 //! creates a MultiPointConstraint only composed of 2d points 101 //! with constraints of tangency. 102 //! An exception is raised if the length of tabP is different 103 //! from the length of tabVec2d. 104 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec2d& tabVec2d); 105 106 //! creates a MultiPointConstraint only composed of 2d points 107 //! with constraints of curvature. 108 //! An exception is raised if the length of tabP is different 109 //! from the length of tabVec2d or from tabCur2d. 110 Standard_EXPORT AppDef_MultiPointConstraint(const TColgp_Array1OfPnt2d& tabP2d, const TColgp_Array1OfVec2d& tabVec2d, const TColgp_Array1OfVec2d& tabCur2d); 111 112 //! sets the value of the tangency of the point of range 113 //! Index. 114 //! An exception is raised if Index <0 or if Index > number 115 //! of 3d points. 116 //! An exception is raised if Tang has an incorrect number of 117 //! dimensions. 118 Standard_EXPORT void SetTang (const Standard_Integer Index, const gp_Vec& Tang); 119 120 //! returns the tangency value of the point of range Index. 121 //! An exception is raised if Index < 0 or if Index > number 122 //! of 3d points. 123 Standard_EXPORT gp_Vec Tang (const Standard_Integer Index) const; 124 125 //! sets the value of the tangency of the point of range 126 //! Index. 127 //! An exception is raised if Index <number of 3d points or if 128 //! Index > total number of Points 129 //! An exception is raised if Tang has an incorrect number of 130 //! dimensions. 131 Standard_EXPORT void SetTang2d (const Standard_Integer Index, const gp_Vec2d& Tang2d); 132 133 //! returns the tangency value of the point of range Index. 134 //! An exception is raised if Index < number of 3d points or 135 //! if Index > total number of points. 136 Standard_EXPORT gp_Vec2d Tang2d (const Standard_Integer Index) const; 137 138 //! Vec sets the value of the normal vector at the 139 //! point of index Index. The norm of the normal 140 //! vector at the point of position Index is set to the normal curvature. 141 //! An exception is raised if Index <0 or if Index > number 142 //! of 3d points. 143 //! An exception is raised if Curv has an incorrect number of 144 //! dimensions. 145 Standard_EXPORT void SetCurv (const Standard_Integer Index, const gp_Vec& Curv); 146 147 //! returns the normal vector at the point of range Index. 148 //! An exception is raised if Index < 0 or if Index > number 149 //! of 3d points. 150 Standard_EXPORT gp_Vec Curv (const Standard_Integer Index) const; 151 152 //! Vec sets the value of the normal vector at the 153 //! point of index Index. The norm of the normal 154 //! vector at the point of position Index is set to the normal curvature. 155 //! An exception is raised if Index <0 or if Index > number 156 //! of 3d points. 157 //! An exception is raised if Curv has an incorrect number of 158 //! dimensions. 159 Standard_EXPORT void SetCurv2d (const Standard_Integer Index, const gp_Vec2d& Curv2d); 160 161 //! returns the normal vector at the point of range Index. 162 //! An exception is raised if Index < 0 or if Index > number 163 //! of 3d points. 164 Standard_EXPORT gp_Vec2d Curv2d (const Standard_Integer Index) const; 165 166 //! returns True if the MultiPoint has a tangency value. 167 Standard_EXPORT Standard_Boolean IsTangencyPoint() const; 168 169 //! returns True if the MultiPoint has a curvature value. 170 Standard_EXPORT Standard_Boolean IsCurvaturePoint() const; 171 172 //! Prints on the stream o information on the current 173 //! state of the object. 174 //! Is used to redefine the operator <<. 175 Standard_EXPORT virtual void Dump (Standard_OStream& o) const Standard_OVERRIDE; 176 177 private: 178 Handle(TColgp_HArray1OfVec) tabTang; 179 Handle(TColgp_HArray1OfVec) tabCurv; 180 Handle(TColgp_HArray1OfVec2d) tabTang2d; 181 Handle(TColgp_HArray1OfVec2d) tabCurv2d; 182 }; 183 184 #endif // _AppDef_MultiPointConstraint_HeaderFile 185