1 // Created on: 1992-11-06
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
24 #include <BRepPrim_Torus.ixx>
28 #include <gp_Ax2d.hxx>
29 #include <Precision.hxx>
31 #include <Geom_ToroidalSurface.hxx>
32 #include <Geom_Circle.hxx>
33 #include <Geom2d_Circle.hxx>
35 //=======================================================================
36 //function : BRepPrim_Torus
38 //=======================================================================
40 BRepPrim_Torus::BRepPrim_Torus(const gp_Ax2& Position,
41 const Standard_Real Major,
42 const Standard_Real Minor) :
43 BRepPrim_Revolution(Position,0,2*M_PI),
50 //=======================================================================
51 //function : BRepPrim_Torus
53 //=======================================================================
55 BRepPrim_Torus::BRepPrim_Torus(const Standard_Real Major,
56 const Standard_Real Minor) :
57 BRepPrim_Revolution(gp::XOY(),0,2*M_PI),
64 //=======================================================================
65 //function : BRepPrim_Torus
67 //=======================================================================
69 BRepPrim_Torus::BRepPrim_Torus(const gp_Pnt& Center,
70 const Standard_Real Major,
71 const Standard_Real Minor) :
72 BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
80 //=======================================================================
81 //function : MakeEmptyLateralFace
83 //=======================================================================
85 TopoDS_Face BRepPrim_Torus::MakeEmptyLateralFace()const
87 Handle(Geom_ToroidalSurface) T =
88 new Geom_ToroidalSurface(Axes(),myMajor,myMinor);
90 myBuilder.Builder().MakeFace(F,T,Precision::Confusion());
95 //=======================================================================
96 //function : SetMeridian
98 //=======================================================================
100 void BRepPrim_Torus::SetMeridian()
102 gp_Dir D = Axes().YDirection();
104 gp_Ax2 A(Axes().Location(),D,Axes().XDirection());
105 gp_Vec V = Axes().XDirection();
108 Handle(Geom_Circle) C = new Geom_Circle(A,myMinor);
109 Handle(Geom2d_Circle) C2d = new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(myMajor,0),