1 // Created on: 2016-02-04
2 // Created by: Anastasia BORISOVA
3 // Copyright (c) 2016 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Prs3d_ToolQuadric_HeaderFile
17 #define _Prs3d_ToolQuadric_HeaderFile
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>
28 //! Base class to build 3D surfaces presentation of quadric surfaces.
29 class Prs3d_ToolQuadric
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);
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);
41 //! Number of triangles for presentation with the given params.
42 static Standard_Integer TrianglesNb (const Standard_Integer theSlicesNb,
43 const Standard_Integer theStacksNb)
45 return theSlicesNb * theStacksNb * 2;
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);
53 //! Number of triangles in generated presentation.
54 Standard_Integer TrianglesNb() const
56 return mySlicesNb * myStacksNb * 2;
59 //! Redefine this method to generate vertex at given parameters.
60 virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) = 0;
62 //! Redefine this method to generate normal at given parameters.
63 virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) = 0;
67 Standard_Integer mySlicesNb;
68 Standard_Integer myStacksNb;
71 #endif // _Prs3d_ToolQuadric_HeaderFile