Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-11 09:17:35

0001 // Created on: 1993-03-24
0002 // Created by: JCV
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 _Geom2d_Geometry_HeaderFile
0018 #define _Geom2d_Geometry_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Transient.hxx>
0024 #include <Standard_Real.hxx>
0025 class gp_Pnt2d;
0026 class gp_Ax2d;
0027 class gp_Vec2d;
0028 class gp_Trsf2d;
0029 
0030 //! The general abstract class Geometry in 2D space describes
0031 //! the common behaviour of all the geometric entities.
0032 //!
0033 //! All the objects derived from this class can be move with a
0034 //! geometric transformation. Only the transformations which
0035 //! doesn't modify the nature of the geometry are available in
0036 //! this package.
0037 //! The method Transform which defines a general transformation
0038 //! is deferred. The other specifics transformations used the
0039 //! method Transform.
0040 //! All the following transformations modify the object itself.
0041 //! Warning
0042 //! Only transformations which do not modify the nature
0043 //! of the geometry can be applied to Geom2d objects:
0044 //! this is the case with translations, rotations,
0045 //! symmetries and scales; this is also the case with
0046 //! gp_Trsf2d composite transformations which are
0047 //! used to define the geometric transformations applied
0048 //! using the Transform or Transformed functions.
0049 //! Note: Geometry defines the "prototype" of the
0050 //! abstract method Transform which is defined for each
0051 //! concrete type of derived object. All other
0052 //! transformations are implemented using the Transform method.
0053 class Geom2d_Geometry : public Standard_Transient
0054 {
0055 
0056 public:
0057   //! Performs the symmetrical transformation of a Geometry
0058   //! with respect to the point P which is the center of the
0059   //! symmetry and assigns the result to this geometric object.
0060   Standard_EXPORT void Mirror(const gp_Pnt2d& P);
0061 
0062   //! Performs the symmetrical transformation of a Geometry
0063   //! with respect to an axis placement which is the axis of the symmetry.
0064   Standard_EXPORT void Mirror(const gp_Ax2d& A);
0065 
0066   //! Rotates a Geometry. P is the center of the rotation.
0067   //! Ang is the angular value of the rotation in radians.
0068   Standard_EXPORT void Rotate(const gp_Pnt2d& P, const double Ang);
0069 
0070   //! Scales a Geometry. S is the scaling value.
0071   Standard_EXPORT void Scale(const gp_Pnt2d& P, const double S);
0072 
0073   //! Translates a Geometry. V is the vector of the translation.
0074   Standard_EXPORT void Translate(const gp_Vec2d& V);
0075 
0076   //! Translates a Geometry from the point P1 to the point P2.
0077   Standard_EXPORT void Translate(const gp_Pnt2d& P1, const gp_Pnt2d& P2);
0078 
0079   //! Transformation of a geometric object. This transformation
0080   //! can be a translation, a rotation, a symmetry, a scaling
0081   //! or a complex transformation obtained by combination of
0082   //! the previous elementaries transformations.
0083   //! (see class Transformation of the package Geom2d).
0084   //! The following transformations have the same properties
0085   //! as the previous ones but they don't modified the object
0086   //! itself. A copy of the object is returned.
0087   Standard_EXPORT virtual void Transform(const gp_Trsf2d& T) = 0;
0088 
0089   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Mirrored(const gp_Pnt2d& P) const;
0090 
0091   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Mirrored(const gp_Ax2d& A) const;
0092 
0093   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Rotated(const gp_Pnt2d& P,
0094                                                                      const double    Ang) const;
0095 
0096   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Scaled(const gp_Pnt2d& P,
0097                                                                     const double    S) const;
0098 
0099   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Transformed(const gp_Trsf2d& T) const;
0100 
0101   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Translated(const gp_Vec2d& V) const;
0102 
0103   [[nodiscard]] Standard_EXPORT occ::handle<Geom2d_Geometry> Translated(const gp_Pnt2d& P1,
0104                                                                         const gp_Pnt2d& P2) const;
0105 
0106   [[nodiscard]] Standard_EXPORT virtual occ::handle<Geom2d_Geometry> Copy() const = 0;
0107 
0108   //! Dumps the content of me into the stream
0109   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0110 
0111   DEFINE_STANDARD_RTTIEXT(Geom2d_Geometry, Standard_Transient)
0112 };
0113 
0114 #endif // _Geom2d_Geometry_HeaderFile