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

File Contents

# User Rev Content
1 1 /*****************************************************************
2    
3     m3d_i_segment.cpp Type:Func
4    
5     Insertion d un segment dans la phase 3D
6    
7     Date de creation : 12-3-1999 14 :12 :33
8     Derniere version : 12-3-1999 14 :12 :33
9    
10     Vincent FRANCOIS
11    
12     *****************************************************************/
13    
14    
15    
16    
17    
18     /**************************/
19     /* include */
20     #include <stdio.h>
21     #include <string.h>
22     #include <stdlib.h>
23     #include <math.h>
24     #include "const.h"
25     #include "memoire.h"
26     #include "struct.h"
27     #include "struct3d.h"
28     #include "prototype.h"
29    
30    
31     /**************************/
32     /* variables globales */
33     extern struct environnment env;
34     extern struct s_mesh *mesh;
35    
36    
37    
38    
39     /**************************/
40     /* programme principal */
41    
42     void m3d_i_segment(struct s_segment **seg,int n1,int n2)
43     {
44     struct s_noeud *no1,*no2;
45     struct s_segment *segtmp;
46     int i,j,num;
47     float n1n2[4];
48    
49     no1=ADRESSE(n1,noeud,mesh->);
50     no2=ADRESSE(n2,noeud,mesh->);
51    
52     segtmp=NULL;
53     for (i=0;i<no1->nb_segment;i++)
54     for (j=0;j<no2->nb_segment;j++)
55     if (no1->segment[i]==no2->segment[j])
56     segtmp=no1->segment[i];
57     if (segtmp==NULL)
58     {
59     NEW_ENTITE(segtmp,segment,mesh->);
60     segtmp->num=mesh->nb_segment;
61     segtmp->n1=n1;
62     segtmp->n2=n2;
63     segtmp->type=BODY;
64     VEC(n1n2,no1,no2);
65     NORME(n1n2);
66     segtmp->longueur=(float)sqrt((double)n1n2[3]);
67     NEW_POINTEUR(num,segment,no1->);
68     no1->segment[num]=segtmp;
69     NEW_POINTEUR(num,segment,no2->);
70     no2->segment[num]=segtmp;
71     }
72     *seg=segtmp;
73    
74    
75     }