ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/acismesh/eval_mindis_edge.cpp
Revision: 1
Committed: Mon Jun 11 22:53:07 2007 UTC (17 years, 11 months ago)
File size: 1812 byte(s)
Log Message:

File Contents

# Content
1 /*****************************************************************
2
3 eval_mindis_edge.cpp Type:Func
4
5 Calcul la distance minimum entre une entite et un point
6
7 Date de creation : 2-2-1999 10 :25 :59
8 Derniere version : 2-2-1999 10 :25 :59
9
10 Vincent FRANCOIS
11
12 *****************************************************************/
13
14
15
16
17
18 /**************************/
19 /* include */
20 #include <stdio.h>
21 #include <string.h>
22 #include <math.h>
23 #include "struct.h"
24 #include "const.h"
25 #include "prototype.h"
26
27 /**************************/
28 /* variables globales */
29 extern struct s_acis *acis;
30
31
32
33 /**************************/
34 /* programme principal */
35
36 void eval_mindis_edge(struct s_edge *edge, float *x,float *dis, float *par)
37 {
38 float t,tt;
39 float g0,g1;
40 int ok;
41 float tm,eps,td,ta,lt;
42
43
44 td=edge->t1;
45 ta=edge->t1+edge->t2;
46
47 eps=0.0001*(ta-td);
48 MAXI(lt,3.*eps,0.0001*(ta-td));
49 ok=0;
50 do
51 {
52 tm=(td+ta)/2.;
53 t=tm-eps;
54 tt=tm+eps;
55 g0=eval_dis_point_edge(edge,x,t,FONCTION);
56 g1=eval_dis_point_edge(edge,x,tt,FONCTION);
57 if (g0<g1) ta=tt;
58 else td=t;
59 if (ta-td<lt) ok=1;
60 }
61 while (ok==0);
62 *par=(ta+td)/2.;
63 *dis=(float)sqrt((double)eval_dis_point_edge(edge,x,*par,FONCTION));
64 }