# SimPEG.utils.face_info#

SimPEG.utils.face_info(xyz, A, B, C, D, average=True, normalize_normals=True, **kwargs)[source]#

Returns normal surface vector and area for a given set of faces.

Let xyz be an (n, 3) array denoting a set of vertex locations. Now let vertex locations a, b, c and d define a quadrilateral (regular or irregular) in 2D or 3D space. For this quadrilateral, we organize the vertices as follows:

CELL VERTICES:

      a -------Vab------- b
/                   /
/                   /
Vda       (X)       Vbc
/                   /
/                   /
d -------Vcd------- c


where the normal vector (X) is pointing into the page. For a set of quadrilaterals whose vertices are indexed in arrays A, B, C and D , this function returns the normal surface vector(s) and the area for each quadrilateral.

At each vertex, there are 4 cross-products that can be used to compute the vector normal the surface defined by the quadrilateral. In 3D space however, the vertices indexed may not define a quadrilateral exactly and thus the normal vectors computed at each vertex might not be identical. In this case, you may choose output the normal vector at a, b, c and d or compute the average normal surface vector as follows:

$\bf{n} = \frac{1}{4} \big ( \bf{v_{ab} \times v_{da}} + \bf{v_{bc} \times v_{ab}} + \bf{v_{cd} \times v_{bc}} + \bf{v_{da} \times v_{cd}} \big )$

For computing the surface area, we assume the vertices define a quadrilateral.

Parameters
xyz(n, 3) numpy.ndarray

The x,y, and z locations for all verticies

A(n_face) numpy.ndarray

Vector containing the indicies for the a vertex locations

B(n_face) numpy.ndarray

Vector containing the indicies for the b vertex locations

C(n_face) numpy.ndarray

Vector containing the indicies for the c vertex locations

D(n_face) numpy.ndarray

Vector containing the indicies for the d vertex locations

averagebool, optional

If True, the function returns the average surface normal vector for each surface. If False , the function will return the normal vectors computed at the A, B, C and D vertices in a cell array {nA,nB,nC,nD}.

normalize_normalbool, optional

If True, the function will normalize the surface normal vectors. This is applied regardless of whether the average parameter is set to True or False. If False, the vectors are not normalized.

Returns
N(n_face) numpy.ndarray or (4) list of (n_face) numpy.ndarray

Normal vector(s) for each surface. If average = True, the function returns an ndarray with the average surface normal vectos. If average = False , the function returns a cell array {nA,nB,nC,nD} containing the normal vectors computed using each vertex of the surface.

area(n_face) numpy.ndarray

The surface areas.

Examples