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 | |
17 | #include <BRepPrim_Revolution.ixx> |
18 | |
19 | #include <Precision.hxx> |
20 | #include <Geom_SurfaceOfRevolution.hxx> |
21 | |
22 | //======================================================================= |
23 | //function : BRepPrim_Revolution |
24 | //purpose : |
25 | //======================================================================= |
26 | |
27 | BRepPrim_Revolution::BRepPrim_Revolution(const gp_Ax2& A, |
28 | const Standard_Real VMin, |
29 | const Standard_Real VMax, |
30 | const Handle(Geom_Curve)& M, |
31 | const Handle(Geom2d_Curve)& PM) : |
32 | BRepPrim_OneAxis(BRepPrim_Builder(),A,VMin,VMax), |
33 | myMeridian(M), |
34 | myPMeridian(PM) |
35 | { |
36 | } |
37 | |
38 | //======================================================================= |
39 | //function : BRepPrim_Revolution |
40 | //purpose : |
41 | //======================================================================= |
42 | |
43 | BRepPrim_Revolution::BRepPrim_Revolution(const gp_Ax2& A, |
44 | const Standard_Real VMin, |
45 | const Standard_Real VMax) : |
46 | BRepPrim_OneAxis(BRepPrim_Builder(),A,VMin,VMax) |
47 | { |
48 | } |
49 | |
50 | //======================================================================= |
51 | //function : Meridian |
52 | //purpose : |
53 | //======================================================================= |
54 | |
55 | void BRepPrim_Revolution::Meridian(const Handle(Geom_Curve)& M, |
56 | const Handle(Geom2d_Curve)& PM) |
57 | { |
58 | myMeridian = M; |
59 | myPMeridian = PM; |
60 | } |
61 | |
62 | //======================================================================= |
63 | //function : MakeEmptyLateralFace |
64 | //purpose : |
65 | //======================================================================= |
66 | |
67 | TopoDS_Face BRepPrim_Revolution::MakeEmptyLateralFace() const |
68 | { |
69 | Handle(Geom_SurfaceOfRevolution) S = |
70 | new Geom_SurfaceOfRevolution(myMeridian,Axes().Axis()); |
71 | |
72 | TopoDS_Face F; |
73 | myBuilder.Builder().MakeFace(F,S,Precision::Confusion()); |
74 | return F; |
75 | } |
76 | |
77 | //======================================================================= |
78 | //function : MakeEmptyMeridianEdge |
79 | //purpose : |
80 | //======================================================================= |
81 | |
82 | TopoDS_Edge BRepPrim_Revolution::MakeEmptyMeridianEdge(const Standard_Real Ang) const |
83 | { |
84 | TopoDS_Edge E; |
85 | Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast(myMeridian->Copy()); |
86 | gp_Trsf T; |
87 | T.SetRotation(Axes().Axis(),Ang); |
88 | C->Transform(T); |
89 | myBuilder.Builder().MakeEdge(E,C,Precision::Confusion()); |
90 | return E; |
91 | } |
92 | |
93 | //======================================================================= |
94 | //function : MeridianValue |
95 | //purpose : |
96 | //======================================================================= |
97 | |
98 | gp_Pnt2d BRepPrim_Revolution::MeridianValue(const Standard_Real V) const |
99 | { |
100 | return myPMeridian->Value(V); |
101 | } |
102 | |
103 | //======================================================================= |
104 | //function : SetMeridianPCurve |
105 | //purpose : |
106 | //======================================================================= |
107 | |
108 | void BRepPrim_Revolution::SetMeridianPCurve(TopoDS_Edge& E, |
109 | const TopoDS_Face& F) const |
110 | { |
111 | myBuilder.Builder().UpdateEdge(E,myPMeridian,F,Precision::Confusion()); |
112 | } |
113 | |