| 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 |
|
|
#include "constantegeo.h" |
| 31 |
|
|
|
| 32 |
|
|
//--------------------------------------------------------------------------- |
| 33 |
|
|
#pragma package(smart_init) |
| 34 |
|
|
OCC_POINT::OCC_POINT(unsigned long num,TopoDS_Vertex pt, class OCC_FONCTION1& fonc):MG_POINT(num),point(pt), fonction1(fonc) |
| 35 |
|
|
{ |
| 36 |
|
|
} |
| 37 |
|
|
OCC_POINT::OCC_POINT(TopoDS_Vertex pt, class OCC_FONCTION1& fonc):MG_POINT(),point(pt), fonction1(fonc) |
| 38 |
|
|
{ |
| 39 |
|
|
} |
| 40 |
|
|
OCC_POINT::OCC_POINT(OCC_POINT& mdd):MG_POINT(mdd),point(mdd.point),fonction1(mdd.fonction1) |
| 41 |
|
|
{ |
| 42 |
|
|
} |
| 43 |
|
|
OCC_POINT::~OCC_POINT() |
| 44 |
|
|
{ |
| 45 |
|
|
} |
| 46 |
|
|
void OCC_POINT::evaluer(double *xyz) |
| 47 |
|
|
{ |
| 48 |
|
|
gp_Pnt p=BRep_Tool::Pnt(point); |
| 49 |
|
|
p.Coord(xyz[0], xyz[1], xyz[2]); |
| 50 |
|
|
|
| 51 |
|
|
} |
| 52 |
|
|
|
| 53 |
|
|
void OCC_POINT::enregistrer(std::ostream& o) |
| 54 |
|
|
{ |
| 55 |
|
|
|
| 56 |
|
|
o << "%"<<get_id()<<"=POINT_OCC("<<fonction1.GetID(point)<< ");" << std::endl; |
| 57 |
|
|
} |
| 58 |
|
|
|
| 59 |
|
|
int OCC_POINT::get_type_geometrique(TPL_LISTE_ENTITE<double> ¶m) |
| 60 |
|
|
{ |
| 61 |
|
|
gp_Pnt p=BRep_Tool::Pnt(point); |
| 62 |
|
|
Handle(Geom_CartesianPoint) coppoint=new Geom_CartesianPoint(p); |
| 63 |
|
|
Handle_Standard_Type type=coppoint->DynamicType(); |
| 64 |
|
|
|
| 65 |
|
|
if (type==STANDARD_TYPE(Geom_CartesianPoint)) |
| 66 |
|
|
{ |
| 67 |
|
|
Handle_Geom_CartesianPoint P=Handle_Geom_CartesianPoint::DownCast(coppoint); |
| 68 |
|
|
|
| 69 |
|
|
double xyz[3]; |
| 70 |
|
|
param.ajouter(xyz[0]=p.X()); |
| 71 |
|
|
param.ajouter(xyz[1]=p.Y()); |
| 72 |
|
|
param.ajouter(xyz[2]=p.Z()); |
| 73 |
|
|
} |
| 74 |
|
|
|
| 75 |
|
|
return MGCo_POINT; |
| 76 |
|
|
} |
| 77 |
|
|
void OCC_POINT::get_param_NURBS(int& indx_premier_ptctr,TPL_LISTE_ENTITE<double> ¶m) |
| 78 |
|
|
{ |
| 79 |
|
|
gp_Pnt p=BRep_Tool::Pnt(point); |
| 80 |
|
|
|
| 81 |
|
|
// the first parameter indicates the acces code |
| 82 |
|
|
param.ajouter(0); |
| 83 |
|
|
// the second parameter indicates the order of the point which should be one for a point |
| 84 |
|
|
param.ajouter(1); |
| 85 |
|
|
param.ajouter(0); |
| 86 |
|
|
|
| 87 |
|
|
param.ajouter(1); |
| 88 |
|
|
param.ajouter(0); |
| 89 |
|
|
|
| 90 |
|
|
// the third parameter presente the number of the controls point wich correspond to the cordinate point |
| 91 |
|
|
// note that the cordinate of the control points are given in homogeneous cordinates |
| 92 |
|
|
// for a point, the weight it's �qual to one. |
| 93 |
|
|
|
| 94 |
|
|
param.ajouter(p.X()); |
| 95 |
|
|
param.ajouter(p.Y()); |
| 96 |
|
|
param.ajouter(p.Z()); |
| 97 |
|
|
|
| 98 |
|
|
param.ajouter(1.); |
| 99 |
|
|
|
| 100 |
|
|
indx_premier_ptctr =5; |
| 101 |
|
|
|
| 102 |
|
|
|
| 103 |
|
|
} |
| 104 |
|
|
#endif |
| 105 |
|
|
|
| 106 |
|
|
|