Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:21:12

0001 // Created on: 1995-03-02
0002 // Created by: Jean-Louis Frenkel
0003 // Copyright (c) 1995-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 _Aspect_RectangularGrid_HeaderFile
0018 #define _Aspect_RectangularGrid_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Aspect_Grid.hxx>
0023 
0024 class Aspect_RectangularGrid : public Aspect_Grid
0025 {
0026   DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid, Aspect_Grid)
0027 public:
0028   //! creates a new grid. By default this grid is not
0029   //! active.
0030   //! The first angle is given relatively to the horizontal.
0031   //! The second angle is given relatively to the vertical.
0032   Standard_EXPORT Aspect_RectangularGrid(const double aXStep,
0033                                          const double aYStep,
0034                                          const double anXOrigin      = 0,
0035                                          const double anYOrigin      = 0,
0036                                          const double aFirstAngle    = 0,
0037                                          const double aSecondAngle   = 0,
0038                                          const double aRotationAngle = 0);
0039 
0040   //! defines the x step of the grid.
0041   Standard_EXPORT void SetXStep(const double aStep);
0042 
0043   //! defines the y step of the grid.
0044   Standard_EXPORT void SetYStep(const double aStep);
0045 
0046   //! defines the angle of the second network
0047   //! the fist angle is given relatively to the horizontal.
0048   //! the second angle is given relatively to the vertical.
0049   Standard_EXPORT void SetAngle(const double anAngle1, const double anAngle2);
0050 
0051   Standard_EXPORT void SetGridValues(const double XOrigin,
0052                                      const double YOrigin,
0053                                      const double XStep,
0054                                      const double YStep,
0055                                      const double RotationAngle);
0056 
0057   //! returns the point of the grid the closest to the point X,Y
0058   Standard_EXPORT void Compute(const double X,
0059                                const double Y,
0060                                double&      gridX,
0061                                double&      gridY) const override;
0062 
0063   //! returns the x step of the grid.
0064   Standard_EXPORT double XStep() const;
0065 
0066   //! returns the x step of the grid.
0067   Standard_EXPORT double YStep() const;
0068 
0069   //! returns the x Angle of the grid, relatively to the horizontal.
0070   Standard_EXPORT double FirstAngle() const;
0071 
0072   //! returns the y Angle of the grid, relatively to the vertical.
0073   Standard_EXPORT double SecondAngle() const;
0074 
0075   //! Set full extent of the bounded grid along the plane X direction (plane-local units).
0076   //! 0.0 (default) means unbounded - the shader draws the grid to the horizon.
0077   Standard_EXPORT void SetSizeX(const double theSize);
0078 
0079   //! Return the bounded-region extent along plane X. 0.0 means unbounded.
0080   double SizeX() const { return mySizeX; }
0081 
0082   //! Set full extent of the bounded grid along the plane Y direction (plane-local units).
0083   //! 0.0 (default) means unbounded.
0084   Standard_EXPORT void SetSizeY(const double theSize);
0085 
0086   //! Return the bounded-region extent along plane Y. 0.0 means unbounded.
0087   double SizeY() const { return mySizeY; }
0088 
0089   //! Set signed offset (plane-local units) applied along the plane normal for
0090   //! display only - snap math stays on the plane. Use a small negative value
0091   //! to push the grid slightly below coplanar geometry and avoid z-fighting.
0092   Standard_EXPORT void SetZOffset(const double theOffset);
0093 
0094   //! Return the display-time Z-offset along the plane normal.
0095   double ZOffset() const { return myZOffset; }
0096 
0097   Standard_EXPORT void Init() override;
0098 
0099   //! Dumps the content of me into the stream
0100   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0101 
0102 private:
0103   Standard_EXPORT bool CheckAngle(const double alpha, const double beta) const;
0104 
0105 private:
0106   double myXStep;
0107   double myYStep;
0108   double myFirstAngle;
0109   double mySecondAngle;
0110   double mySizeX;
0111   double mySizeY;
0112   double myZOffset;
0113   double a1;
0114   double b1;
0115   double c1;
0116   double a2;
0117   double b2;
0118   double c2;
0119 };
0120 
0121 #endif // _Aspect_RectangularGrid_HeaderFile