26 #include <TopoDS_Shape.hxx>
27 #include <TopoDS_Edge.hxx>
28 #include <TopoDS_Wire.hxx>
29 #include <TopoDS_TFace.hxx>
30 #include <gp_Elips.hxx>
31 #include <GC_MakeArcOfEllipse.hxx>
32 #include <Geom_TrimmedCurve.hxx>
36 #include <BRepBuilderAPI_MakeEdge.hxx>
37 #include <BRepBuilderAPI_MakeWire.hxx>
38 #include <BRepBuilderAPI_MakeFace.hxx>
39 #include <BRepPrimAPI_MakeRevol.hxx>
43 MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION::MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION(
double centre_x,
double centre_y,
double centre_z,
44 double axe_x,
double axe_y,
double axe_z,
45 double rayon_majeur,
double rayon_mineur)
53 m_dimensions[0]=rayon_majeur;
54 m_dimensions[1]=rayon_mineur;
57 MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION::MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION(
long unsigned int num,
58 double centre_x,
double centre_y,
double centre_z,
59 double axe_x,
double axe_y,
double axe_z,
60 double rayon_majeur,
double rayon_mineur): MG_PRIMITIVE(num)
68 m_dimensions[0]=rayon_majeur;
69 m_dimensions[1]=rayon_mineur;
71 MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION::MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION(MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION& mdd):MG_PRIMITIVE(mdd)
76 MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION::~MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION()
81 void MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION::construit(
void)
83 centre_ellipsoide =
new gp_Pnt(m_centre[0],m_centre[1],m_centre[2]);
84 direction_ellipsoide =
new gp_Dir(m_axe[0],m_axe[1],m_axe[2]);
85 axe_ellipsoide =
new gp_Ax2;
86 axe_ellipsoide->SetLocation(*centre_ellipsoide);
87 axe_ellipsoide->SetDirection(*direction_ellipsoide);
88 axe_ellipsoide->Rotate(gp_Ax1(*centre_ellipsoide,axe_ellipsoide->YDirection()),M_PI/2.);
89 if(m_dimensions[0]>=m_dimensions[1])
91 ellipse =
new gp_Elips(*axe_ellipsoide,m_dimensions[0],m_dimensions[1]);
95 ellipse =
new gp_Elips(*axe_ellipsoide,m_dimensions[1],m_dimensions[0]);
97 edge =
new TopoDS_Edge;
98 *edge = BRepBuilderAPI_MakeEdge(*ellipse,0.0,M_PI).Edge();
99 wire =
new TopoDS_Wire;
100 *wire = BRepBuilderAPI_MakeWire(*edge).Wire();
101 face =
new TopoDS_Face;
102 *face = BRepBuilderAPI_MakeFace(*wire,
true);
103 direction_axe_revolution =
new gp_Dir(m_axe[0],m_axe[1],m_axe[2]);
104 axe_revolution =
new gp_Ax1;
105 axe_revolution->SetLocation(*centre_ellipsoide);
106 axe_revolution->SetDirection(*direction_axe_revolution);
107 forme = BRepPrimAPI_MakeRevol(*face,*axe_revolution,2.*M_PI).Shape();
110 void MG_PRIMITIVE_ELLIPSOIDE_REVOLUTION::enregistrer(std::ostream& o,
double version)
112 o <<
"%" << get_id() <<
"=ELLIPSOIDE_REVOLUTION("<< m_centre[0] <<
"," << m_centre[1] <<
"," << m_centre[2]
113 <<
"," << m_axe[0] <<
"," << m_axe[1] <<
"," << m_axe[2]
114 <<
"," << m_dimensions[0] <<
"," << m_dimensions[1]
115 <<
");" << std::endl;