Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:14:51

0001 // Created on: 1995-03-17
0002 // Created by: Mister rmi
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_CircularGrid_HeaderFile
0018 #define _Aspect_CircularGrid_HeaderFile
0019 
0020 #include <Standard_Integer.hxx>
0021 #include <Aspect_Grid.hxx>
0022 
0023 class Aspect_CircularGrid : public Aspect_Grid
0024 {
0025   DEFINE_STANDARD_RTTIEXT(Aspect_CircularGrid, Aspect_Grid)
0026 public:
0027   //! creates a new grid. By default this grid is not
0028   //! active.
0029   Standard_EXPORT Aspect_CircularGrid(const double aRadiusStep,
0030                                       const int    aDivisionNumber,
0031                                       const double XOrigin        = 0,
0032                                       const double anYOrigin      = 0,
0033                                       const double aRotationAngle = 0);
0034 
0035   //! defines the x step of the grid.
0036   Standard_EXPORT void SetRadiusStep(const double aStep);
0037 
0038   //! defines the step of the grid.
0039   Standard_EXPORT void SetDivisionNumber(const int aNumber);
0040 
0041   Standard_EXPORT void SetGridValues(const double XOrigin,
0042                                      const double YOrigin,
0043                                      const double RadiusStep,
0044                                      const int    DivisionNumber,
0045                                      const double RotationAngle);
0046 
0047   //! returns the point of the grid the closest to the point X,Y
0048   Standard_EXPORT void Compute(const double X,
0049                                const double Y,
0050                                double&      gridX,
0051                                double&      gridY) const override;
0052 
0053   //! returns the x step of the grid.
0054   Standard_EXPORT double RadiusStep() const;
0055 
0056   //! returns the x step of the grid.
0057   Standard_EXPORT int DivisionNumber() const;
0058 
0059   //! Set the circular grid radius (plane-local units). 0.0 (default) means
0060   //! unbounded - the shader draws the grid to the horizon.
0061   Standard_EXPORT void SetRadius(const double theRadius);
0062 
0063   //! Return the bounded radius. 0.0 means unbounded.
0064   double Radius() const { return myRadius; }
0065 
0066   //! Set signed offset along the plane normal for display only; snap math
0067   //! stays on the plane. Use a small negative value to avoid z-fighting with
0068   //! coplanar geometry.
0069   Standard_EXPORT void SetZOffset(const double theOffset);
0070 
0071   //! Return the display-time Z-offset along the plane normal.
0072   double ZOffset() const { return myZOffset; }
0073 
0074   //! Restrict the grid to an angular wedge, walking counter-clockwise from
0075   //! @p theStart to @p theEnd (radians, measured from the rotated plane X
0076   //! axis). Setting both values equal (e.g. both 0.0) returns to full-circle
0077   //! rendering - the sentinel used for unbounded.
0078   Standard_EXPORT void SetArcRange(const double theStart, const double theEnd);
0079 
0080   //! Return the arc start angle (radians). Meaningful only when IsArc() is true.
0081   double AngleStart() const { return myAngleStart; }
0082 
0083   //! Return the arc end angle (radians). Meaningful only when IsArc() is true.
0084   double AngleEnd() const { return myAngleEnd; }
0085 
0086   //! Return TRUE when the grid is restricted to an angular wedge.
0087   bool IsArc() const { return myAngleStart != myAngleEnd; }
0088 
0089   Standard_EXPORT void Init() override;
0090 
0091   //! Dumps the content of me into the stream
0092   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0093 
0094 private:
0095   double myRadiusStep;
0096   int    myDivisionNumber;
0097   double myAlpha;
0098   double myA1;
0099   double myB1;
0100   double myRadius;
0101   double myZOffset;
0102   double myAngleStart;
0103   double myAngleEnd;
0104 };
0105 
0106 #endif // _Aspect_CircularGrid_HeaderFile