Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:55

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 <TColStd_HSequenceOfReal.hxx>
0027 
0028 
0029 class ShapeAnalysis_TransferParameters;
0030 DEFINE_STANDARD_HANDLE(ShapeAnalysis_TransferParameters, Standard_Transient)
0031 
0032 //! This tool is used for transferring parameters
0033 //! from 3d curve of the edge to pcurve and vice versa.
0034 //!
0035 //! Default behaviour is to trsnafer parameters with help
0036 //! of linear transformation:
0037 //!
0038 //! T2d = myShift + myScale * T3d
0039 //! where
0040 //! myScale = ( Last2d - First2d ) / ( Last3d - First3d )
0041 //! myShift = First2d - First3d * myScale
0042 //! [First3d, Last3d] and [First2d, Last2d] are ranges of
0043 //! edge on curve and pcurve
0044 //!
0045 //! This behaviour can be redefined in derived classes, for example,
0046 //! using projection.
0047 class ShapeAnalysis_TransferParameters : public Standard_Transient
0048 {
0049 
0050 public:
0051 
0052   
0053   //! Creates empty tool with myShift = 0 and myScale = 1
0054   Standard_EXPORT ShapeAnalysis_TransferParameters();
0055   
0056   //! Creates a tool and initializes it with edge and face
0057   Standard_EXPORT ShapeAnalysis_TransferParameters(const TopoDS_Edge& E, const TopoDS_Face& F);
0058   
0059   //! Initialize a tool with edge and face
0060   Standard_EXPORT virtual void Init (const TopoDS_Edge& E, const TopoDS_Face& F);
0061   
0062   //! Sets maximal tolerance to use linear recomputation of
0063   //! parameters.
0064   Standard_EXPORT void SetMaxTolerance (const Standard_Real maxtol);
0065   
0066   //! Transfers parameters given by sequence Params from 3d curve
0067   //! to pcurve (if To2d is True) or back (if To2d is False)
0068   Standard_EXPORT virtual Handle(TColStd_HSequenceOfReal) Perform (const Handle(TColStd_HSequenceOfReal)& Params, const Standard_Boolean To2d);
0069   
0070   //! Transfers parameter given by sequence Params from 3d curve
0071   //! to pcurve (if To2d is True) or back (if To2d is False)
0072   Standard_EXPORT virtual Standard_Real Perform (const Standard_Real Param, const Standard_Boolean To2d);
0073   
0074   //! Recomputes range of curves from NewEdge.
0075   //! If Is2d equals True parameters are recomputed by curve2d else by curve3d.
0076   Standard_EXPORT virtual void TransferRange (TopoDS_Edge& newEdge, const Standard_Real prevPar, const Standard_Real currPar, const Standard_Boolean 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 Standard_Boolean IsSameRange() const;
0081 
0082 
0083 
0084 
0085   DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_TransferParameters,Standard_Transient)
0086 
0087 protected:
0088 
0089 
0090   Standard_Real myFirst;
0091   Standard_Real myLast;
0092   TopoDS_Edge myEdge;
0093   Standard_Real myMaxTolerance;
0094 
0095 
0096 private:
0097 
0098 
0099   Standard_Real myShift;
0100   Standard_Real myScale;
0101   Standard_Real myFirst2d;
0102   Standard_Real myLast2d;
0103   TopoDS_Face myFace;
0104 
0105 
0106 };
0107 
0108 
0109 
0110 
0111 
0112 
0113 
0114 #endif // _ShapeAnalysis_TransferParameters_HeaderFile