1 |
francois |
283 |
//--------------------------------------------------------------------------- |
2 |
|
|
//------------------------------------------------------------ |
3 |
|
|
//------------------------------------------------------------ |
4 |
|
|
// MAGiC |
5 |
|
|
// Jean Christophe Cuilli�re et Vincent FRANCOIS |
6 |
|
|
// D�partement de G�nie M�canique - UQTR |
7 |
|
|
//------------------------------------------------------------ |
8 |
|
|
// Le projet MAGIC est un projet de recherche du d�partement |
9 |
|
|
// de g�nie m�canique de l'Universit� du Qu�bec � |
10 |
|
|
// Trois Rivi�res |
11 |
|
|
// Les librairies ne peuvent �tre utilis�es sans l'accord |
12 |
|
|
// des auteurs (contact : francois@uqtr.ca) |
13 |
|
|
//------------------------------------------------------------ |
14 |
|
|
//------------------------------------------------------------ |
15 |
|
|
// |
16 |
|
|
// occ_point.cpp |
17 |
|
|
// |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
//------------------------------------------------------------ |
20 |
|
|
// COPYRIGHT 2000 |
21 |
|
|
// Version du 02/03/2006 � 11H22 |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
//------------------------------------------------------------ |
24 |
|
|
//--------------------------------------------------------------------------- |
25 |
|
|
#pragma hdrstop |
26 |
|
|
#include "gestionversion.h" |
27 |
|
|
#ifdef BREP_OCC |
28 |
|
|
|
29 |
|
|
#include "occ_point.h" |
30 |
couturad |
906 |
#include "occ_fonction_v2017.h" |
31 |
francois |
283 |
#include "constantegeo.h" |
32 |
|
|
|
33 |
|
|
//--------------------------------------------------------------------------- |
34 |
|
|
#pragma package(smart_init) |
35 |
couturad |
906 |
OCC_POINT::OCC_POINT(unsigned long num,TopoDS_Vertex pt, class OCC_FONCTION* fonc):MG_POINT(num),point(pt), fonction1(fonc) |
36 |
francois |
283 |
{ |
37 |
|
|
} |
38 |
couturad |
906 |
OCC_POINT::OCC_POINT(TopoDS_Vertex pt, class OCC_FONCTION* fonc):MG_POINT(),point(pt), fonction1(fonc) |
39 |
francois |
283 |
{ |
40 |
|
|
} |
41 |
couturad |
906 |
OCC_POINT::OCC_POINT(TopoDS_Vertex pt) :MG_POINT(),point(pt) |
42 |
|
|
{ |
43 |
|
|
} |
44 |
francois |
283 |
OCC_POINT::OCC_POINT(OCC_POINT& mdd):MG_POINT(mdd),point(mdd.point),fonction1(mdd.fonction1) |
45 |
|
|
{ |
46 |
|
|
} |
47 |
couturad |
906 |
|
48 |
francois |
283 |
OCC_POINT::~OCC_POINT() |
49 |
|
|
{ |
50 |
|
|
} |
51 |
|
|
void OCC_POINT::evaluer(double *xyz) |
52 |
|
|
{ |
53 |
|
|
gp_Pnt p=BRep_Tool::Pnt(point); |
54 |
|
|
p.Coord(xyz[0], xyz[1], xyz[2]); |
55 |
|
|
|
56 |
|
|
} |
57 |
|
|
|
58 |
francois |
763 |
void OCC_POINT::enregistrer(std::ostream& o,double version) |
59 |
francois |
283 |
{ |
60 |
couturad |
906 |
if(fonction1->get_version()=="OCCV2017") |
61 |
|
|
{ |
62 |
couturad |
908 |
#ifdef ALL_OCC |
63 |
couturad |
906 |
OCC_FONCTION_V2017* occ_fonction_v2017 = (OCC_FONCTION_V2017*)fonction1; |
64 |
|
|
MG_ELEMENT_TOPOLOGIQUE* sommet = occ_fonction_v2017->get_MG_ELEMENT_TOPOLOGIQUE(point); |
65 |
|
|
o << "%"<<get_id()<<"=POINT_OCC("<< sommet->get_id()<<");" << std::endl; |
66 |
couturad |
908 |
#else |
67 |
|
|
std::cerr << "OCC_POINT::enregistrer(std::ostream& o,double version) --> Non disponible" << std::endl; |
68 |
|
|
#endif |
69 |
|
|
|
70 |
couturad |
906 |
} |
71 |
|
|
else |
72 |
|
|
{ |
73 |
|
|
o << "%"<<get_id()<<"=POINT_OCC("<<fonction1->GetID(point)<< ");" << std::endl; |
74 |
|
|
} |
75 |
francois |
283 |
} |
76 |
|
|
|
77 |
|
|
int OCC_POINT::get_type_geometrique(TPL_LISTE_ENTITE<double> ¶m) |
78 |
|
|
{ |
79 |
|
|
gp_Pnt p=BRep_Tool::Pnt(point); |
80 |
couturad |
906 |
// Handle(Geom_CartesianPoint) coppoint=new Geom_CartesianPoint(p); |
81 |
|
|
// Handle_Standard_Type type=coppoint->DynamicType(); |
82 |
francois |
283 |
|
83 |
couturad |
906 |
// if (type==STANDARD_TYPE(Geom_CartesianPoint)) |
84 |
|
|
// { |
85 |
|
|
// Handle_Geom_CartesianPoint P=Handle_Geom_CartesianPoint::DownCast(coppoint); |
86 |
francois |
283 |
|
87 |
|
|
double xyz[3]; |
88 |
|
|
param.ajouter(xyz[0]=p.X()); |
89 |
|
|
param.ajouter(xyz[1]=p.Y()); |
90 |
|
|
param.ajouter(xyz[2]=p.Z()); |
91 |
couturad |
906 |
// } |
92 |
francois |
283 |
|
93 |
|
|
return MGCo_POINT; |
94 |
|
|
} |
95 |
|
|
void OCC_POINT::get_param_NURBS(int& indx_premier_ptctr,TPL_LISTE_ENTITE<double> ¶m) |
96 |
|
|
{ |
97 |
|
|
gp_Pnt p=BRep_Tool::Pnt(point); |
98 |
|
|
|
99 |
|
|
// the first parameter indicates the acces code |
100 |
|
|
param.ajouter(0); |
101 |
|
|
// the second parameter indicates the order of the point which should be one for a point |
102 |
|
|
param.ajouter(1); |
103 |
|
|
param.ajouter(0); |
104 |
|
|
|
105 |
|
|
param.ajouter(1); |
106 |
|
|
param.ajouter(0); |
107 |
|
|
|
108 |
|
|
// the third parameter presente the number of the controls point wich correspond to the cordinate point |
109 |
|
|
// note that the cordinate of the control points are given in homogeneous cordinates |
110 |
|
|
// for a point, the weight it's �qual to one. |
111 |
|
|
|
112 |
|
|
param.ajouter(p.X()); |
113 |
|
|
param.ajouter(p.Y()); |
114 |
|
|
param.ajouter(p.Z()); |
115 |
|
|
|
116 |
|
|
param.ajouter(1.); |
117 |
|
|
|
118 |
|
|
indx_premier_ptctr =5; |
119 |
|
|
|
120 |
|
|
|
121 |
|
|
} |
122 |
couturad |
906 |
|
123 |
|
|
void OCC_POINT::change_occ_fonction(OCC_FONCTION* fonction) |
124 |
|
|
{ |
125 |
|
|
fonction1=fonction; |
126 |
|
|
} |
127 |
|
|
|
128 |
francois |
283 |
#endif |
129 |
|
|
|
130 |
|
|
|