ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/diamesh/src/m3d_cpoct.cpp
Revision: 5
Committed: Tue Jun 12 20:26:34 2007 UTC (17 years, 11 months ago)
Original Path: magic/lib/diamesh/diamesh/src/m3d_cpoct.cpp
File size: 1287 byte(s)
Log Message:

File Contents

# User Rev Content
1 5 #include <stdio.h>
2     #include "m3d_struct.h"
3     #include "m3d_const.h"
4     #include "m3d_hotes.h"
5     #include "m3d_erreur.h"
6     #include "prototype.h"
7     extern GEST_MEM *gest ;
8     extern int debug;
9     int m3d_cpoct(OCT *pere)
10     {
11     OCT *oct ;
12     float tab[24] ;
13     int i ;
14    
15     tab[x(0)] = pere->vec[0] ;
16     tab[y(0)] = pere->vec[1] ;
17     tab[z(0)] = pere->vec[2] ;
18    
19     tab[x(1)] = tab[x(0)] + pere->taille / 2. ;
20     tab[y(1)] = tab[y(0)] ;
21     tab[z(1)] = tab[z(0)] ;
22    
23     tab[x(2)] = tab[x(0)] ;
24     tab[y(2)] = tab[y(0)] + pere->taille / 2. ;
25     tab[z(2)] = tab[z(0)] ;
26    
27     tab[x(3)] = tab[x(1)] ;
28     tab[y(3)] = tab[y(2)] ;
29     tab[z(3)] = tab[z(0)] ;
30    
31     tab[x(4)] = tab[x(0)] ;
32     tab[y(4)] = tab[y(0)] ;
33     tab[z(4)] = tab[z(0)] + pere->taille / 2. ;
34    
35     tab[x(5)] = tab[x(1)] ;
36     tab[y(5)] = tab[y(1)] ;
37     tab[z(5)] = tab[z(4)] ;
38    
39     tab[x(6)] = tab[x(2)] ;
40     tab[y(6)] = tab[y(2)] ;
41     tab[z(6)] = tab[z(4)] ;
42    
43     tab[x(7)] = tab[x(3)] ;
44     tab[y(7)] = tab[y(3)] ;
45     tab[z(7)] = tab[z(4)] ;
46    
47     for (i=0;i<8;i++)
48     {
49     /* allocation dynamique */
50     oct = m3d_c_oct() ;
51     ERREUR_ALLOC_FAUX(oct) ;
52     /* liens pere fils */
53     pere->tab_oct[i] = oct ;
54     oct->vec[0] = tab[x(i)] ;
55     oct->vec[1] = tab[y(i)] ;
56     oct->vec[2] = tab[z(i)] ;
57     oct->taille = pere->taille/2. ;
58     }
59     return(VRAI) ;
60     }
61    
62