Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-09 10:27:03

0001 // Created on: 1994-11-16
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-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 _IGESConvGeom_GeomBuilder_HeaderFile
0018 #define _IGESConvGeom_GeomBuilder_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_XYZ.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <NCollection_HSequence.hxx>
0027 #include <gp_Trsf.hxx>
0028 #include <Standard_Integer.hxx>
0029 class gp_XY;
0030 class gp_XYZ;
0031 class IGESGeom_CopiousData;
0032 class gp_Ax3;
0033 class gp_Ax2;
0034 class gp_Ax1;
0035 class IGESGeom_TransformationMatrix;
0036 
0037 //! This class provides some useful basic tools to build IGESGeom
0038 //! curves, especially :
0039 //! define a curve in a plane in 3D space (ex. Circular or Conic
0040 //! arc, or Copious Data defined in 2D)
0041 //! make a CopiousData from a list of points/vectors
0042 class IGESConvGeom_GeomBuilder
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Creates a GeomBuilder at initial state.
0048   Standard_EXPORT IGESConvGeom_GeomBuilder();
0049 
0050   //! Clears list of Points/Vectors and data about Transformation
0051   Standard_EXPORT void Clear();
0052 
0053   //! Adds a XY (Z=0) to the list of points
0054   Standard_EXPORT void AddXY(const gp_XY& val);
0055 
0056   //! Adds a XYZ to the list of points
0057   Standard_EXPORT void AddXYZ(const gp_XYZ& val);
0058 
0059   //! Adds a Vector part to the list of points. It will be used
0060   //! for CopiousData, datatype=3, only.
0061   //! AddXY and AddXYZ consider a null vector part (0,0,0)
0062   //! AddVec adds to the last added XY or XYZ
0063   Standard_EXPORT void AddVec(const gp_XYZ& val);
0064 
0065   //! Returns the count of already recorded points
0066   Standard_EXPORT int NbPoints() const;
0067 
0068   //! Returns a point given its rank (if added as XY, Z will be 0)
0069   Standard_EXPORT gp_XYZ Point(const int num) const;
0070 
0071   //! Makes a CopiousData with the list of recorded Points/Vectors
0072   //! according to <datatype>, which must be 1,2 or 3
0073   //! If <polyline> is given True, the CopiousData is coded as a
0074   //! Polyline, but <datatype> must not be 3
0075   //! <datatype> = 1 : Common Z is computed as average of all Z
0076   //! <datatype> = 1 or 2 : Vectors are ignored
0077   Standard_EXPORT occ::handle<IGESGeom_CopiousData> MakeCopiousData(
0078     const int  datatype,
0079     const bool polyline = false) const;
0080 
0081   //! Returns the Position in which the method EvalXYZ will
0082   //! evaluate a XYZ. It can be regarded as defining a local system.
0083   //! It is initially set to Identity
0084   Standard_EXPORT gp_Trsf Position() const;
0085 
0086   //! Sets final position from an already defined Trsf
0087   Standard_EXPORT void SetPosition(const gp_Trsf& pos);
0088 
0089   //! Sets final position from an Ax3
0090   Standard_EXPORT void SetPosition(const gp_Ax3& pos);
0091 
0092   //! Sets final position from an Ax2
0093   Standard_EXPORT void SetPosition(const gp_Ax2& pos);
0094 
0095   //! Sets final position from an Ax1
0096   //! (this means that origin point and Z-axis are defined, the
0097   //! other axes are defined arbitrarily)
0098   Standard_EXPORT void SetPosition(const gp_Ax1& pos);
0099 
0100   //! Returns True if the Position is Identity
0101   Standard_EXPORT bool IsIdentity() const;
0102 
0103   //! Returns True if the Position is a Translation only
0104   //! Remark : Identity and ZOnly will answer True
0105   Standard_EXPORT bool IsTranslation() const;
0106 
0107   //! Returns True if the Position corresponds to a Z-Displacement,
0108   //! i.e. is a Translation only, and only on Z
0109   //! Remark : Identity will answer True
0110   Standard_EXPORT bool IsZOnly() const;
0111 
0112   //! Evaluates a XYZ value in the Position already defined.
0113   //! Returns the transformed coordinates.
0114   //! For a 2D definition, X,Y will then be used to define a XY and
0115   //! Z will be regarded as a Z Displacement (can be ignored)
0116   Standard_EXPORT void EvalXYZ(const gp_XYZ& val, double& X, double& Y, double& Z) const;
0117 
0118   //! Returns the IGES Transformation which corresponds to the
0119   //! Position. Even if it is an Identity : IsIdentity should be
0120   //! tested first.
0121   //! <unit> is the unit value in which the model is created :
0122   //! it is used to convert translation part
0123   Standard_EXPORT occ::handle<IGESGeom_TransformationMatrix> MakeTransformation(
0124     const double unit = 1) const;
0125 
0126 private:
0127   occ::handle<NCollection_HSequence<gp_XYZ>> theXYZ;
0128   occ::handle<NCollection_HSequence<gp_XYZ>> theVec;
0129   gp_Trsf                                    thepos;
0130 };
0131 
0132 #endif // _IGESConvGeom_GeomBuilder_HeaderFile