Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:21:08

0001 // Created on: 1999-06-21
0002 // Created by: Galina KULIKOVA
0003 // Copyright (c) 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 _ShapeAnalysis_TransferParameters_HeaderFile
0018 #define _ShapeAnalysis_TransferParameters_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Edge.hxx>
0024 #include <TopoDS_Face.hxx>
0025 #include <Standard_Transient.hxx>
0026 #include <NCollection_Sequence.hxx>
0027 #include <NCollection_HSequence.hxx>
0028 
0029 //! This tool is used for transferring parameters
0030 //! from 3d curve of the edge to pcurve and vice versa.
0031 //!
0032 //! Default behaviour is to trsnafer parameters with help
0033 //! of linear transformation:
0034 //!
0035 //! T2d = myShift + myScale * T3d
0036 //! where
0037 //! myScale = ( Last2d - First2d ) / ( Last3d - First3d )
0038 //! myShift = First2d - First3d * myScale
0039 //! [First3d, Last3d] and [First2d, Last2d] are ranges of
0040 //! edge on curve and pcurve
0041 //!
0042 //! This behaviour can be redefined in derived classes, for example,
0043 //! using projection.
0044 class ShapeAnalysis_TransferParameters : public Standard_Transient
0045 {
0046 
0047 public:
0048   //! Creates empty tool with myShift = 0 and myScale = 1
0049   Standard_EXPORT ShapeAnalysis_TransferParameters();
0050 
0051   //! Creates a tool and initializes it with edge and face
0052   Standard_EXPORT ShapeAnalysis_TransferParameters(const TopoDS_Edge& E, const TopoDS_Face& F);
0053 
0054   //! Initialize a tool with edge and face
0055   Standard_EXPORT virtual void Init(const TopoDS_Edge& E, const TopoDS_Face& F);
0056 
0057   //! Sets maximal tolerance to use linear recomputation of
0058   //! parameters.
0059   Standard_EXPORT void SetMaxTolerance(const double maxtol);
0060 
0061   //! Transfers parameters given by sequence Params from 3d curve
0062   //! to pcurve (if To2d is True) or back (if To2d is False)
0063   Standard_EXPORT virtual occ::handle<NCollection_HSequence<double>> Perform(
0064     const occ::handle<NCollection_HSequence<double>>& Params,
0065     const bool                                        To2d);
0066 
0067   //! Transfers parameter given by sequence Params from 3d curve
0068   //! to pcurve (if To2d is True) or back (if To2d is False)
0069   Standard_EXPORT virtual double Perform(const double Param, const bool To2d);
0070 
0071   //! Recomputes range of curves from NewEdge.
0072   //! If Is2d equals True parameters are recomputed by curve2d else by curve3d.
0073   Standard_EXPORT virtual void TransferRange(TopoDS_Edge& newEdge,
0074                                              const double prevPar,
0075                                              const double currPar,
0076                                              const bool   To2d);
0077 
0078   //! Returns True if 3d curve of edge and pcurve are SameRange
0079   //! (in default implementation, if myScale == 1 and myShift == 0)
0080   Standard_EXPORT virtual bool IsSameRange() const;
0081 
0082   DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_TransferParameters, Standard_Transient)
0083 
0084 protected:
0085   double      myFirst;
0086   double      myLast;
0087   TopoDS_Edge myEdge;
0088   double      myMaxTolerance;
0089 
0090 private:
0091   double      myShift;
0092   double      myScale;
0093   double      myFirst2d;
0094   double      myLast2d;
0095   TopoDS_Face myFace;
0096 };
0097 
0098 #endif // _ShapeAnalysis_TransferParameters_HeaderFile