0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepPrim / BRepPrim_Revolution.cxx
CommitLineData
b311480e 1// Created on: 1992-11-06
2// Created by: Remi LEQUETTE
3// Copyright (c) 1992-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <BRepPrim_Revolution.hxx>
19#include <Geom2d_Curve.hxx>
ec357c5c 20#include <Geom_Curve.hxx>
42cf5bc1 21#include <Geom_SurfaceOfRevolution.hxx>
22#include <gp_Ax2.hxx>
23#include <gp_Pnt2d.hxx>
24#include <Precision.hxx>
25#include <TopoDS_Edge.hxx>
26#include <TopoDS_Face.hxx>
7fd59977 27
28//=======================================================================
29//function : BRepPrim_Revolution
30//purpose :
31//=======================================================================
7fd59977 32BRepPrim_Revolution::BRepPrim_Revolution(const gp_Ax2& A,
33 const Standard_Real VMin,
34 const Standard_Real VMax,
35 const Handle(Geom_Curve)& M,
36 const Handle(Geom2d_Curve)& PM) :
37 BRepPrim_OneAxis(BRepPrim_Builder(),A,VMin,VMax),
38 myMeridian(M),
39 myPMeridian(PM)
40{
41}
42
43//=======================================================================
44//function : BRepPrim_Revolution
45//purpose :
46//=======================================================================
47
48BRepPrim_Revolution::BRepPrim_Revolution(const gp_Ax2& A,
49 const Standard_Real VMin,
50 const Standard_Real VMax) :
51 BRepPrim_OneAxis(BRepPrim_Builder(),A,VMin,VMax)
52{
53}
54
55//=======================================================================
56//function : Meridian
57//purpose :
58//=======================================================================
59
60void BRepPrim_Revolution::Meridian(const Handle(Geom_Curve)& M,
61 const Handle(Geom2d_Curve)& PM)
62{
63 myMeridian = M;
64 myPMeridian = PM;
65}
66
67//=======================================================================
68//function : MakeEmptyLateralFace
69//purpose :
70//=======================================================================
71
72TopoDS_Face BRepPrim_Revolution::MakeEmptyLateralFace() const
73{
74 Handle(Geom_SurfaceOfRevolution) S =
75 new Geom_SurfaceOfRevolution(myMeridian,Axes().Axis());
76
77 TopoDS_Face F;
78 myBuilder.Builder().MakeFace(F,S,Precision::Confusion());
79 return F;
80}
81
82//=======================================================================
83//function : MakeEmptyMeridianEdge
84//purpose :
85//=======================================================================
86
87TopoDS_Edge BRepPrim_Revolution::MakeEmptyMeridianEdge(const Standard_Real Ang) const
88{
89 TopoDS_Edge E;
90 Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast(myMeridian->Copy());
91 gp_Trsf T;
92 T.SetRotation(Axes().Axis(),Ang);
93 C->Transform(T);
94 myBuilder.Builder().MakeEdge(E,C,Precision::Confusion());
95 return E;
96}
97
98//=======================================================================
99//function : MeridianValue
100//purpose :
101//=======================================================================
102
103gp_Pnt2d BRepPrim_Revolution::MeridianValue(const Standard_Real V) const
104{
105 return myPMeridian->Value(V);
106}
107
108//=======================================================================
109//function : SetMeridianPCurve
110//purpose :
111//=======================================================================
112
113void BRepPrim_Revolution::SetMeridianPCurve(TopoDS_Edge& E,
114 const TopoDS_Face& F) const
115{
116 myBuilder.Builder().UpdateEdge(E,myPMeridian,F,Precision::Confusion());
117}
118