0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / Prs3d / Prs3d_ToolQuadric.hxx
1 // Created on: 2016-02-04
2 // Created by: Anastasia BORISOVA
3 // Copyright (c) 2016 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _Prs3d_ToolQuadric_HeaderFile
17 #define _Prs3d_ToolQuadric_HeaderFile
18
19 #include <gp_Ax1.hxx>
20 #include <Graphic3d_ArrayOfPrimitives.hxx>
21 #include <Graphic3d_ArrayOfTriangles.hxx>
22 #include <Poly_Triangulation.hxx>
23 #include <Prs3d_Root.hxx>
24 #include <Prs3d_Drawer.hxx>
25 #include <SelectMgr_Selection.hxx>
26 #include <Standard.hxx>
27
28 //! Base class to build 3D surfaces presentation of quadric surfaces.
29 class Prs3d_ToolQuadric
30 {
31 public:
32
33   DEFINE_STANDARD_ALLOC
34
35   //! Generate primitives for 3D quadric surface and fill the given array. Optional transformation is applied.
36   Standard_EXPORT void FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, const gp_Trsf& theTrsf);
37
38   //! Generate primitives for 3D quadric surface presentation and fill the given array and poly triangulation structure. Optional transformation is applied.
39   Standard_EXPORT void FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, Handle(Poly_Triangulation)& theTriangulation, const gp_Trsf& theTrsf);
40
41   //! Number of triangles for presentation with the given params.
42   static Standard_Integer TrianglesNb (const Standard_Integer theSlicesNb,
43                                        const Standard_Integer theStacksNb)
44   {
45     return theSlicesNb * theStacksNb * 2;
46   }
47
48 protected:
49
50   //! Method implements an algorithm to generate arrays of vertices and normals for 3D surface.
51   Standard_EXPORT void fillArrays (const gp_Trsf& theTrsf, TColgp_Array1OfPnt& theArray, NCollection_Array1<gp_Dir>& theNormals);
52
53   //! Number of triangles in generated presentation.
54   Standard_Integer TrianglesNb() const
55   {
56     return mySlicesNb * myStacksNb * 2;
57   }
58
59   //! Redefine this method to generate vertex at given parameters.
60   virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) = 0;
61
62   //! Redefine this method to generate normal at given parameters.
63   virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) = 0;
64
65 protected:
66
67   Standard_Integer mySlicesNb;
68   Standard_Integer myStacksNb;
69 };
70
71 #endif // _Prs3d_ToolQuadric_HeaderFile