Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:28:32

0001 // Created on: 1993-07-12
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _MAT2d_Tool2d_HeaderFile
0018 #define _MAT2d_Tool2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GeomAbs_JoinType.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Bisector_Bisec.hxx>
0027 #include <NCollection_DataMap.hxx>
0028 #include <gp_Pnt2d.hxx>
0029 #include <gp_Vec2d.hxx>
0030 #include <NCollection_Sequence.hxx>
0031 #include <MAT_Side.hxx>
0032 class MAT2d_Circuit;
0033 class MAT_Bisector;
0034 class Bisector_Bisec;
0035 class Geom2d_Geometry;
0036 class gp_Pnt2d;
0037 class gp_Vec2d;
0038 
0039 //! Set of the methods useful for the MAT's computation.
0040 //! Tool2d contains the geometry of the bisecting locus.
0041 class MAT2d_Tool2d
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Empty Constructor.
0047   Standard_EXPORT MAT2d_Tool2d();
0048 
0049   //! <aSide> defines the side of the computation of the map.
0050   Standard_EXPORT void Sense(const MAT_Side aside);
0051 
0052   Standard_EXPORT void SetJoinType(const GeomAbs_JoinType aJoinType);
0053 
0054   //! InitItems cuts the line in Items.
0055   //! this Items are the geometrics representations of
0056   //! the BasicElts from MAT.
0057   Standard_EXPORT void InitItems(const occ::handle<MAT2d_Circuit>& aCircuit);
0058 
0059   //! Returns the Number of Items .
0060   Standard_EXPORT int NumberOfItems() const;
0061 
0062   //! Returns tolerance to test the confusion of two points.
0063   Standard_EXPORT double ToleranceOfConfusion() const;
0064 
0065   //! Creates the point at the origin of the bisector between
0066   //! anitem and the previous item.
0067   //! dist is the distance from the FirstPoint to <anitem>.
0068   //! Returns the index of this point in <theGeomPnts>.
0069   Standard_EXPORT int FirstPoint(const int anitem, double& dist);
0070 
0071   //! Creates the Tangent at the end of the Item defined
0072   //! by <anitem>. Returns the index of this vector in
0073   //! <theGeomVecs>
0074   Standard_EXPORT int TangentBefore(const int anitem, const bool IsOpenResult);
0075 
0076   //! Creates the Reversed Tangent at the origin of the Item
0077   //! defined by <anitem>. Returns the index of this vector in
0078   //! <theGeomVecs>
0079   Standard_EXPORT int TangentAfter(const int anitem, const bool IsOpenResult);
0080 
0081   //! Creates the Tangent at the end of the bisector defined
0082   //! by <bisector>. Returns the index of this vector in
0083   //! <theGeomVecs>
0084   Standard_EXPORT int Tangent(const int bisector);
0085 
0086   //! Creates the geometric bisector defined by <abisector>.
0087   Standard_EXPORT void CreateBisector(const occ::handle<MAT_Bisector>& abisector);
0088 
0089   //! Trims the geometric bisector by the <firstparameter>
0090   //! of <abisector>.
0091   //! If the parameter is out of the bisector, Return FALSE.
0092   //! else Return True.
0093   Standard_EXPORT bool TrimBisector(const occ::handle<MAT_Bisector>& abisector);
0094 
0095   //! Trims the geometric bisector by the point of index
0096   //! <apoint> in <theGeomPnts>.
0097   //! If the point is out of the bisector, Return FALSE.
0098   //! else Return True.
0099   Standard_EXPORT bool TrimBisector(const occ::handle<MAT_Bisector>& abisector, const int apoint);
0100 
0101   //! Computes the point of intersection between the
0102   //! bisectors defined by <bisectorone> and
0103   //! <bisectortwo> .
0104   //! If this point exists, <intpnt> is its index
0105   //! in <theGeomPnts> and Return the distance of the point
0106   //! from the bisector else Return <RealLast>.
0107   Standard_EXPORT double IntersectBisector(const occ::handle<MAT_Bisector>& bisectorone,
0108                                            const occ::handle<MAT_Bisector>& bisectortwo,
0109                                            int&                             intpnt);
0110 
0111   //! Returns the distance between the two points designed
0112   //! by their parameters on <abisector>.
0113   Standard_EXPORT double Distance(const occ::handle<MAT_Bisector>& abisector,
0114                                   const double                     param1,
0115                                   const double                     param2) const;
0116 
0117   //! displays information about the bisector defined by
0118   //! <bisector>.
0119   Standard_EXPORT void Dump(const int bisector, const int erease) const;
0120 
0121   //! Returns the <Bisec> of index <Index> in
0122   //! <theGeomBisectors>.
0123   Standard_EXPORT const Bisector_Bisec& GeomBis(const int Index) const;
0124 
0125   //! Returns the Geometry of index <Index> in <theGeomElts>.
0126   Standard_EXPORT occ::handle<Geom2d_Geometry> GeomElt(const int Index) const;
0127 
0128   //! Returns the point of index <Index> in the <theGeomPnts>.
0129   Standard_EXPORT const gp_Pnt2d& GeomPnt(const int Index) const;
0130 
0131   //! Returns the vector of index <Index> in the
0132   //! <theGeomVecs>.
0133   Standard_EXPORT const gp_Vec2d& GeomVec(const int Index) const;
0134 
0135   Standard_EXPORT occ::handle<MAT2d_Circuit> Circuit() const;
0136 
0137   Standard_EXPORT void BisecFusion(const int Index1, const int Index2);
0138 
0139   //! Returns the <Bisec> of index <Index> in
0140   //! <theGeomBisectors>.
0141   Standard_EXPORT Bisector_Bisec& ChangeGeomBis(const int Index);
0142 
0143 private:
0144   //! Returns True if the point <apoint> is equidistant to
0145   //! the elements separated by bisectors <bisectorone> and
0146   //! <bisectortwo>.
0147   //! In this case <adistance> is the distance of the point
0148   //! from the bisectors.
0149   Standard_EXPORT bool IsSameDistance(const occ::handle<MAT_Bisector>& bisectorone,
0150                                       const occ::handle<MAT_Bisector>& bisectortwo,
0151                                       const gp_Pnt2d&                  apoint,
0152                                       double&                          adistance) const;
0153 
0154   //! Return <True> if the Point can be projected
0155   //! on the element designed by <IndexElt>.
0156   //! In this case <Distance> is the minimum of distance
0157   //! between Point and its projections.
0158   Standard_EXPORT bool Projection(const int       IndexElt,
0159                                   const gp_Pnt2d& Point,
0160                                   double&         Distance) const;
0161 
0162   Standard_EXPORT void TrimBisec(Bisector_Bisec& Bis,
0163                                  const int       IndexEdge,
0164                                  const bool      OnLine,
0165                                  const int       StartOrEnd) const;
0166 
0167   double                                   theDirection;
0168   GeomAbs_JoinType                         theJoinType;
0169   int                                      theNumberOfBisectors;
0170   int                                      theNumberOfPnts;
0171   int                                      theNumberOfVecs;
0172   occ::handle<MAT2d_Circuit>               theCircuit;
0173   NCollection_DataMap<int, Bisector_Bisec> theGeomBisectors;
0174   NCollection_DataMap<int, gp_Pnt2d>       theGeomPnts;
0175   NCollection_DataMap<int, gp_Vec2d>       theGeomVecs;
0176   NCollection_Sequence<int>                theLinesLength;
0177 };
0178 
0179 #endif // _MAT2d_Tool2d_HeaderFile