0031313: Foundation Classes - Dump improvement for classes
[occt.git] / src / Prs3d / Prs3d_ToolDisk.cxx
CommitLineData
625e1958 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
62ef08df 16#include <Prs3d_ToolDisk.hxx>
625e1958 17
18#include <Graphic3d_ArrayOfTriangles.hxx>
19#include <Poly_Array1OfTriangle.hxx>
62ef08df 20#include <Prs3d_ToolQuadric.hxx>
625e1958 21
22//=======================================================================
23//function : Constructor
24//purpose :
25//=======================================================================
62ef08df 26Prs3d_ToolDisk::Prs3d_ToolDisk (const Standard_Real theInnerRadius,
27 const Standard_Real theOuterRadius,
28 const Standard_Integer theNbSlices,
29 const Standard_Integer theNbStacks)
625e1958 30: myInnerRadius (theInnerRadius),
2108d9a2 31 myOuterRadius (theOuterRadius),
32 myStartAngle (0.0),
33 myEndAngle (M_PI * 2.0)
625e1958 34{
caf231b0 35 mySlicesNb = theNbSlices;
36 myStacksNb = theNbStacks;
625e1958 37}
38
39//=======================================================================
40//function : Vertex
41//purpose :
42//=======================================================================
62ef08df 43gp_Pnt Prs3d_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV)
625e1958 44{
2108d9a2 45 const Standard_Real aU = myStartAngle + theU * (myEndAngle - myStartAngle);
caf231b0 46 const Standard_Real aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
47 return gp_Pnt (Cos (aU) * aRadius,
48 Sin (aU) * aRadius,
49 0.0);
625e1958 50}
51
caf231b0 52//=======================================================================
53//function : Perform
54//purpose :
55//=======================================================================
62ef08df 56Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolDisk::Create (const Standard_Real theInnerRadius,
57 const Standard_Real theOuterRadius,
58 const Standard_Integer theNbSlices,
59 const Standard_Integer theNbStacks,
60 const gp_Trsf& theTrsf)
caf231b0 61{
62 Handle(Graphic3d_ArrayOfTriangles) anArray;
62ef08df 63 Prs3d_ToolDisk aTool (theInnerRadius, theOuterRadius, theNbSlices, theNbStacks);
caf231b0 64 aTool.FillArray (anArray, theTrsf);
65 return anArray;
625e1958 66}