| MESH toolbox 0.1 Matlab/Octave mesh utils

- Main Page
- Related Pages
- Modules
- Files

- File List
- File Members

All Files Functions Groups Pages
ComputeAreaOpt.m
Go to the documentation of this file.
1 function area=ComputeAreaOpt(q,me)
2 % function area=ComputeAreaOpt(q,me)
3 % Compute areas of triangles mesh
4 %
5 % Parameters:
6 % 'q': `2\times\nq` array, `{\q}(\il,j)` is the `\il`-th coordinate of the `j`-th vertex, `\il\in\{1,2\}` and `j\in\{1,\hdots,n_q\}.`
7 % Also noted `\q`.
8 % me: `3\times\nme` 'int32' array,`\me(\jl,k)` index of storage, in the array `\q`, of the `\jl`-th
9 % vertex of the triangle of index `k`, `\jl\in\{1,2,3\}` and `k\in\{1,\hdots,\nme\}.`
10 % Also noted `\me`.
11 %
12 % Return values:
13 % areas: `1\times\nme` array, areas(k) is the area of triangle k.
14 c1 = q(:,me(1,:));
15 d21 = q(:,me(2,:))-c1;
16 d31 = q(:,me(3,:))-c1;
17 area = 0.5*(d21(1,:).*d31(2,:)-d21(2,:).*d31(1,:));