# 2.8.18 marea(Pro)

Analysis: Mathematics: Matrix Surface Area

## Brief Information

Calculate matrix surface area

This feature is for OriginPro only, 8.1 SR0 or later versions.

## Command Line Usage

 

marea im:=[mbook1] missing:=1 area:=area; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Matrix im

Input

MatrixObject

<active>
Specify the input matrix.
Interpolate for Missing Value missing

Input

int

0
If this parameter is true, Origin will do interpolation for missing value.
Area area

Output

double

<>
Area result output destination. Default is Results Log window.

## Description This X-Function is used to calculate the area of the matrix surface. You can specify a variable for the result area as well as whether or not to interpolate for the missing value. Also, the result area will be always put to the Results Log Window automatically.

## Examples

This example is going to calculate the area of the active matrix.

1. Create a new project and import data <Origin Program Directory>\Samples\Matrix Conversion and Gridding\3D XYZ.dat.
2. Highlight Column C, Change the type of Column C to be Z by selecting the right-click menu Set As: Z. Then select main menu Worksheet: Convert to Matrix: XYZ Gridding.
3. In the XYZ Gridding: Convert Worksheet to Matrix dialog, keep the default settings and click the OK button to convert the worksheet to a matrix. 4. Activate the matrix, then run xyzarea -d; in Command Window to bring up the marea dialog box.
5. Check the check box behind the Interpolate for Missing Value. 6. Click the OK button, then the area of the matrix is put to Results Log Window. ## Algorithm

In three dimensions Cartesian space, the area of a general triangle $A = (x_A, y_A, z_A), B = (x_B, y_B, z_B), C = (x_C, y_C, z_C)$ is $S=\frac{1}{2} \sqrt{ \left( \det\begin{pmatrix} x_A & x_B & x_C \\ y_A & y_B & y_C \\ 1 & 1 & 1 \end{pmatrix} \right)^2 + \left( \det\begin{pmatrix} y_A & y_B & y_C \\ z_A & z_B & z_C \\ 1 & 1 & 1 \end{pmatrix} \right)^2 + \left( \det\begin{pmatrix} z_A & z_B & z_C \\ x_A & x_B & x_C \\ 1 & 1 & 1 \end{pmatrix} \right)^2 }$.

To calculate the area of a matrix surface, the matrix surface is divided into many sub-triangles like below. The the area of the matrix surface is the sum of all the area of its sub-triangles. • Matrix Surface with Boundary

The steps as follow are for calculating the area of matrix surface with boundary.

1. Find the intersection.
2. Pick up all the points inside or on the boundary of that region.
3. Find the Z value on the boundary line by interpolation.
4. Perform triangulation.
5. Sum the area of each triangle obtained in step 4. 