1 |
francois |
283 |
//------------------------------------------------------------ |
2 |
|
|
//------------------------------------------------------------ |
3 |
|
|
// MAGiC |
4 |
|
|
// Jean Christophe Cuilli�re et Vincent FRANCOIS |
5 |
|
|
// D�partement de G�nie M�canique - UQTR |
6 |
|
|
//------------------------------------------------------------ |
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�partement |
8 |
|
|
// de g�nie m�canique de l'Universit� du Qu�bec � |
9 |
|
|
// Trois Rivi�res |
10 |
|
|
// Les librairies ne peuvent �tre utilis�es sans l'accord |
11 |
|
|
// des auteurs (contact : francois@uqtr.ca) |
12 |
|
|
//------------------------------------------------------------ |
13 |
|
|
//------------------------------------------------------------ |
14 |
|
|
// |
15 |
|
|
// ct_point.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H21 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
|
27 |
|
|
#pragma hdrstop |
28 |
|
|
|
29 |
|
|
#include "ct_point.h" |
30 |
francois |
481 |
#include "ot_boite_3d.h" |
31 |
francois |
283 |
|
32 |
|
|
//--------------------------------------------------------------------------- |
33 |
|
|
template <int N> unsigned long CT_POINT<N>::idmax=0; //definir ds CT_POINT la var idmax |
34 |
|
|
|
35 |
|
|
template <int N> CT_POINT<N>::CT_POINT(double x,double y,double z,DOUBLEN<N> en,BOITE_3D boitetmp, double courbure):boite(boitetmp) |
36 |
|
|
{ |
37 |
|
|
point[0]=x; |
38 |
|
|
point[1]=y; |
39 |
|
|
point[2]=z; |
40 |
|
|
ecart=en; |
41 |
|
|
id=idmax; |
42 |
|
|
idmax++; |
43 |
|
|
c=courbure; |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
template <int N> CT_POINT<N>::~CT_POINT() |
48 |
|
|
{ |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
template <int N> void CT_POINT<N>::evaluer(double *xyz) |
52 |
|
|
{ |
53 |
|
|
xyz[0]=point[0]; |
54 |
|
|
xyz[1]=point[1]; |
55 |
|
|
xyz[2]=point[2]; |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
template <int N> unsigned long CT_POINT<N>::get_id() |
59 |
|
|
{ |
60 |
|
|
return id; |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
template <int N> DOUBLEN<N> &CT_POINT<N>::get_valeur(void) |
64 |
|
|
{ |
65 |
|
|
return ecart; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
template <int N> double CT_POINT<N>::get_fonction_influence(double r) |
69 |
|
|
{ |
70 |
|
|
|
71 |
|
|
if (!c) return (1-r); |
72 |
|
|
double f,b=0.1; // la fonction est soit une droite (c=0) ou une courbe de courbure positive(f>0) ou n�gative (f<0) nulle en r=1 |
73 |
|
|
if (c>0) // cette fonction d�termine le poids d'un point d'�chantillonnage en fonction de sa distance |
74 |
|
|
{ // les deux fonctions c>0 et c<0 engendrent des �volutions oppos�es l'une � l'autre, et tendent toutes les deux vers 1-r quand c tend vers 0. |
75 |
|
|
f=(c+b)*b/(c*(c*r+b))-b/c; |
76 |
|
|
return f; |
77 |
|
|
} |
78 |
|
|
if (c<0) |
79 |
|
|
{ |
80 |
|
|
f=(b-c)*b/((-c)*((-c)*(1-r)+b))-b/(-c); |
81 |
|
|
return r*(1-r)/f; |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
|
85 |
|
|
return 0; |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
template <int N> double CT_POINT<N>::get_fonction_influence(double r, double crbr) |
89 |
|
|
{ |
90 |
|
|
|
91 |
|
|
if (!crbr) return (1-r); |
92 |
|
|
double f,b=0.1; // la fonction est soit une droite (c=0) ou une courbe de courbure positive(f>0) ou n�gative (f<0) nulle en r=1 |
93 |
|
|
if (crbr>0) // cette fonction d�termine le poids d'un point d'�chantillonnage en fonction de sa distance |
94 |
|
|
{ // les deux fonctions c>0 et c<0 engendrent des �volutions oppos�es l'une � l'autre, et tendent toutes les deux vers 1-r quand c tend vers 0. |
95 |
|
|
f=(crbr+b)*b/(crbr*(crbr*r+b))-b/crbr; |
96 |
|
|
return f; |
97 |
|
|
} |
98 |
|
|
if (crbr<0) |
99 |
|
|
{ |
100 |
|
|
f=(b-crbr)*b/((-crbr)*((-crbr)*(1-r)+b))-b/(-crbr); |
101 |
|
|
return r*(1-r)/f; |
102 |
|
|
} |
103 |
|
|
|
104 |
|
|
|
105 |
|
|
return 0; |
106 |
|
|
} |
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
template <int N> BOITE_3D CT_POINT<N>::get_boite_3D(void) |
111 |
|
|
{ |
112 |
|
|
return boite; |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
#ifdef BORLANDCPP |
118 |
|
|
template class __export CT_POINT<1>; |
119 |
|
|
template class __export CT_POINT<4>; |
120 |
|
|
#else |
121 |
|
|
template class CT_POINT<1>; |
122 |
|
|
template class CT_POINT<4>; |
123 |
|
|
#endif |
124 |
|
|
|
125 |
|
|
|