1 |
francois |
1158 |
//####//------------------------------------------------------------ |
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 |
|
|
//####// ct_point.cpp |
15 |
|
|
//####// |
16 |
|
|
//####//------------------------------------------------------------ |
17 |
|
|
//####//------------------------------------------------------------ |
18 |
|
|
//####// COPYRIGHT 2000-2024 |
19 |
|
|
//####// jeu 13 jun 2024 11:58:53 EDT |
20 |
|
|
//####//------------------------------------------------------------ |
21 |
|
|
//####//------------------------------------------------------------ |
22 |
francois |
283 |
|
23 |
|
|
|
24 |
|
|
#include "gestionversion.h" |
25 |
|
|
|
26 |
|
|
#pragma hdrstop |
27 |
|
|
|
28 |
|
|
#include "ct_point.h" |
29 |
francois |
481 |
#include "ot_boite_3d.h" |
30 |
francois |
283 |
|
31 |
|
|
template <int N> unsigned long CT_POINT<N>::idmax=0; //definir ds CT_POINT la var idmax |
32 |
|
|
|
33 |
|
|
template <int N> CT_POINT<N>::CT_POINT(double x,double y,double z,DOUBLEN<N> en,BOITE_3D boitetmp, double courbure):boite(boitetmp) |
34 |
|
|
{ |
35 |
|
|
point[0]=x; |
36 |
|
|
point[1]=y; |
37 |
|
|
point[2]=z; |
38 |
|
|
ecart=en; |
39 |
|
|
id=idmax; |
40 |
|
|
idmax++; |
41 |
|
|
c=courbure; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
template <int N> CT_POINT<N>::~CT_POINT() |
46 |
|
|
{ |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
template <int N> void CT_POINT<N>::evaluer(double *xyz) |
50 |
|
|
{ |
51 |
|
|
xyz[0]=point[0]; |
52 |
|
|
xyz[1]=point[1]; |
53 |
|
|
xyz[2]=point[2]; |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
template <int N> unsigned long CT_POINT<N>::get_id() |
57 |
|
|
{ |
58 |
|
|
return id; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
template <int N> DOUBLEN<N> &CT_POINT<N>::get_valeur(void) |
62 |
|
|
{ |
63 |
|
|
return ecart; |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
template <int N> double CT_POINT<N>::get_fonction_influence(double r) |
67 |
|
|
{ |
68 |
|
|
|
69 |
|
|
if (!c) return (1-r); |
70 |
|
|
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 |
71 |
|
|
if (c>0) // cette fonction d�termine le poids d'un point d'�chantillonnage en fonction de sa distance |
72 |
|
|
{ // 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. |
73 |
|
|
f=(c+b)*b/(c*(c*r+b))-b/c; |
74 |
|
|
return f; |
75 |
|
|
} |
76 |
|
|
if (c<0) |
77 |
|
|
{ |
78 |
|
|
f=(b-c)*b/((-c)*((-c)*(1-r)+b))-b/(-c); |
79 |
|
|
return r*(1-r)/f; |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
return 0; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
template <int N> double CT_POINT<N>::get_fonction_influence(double r, double crbr) |
87 |
|
|
{ |
88 |
|
|
|
89 |
|
|
if (!crbr) return (1-r); |
90 |
|
|
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 |
91 |
|
|
if (crbr>0) // cette fonction d�termine le poids d'un point d'�chantillonnage en fonction de sa distance |
92 |
|
|
{ // 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. |
93 |
|
|
f=(crbr+b)*b/(crbr*(crbr*r+b))-b/crbr; |
94 |
|
|
return f; |
95 |
|
|
} |
96 |
|
|
if (crbr<0) |
97 |
|
|
{ |
98 |
|
|
f=(b-crbr)*b/((-crbr)*((-crbr)*(1-r)+b))-b/(-crbr); |
99 |
|
|
return r*(1-r)/f; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
|
103 |
|
|
return 0; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
template <int N> BOITE_3D CT_POINT<N>::get_boite_3D(void) |
109 |
|
|
{ |
110 |
|
|
return boite; |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
#ifdef BORLANDCPP |
116 |
|
|
template class __export CT_POINT<1>; |
117 |
|
|
template class __export CT_POINT<4>; |
118 |
|
|
#else |
119 |
|
|
template class CT_POINT<1>; |
120 |
|
|
template class CT_POINT<4>; |
121 |
|
|
#endif |
122 |
|
|
|
123 |
|
|
|