MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
occ_cg_forme_volume_tore.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// occ_cg_forme_volume_tore.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:54 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #ifdef ALL_OCC
24 #include "mg_cg_modele.h"
25 #include "occ_fonction.h"
26 #include "occ_fonction_v2017.h"
27 #include <TopoDS_Shape.hxx>
28 #include <BRepPrimAPI_MakeTorus.hxx>
29 #include <gp_Pnt.hxx>
30 
31 #include <gp_Ax1.hxx>
32 #include <gp_Ax2.hxx>
33 #include "gp_Trsf.hxx"
34 
35  //--------------with 1 angle-------------------------------
36  //==================================================================
37 
39  double centre_x,
40  double centre_y,
41  double centre_z,
42  double direction_x,
43  double direction_y,
44  double direction_z,
45  double rayon_cercle,
46  double rayon_tore,
47  double angle_seg,
48  double angle_rotation
49  ): MG_CG_FORME_VOLUME_TORE(mgcg_modele,centre_x,centre_y,centre_z,direction_x,direction_y,direction_z,rayon_cercle,rayon_tore,angle_seg,angle_rotation)
50 {
51 
52 }
53 
55  int etat,
56  long unsigned int num,
57  MG_VOLUME* mg_volume,
58  double centre_x,
59  double centre_y,
60  double centre_z,
61  double direction_x,
62  double direction_y,
63  double direction_z,
64  double rayon_cercle,
65  double rayon_tore,
66  double angle_seg,
67  double angle_rotation
68  ): MG_CG_FORME_VOLUME_TORE(mgcg_modele,etat,num,mg_volume,centre_x,centre_y,centre_z,direction_x,direction_y,direction_z,rayon_cercle,rayon_tore,angle_seg,angle_rotation)
69 {
70 
71 }
72 
73 
74  //--------------with 2 angle-------------------------------
75  //==================================================================
76  /*
77 OCC_CG_FORME_VOLUME_TORE::OCC_CG_FORME_VOLUME_TORE(MG_CG_MODELE* mgcg_modele,
78  double centre_x,
79  double centre_y,
80  double centre_z,
81  double direction_x,
82  double direction_y,
83  double direction_z,
84  double rayon_cercle,
85  double rayon_tore,
86  double angle_begin,
87  double angle_end
88 
89  ): MG_CG_FORME_VOLUME_TORE(mgcg_modele,centre_x,centre_y,centre_z,direction_x,direction_y,direction_z,rayon_cercle,rayon_tore,angle_begin,angle_end)
90 {
91 
92 }
93 
94 OCC_CG_FORME_VOLUME_TORE::OCC_CG_FORME_VOLUME_TORE(MG_CG_MODELE* mgcg_modele,
95  int etat,
96  long unsigned int num,
97  MG_VOLUME* mg_volume,
98  double centre_x,
99  double centre_y,
100  double centre_z,
101  double direction_x,
102  double direction_y,
103  double direction_z,
104  double rayon_cercle,
105  double rayon_tore,
106  double angle_begin,
107  double angle_end
108  ): MG_CG_FORME_VOLUME_TORE(mgcg_modele,etat,num,mg_volume,centre_x,centre_y,centre_z,direction_x,direction_y,direction_z,rayon_cercle,rayon_tore,angle_begin,angle_end)
109 {
110 
111 }
112 */
113 
115 {
116 
117 }
118 
120 {
121 
122 }
123 
125 {
126  if(m_mgcg_modele==NULL)
127  {
128  std::cout << "*** ERREUR : OCC_CG_FORME_VOLUME_TORE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
129  return FAIL;
130  }
135 }
136 
137 int OCC_CG_FORME_VOLUME_TORE::construire(bool fusionner_entite_similaire, double precision, bool importer_triangulation, double epsilon_triangulation)
138 {
139  if(m_mgcg_modele==NULL)
140  {
141  std::cout << "*** ERREUR : OCC_CG_FORME_VOLUME_TORE::construire_forme -> MG_CG_MODELE NULL ***" << std::endl;
142  return FAIL;
143  }
144  //---------------------------------------------------------------------------------------------------------------------
145  //==================default=================================================
146  //gp_Pnt gp_pnt_centre(m_centre[0],m_centre[1],m_centre[2]);
147  //gp_Ax2 axe_tore(gp_pnt_centre,gp_Dir(m_direction[0],m_direction[1],m_direction[2]));
148  // =================================================================================
149 
150  gp_Pnt gp_pnt_centre(m_centre[0],m_centre[1],m_centre[2]);
151  gp_Dir gp_direction_axe(m_direction[0],m_direction[1],m_direction[2]);
152 
153  gp_Ax2 axe_tore(gp_pnt_centre,gp_direction_axe);
154 
155 
156 
157  gp_Trsf rotation;
158  gp_Ax1 rotationAxis(gp_Pnt(m_centre[0],m_centre[1],m_centre[2]),gp_Dir(m_direction[0],m_direction[1],m_direction[2]));
159  rotation.SetRotation(rotationAxis,m_angle_rotation);
160  axe_tore.Transform(rotation);
161  //--------------with 1 angle-------------------------------
162  //==================================================================
163 
164  TopoDS_Shape topods_shape = BRepPrimAPI_MakeTorus(axe_tore,m_rayon_cercle,m_rayon_tore,m_angle_seg).Shape();
165 
166  //================================================================================
167  //--------------with 2 angle-------------------------------
168 
169  //TopoDS_Shape topods_shape = BRepPrimAPI_MakeTorus(axe_tore,m_rayon_cercle,m_rayon_tore,m_angle_begin,m_angle_end).Shape();
170 
171  //==================================================================
172 
174  if(occ_fonction->get_version()=="OCCV2017")
175  {
176  OCC_FONCTION_V2017* occ_fonction_v2017 = (OCC_FONCTION_V2017*)occ_fonction;
177  m_mg_volume = occ_fonction_v2017->importer_TopoDS_Solid(TopoDS::Solid(topods_shape),
178  NULL,
179  NULL,
180  NULL,
182  fusionner_entite_similaire,
183  precision);
184  }
185  change_etat(MG_CG_FORME::ETAT_FORME::CONSTRUITE);
187  return OK;
188 }
189 
190 #endif
MG_CG_FORME_VOLUME_TORE::m_centre
double m_centre[3]
Definition: mg_cg_forme_volume_tore.h:151
FAIL
const int FAIL
Definition: mg_definition.h:39
OCC_CG_FORME_VOLUME_TORE
Definition: occ_cg_forme_volume_tore.h:38
MG_CG_MODELE::get_epsilon_triangulation
virtual double get_epsilon_triangulation(void)
Definition: mg_cg_modele.cpp:1119
OCC_CG_FORME_VOLUME_TORE::construire
virtual int construire(void)
Definition: occ_cg_forme_volume_tore.cpp:124
MG_CG_FORME::change_etat
virtual void change_etat(int etat_forme)
Definition: mg_cg_forme.cpp:81
OK
const int OK
Definition: mg_definition.h:38
MG_VOLUME
Definition: mg_volume.h:33
MG_CG_FORME_VOLUME_TORE::m_angle_seg
double m_angle_seg
Definition: mg_cg_forme_volume_tore.h:159
MG_CG_MODELE::mise_a_jout_lien_mg_element_mgcg_forme
virtual void mise_a_jout_lien_mg_element_mgcg_forme(MG_CG_FORME *mgcg_forme)
Definition: mg_cg_modele.cpp:987
MG_CG_MODELE::get_mg_geometrie
virtual MG_GEOMETRIE * get_mg_geometrie(void)
Definition: mg_cg_modele.cpp:98
MG_CG_FORME_VOLUME_TORE::m_rayon_tore
double m_rayon_tore
Definition: mg_cg_forme_volume_tore.h:154
OCC_CG_FORME_VOLUME_TORE::~OCC_CG_FORME_VOLUME_TORE
virtual ~OCC_CG_FORME_VOLUME_TORE()
Definition: occ_cg_forme_volume_tore.cpp:119
MG_CG_MODELE::get_precision
virtual double get_precision(void)
Definition: mg_cg_modele.cpp:1099
MG_CG_FORME_VOLUME_TORE::m_rayon_cercle
double m_rayon_cercle
Definition: mg_cg_forme_volume_tore.h:153
MG_CG_FORME::m_mgcg_modele
MG_CG_MODELE * m_mgcg_modele
Definition: mg_cg_forme.h:87
MG_CG_MODELE
Definition: mg_cg_modele.h:41
occ_fonction_v2017.h
MG_CG_FORME_VOLUME_TORE::m_angle_rotation
double m_angle_rotation
Definition: mg_cg_forme_volume_tore.h:160
mg_cg_modele.h
MG_CG_FORME_VOLUME_TORE
Definition: mg_cg_forme_volume_tore.h:36
MG_CG_MODELE::get_fusionner_entite_similaire
virtual bool get_fusionner_entite_similaire(void)
Definition: mg_cg_modele.cpp:1089
occ_cg_forme_volume_tore.h
MG_CG_MODELE::get_importer_triangulation
virtual bool get_importer_triangulation(void)
Definition: mg_cg_modele.cpp:1109
MG_CG_FORME_VOLUME::m_mg_volume
MG_VOLUME * m_mg_volume
Definition: mg_cg_forme_volume.h:65
OCC_FONCTION_V2017
Definition: occ_fonction_v2017.h:104
occ_fonction.h
OCC_FONCTION
Definition: occ_fonction.h:40
MG_CG_FORME_VOLUME_TORE::m_direction
double m_direction[3]
Definition: mg_cg_forme_volume_tore.h:152
MG_GEOMETRIE::get_occ_fonction
class OCC_FONCTION & get_occ_fonction(void)
Definition: mg_geometrie.cpp:2701
OCC_FONCTION::get_version
virtual std::string get_version(void)
Definition: occ_fonction.cpp:88
OCC_FONCTION_V2017::importer_TopoDS_Solid
MG_VOLUME * importer_TopoDS_Solid(TopoDS_Solid topods_solid, std::map< MG_ELEMENT_TOPOLOGIQUE *, MG_ELEMENT_TOPOLOGIQUE * > *map_nouveau_mg_element_topologique, std::map< MG_ELEMENT_COTOPOLOGIQUE *, MG_ELEMENT_COTOPOLOGIQUE * > *map_nouveau_mg_element_cotopologique, std::map< MG_ELEMENT_GEOMETRIQUE *, MG_ELEMENT_GEOMETRIQUE * > *map_nouveau_mg_element_geometrique, MG_GEOMETRIE *mg_geometrie=NULL, bool fusionner_entite_similaire=false, double precision=1e-6)
Definition: occ_fonction_v2017.cpp:546
OCC_CG_FORME_VOLUME_TORE::OCC_CG_FORME_VOLUME_TORE
OCC_CG_FORME_VOLUME_TORE(MG_CG_MODELE *mgcg_modele, double centre_x, double centre_y, double centre_z, double direction_x, double direction_y, double direction_z, double rayon_cercle, double rayon_tore, double angle_seg=2 *M_PI, double angle_rotation=0.0)
Definition: occ_cg_forme_volume_tore.cpp:38