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

File Contents

# Content
1 /*****************************************************************
2
3 m3d_cal_vol.cpp Type:func
4
5 Calcul le volume d un tetra
6
7 Date de creation : 28-7-1999 17 :5 :59
8 Derniere version : 28-7-1999 17 :5 :59
9
10 Vincent FRANCOIS
11
12 *****************************************************************/
13
14
15
16
17
18 /**************************/
19 /* include */
20 #include <stdio.h>
21 #include <math.h>
22 #include "const.h"
23 #include "struct.h"
24 #include "memoire.h"
25 #include "prototype.h"
26
27 /**************************/
28 /* variables globales */
29 extern struct environnement env;
30 extern struct s_mesh *mesh;
31
32
33 /**************************/
34 /* programme principal */
35
36 float m3d_cal_vol(int n1,int n2,int n3,int n4)
37 {
38 struct s_noeud *no1,*no2,*no3,*no4;
39 float x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4;
40 double ab[4],ac[4];
41 double da[4],pvec[4],vol;
42
43 no1=ADRESSE(n1,noeud,mesh->);
44 no2=ADRESSE(n2,noeud,mesh->);
45 no3=ADRESSE(n3,noeud,mesh->);
46 no4=ADRESSE(n4,noeud,mesh->);
47 x1=no1->x;y1=no1->y;z1=no1->z;
48 x2=no2->x;y2=no2->y;z2=no2->z;
49 x3=no3->x;y3=no3->y;z3=no3->z;
50 x4=no4->x;y4=no4->y;z4=no4->z;
51 ab[0]=x2-x1;ab[1]=y2-y1;ab[2]=z2-z1;
52 ac[0]=x3-x1;ac[1]=y3-y1;ac[2]=z3-z1;
53 da[0]=x1-x4;da[1]=y1-y4;da[2]=z1-z4;
54 PVEC(pvec,ab,ac);
55 vol=pvec[0]*da[0]+pvec[1]*da[1]+pvec[2]*da[2];
56 vol=fabs(vol)/3.;
57 return(vol);
58 }