1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// File: BRepPrim_Sphere.cxx
// Created: Fri Nov 6 13:28:47 1992
// Author: Remi LEQUETTE
// <rle@phylox>
#include <BRepPrim_Sphere.ixx>
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <Precision.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom2d_Circle.hxx>
// parametres sur le meridien
#define PMIN (-0.5*PI)
#define PMAX (0.5*PI)
//=======================================================================
//function : BRepPrim_Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere::BRepPrim_Sphere(const Standard_Real Radius) :
BRepPrim_Revolution(gp::XOY(),PMIN,PMAX),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere::BRepPrim_Sphere(const gp_Pnt& Center,
const Standard_Real Radius) :
BRepPrim_Revolution(gp_Ax2(Center,gp_Dir(0,0,1),gp_Dir(1,0,0)),
PMIN,PMAX),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : BRepPrim_Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere::BRepPrim_Sphere(const gp_Ax2& Axes,
const Standard_Real Radius) :
BRepPrim_Revolution(Axes,PMIN,PMAX),
myRadius(Radius)
{
SetMeridian();
}
//=======================================================================
//function : MakeEmptyLateralFace
//purpose :
//=======================================================================
TopoDS_Face BRepPrim_Sphere::MakeEmptyLateralFace()const
{
Handle(Geom_SphericalSurface) S =
new Geom_SphericalSurface(Axes(),myRadius);
TopoDS_Face F;
myBuilder.Builder().MakeFace(F,S,Precision::Confusion());
return F;
}
//=======================================================================
//function : SetMeridian
//purpose :
//=======================================================================
void BRepPrim_Sphere::SetMeridian()
{
// Offset the parameters on the meridian
// to trim the edge in 3pi/2, 5pi/2
SetMeridianOffset(2*PI);
gp_Dir D = Axes().YDirection();
D.Reverse();
gp_Ax2 A(Axes().Location(),D,Axes().XDirection());
Handle(Geom_Circle) C = new Geom_Circle(A,myRadius);
Handle(Geom2d_Circle) C2d =
new Geom2d_Circle(gp_Ax2d(gp_Pnt2d(0,0),gp_Dir2d(1,0)),
myRadius);
Meridian(C,C2d);
}
|