```{index} single: Filters; Point Sample Triangle Geometry
```
# Point Sample Triangle Geometry

## Group (Subgroup)

DREAM3D Review (Geometry)

## Description

This **Filter** randomly samples point locations on **Triangles** in a **Triangle Geometry**.  The sampled point locations are then used to construct a **Vertex Geometry**.  The number of point samples may either be specified manually or by inferring from another **Geometry**:

| Geometry | Source for Number of Samples |
|----------|-----------|
| Image | Number of cells |
| Rectilinear Grid | Number of cells |
| Vertex | Number of vertices |
| Edge | Number of vertices |
| Triangle | Number of vertices |
| Quadrilateral | Number of vertices |
| Tetrahedral | Number of vertices |

In order to ensure an even sampling of the total surface are of the **Triangle Geometry**, the average number of points sampled per triangle is made proportional to the area of the triangle.  Within a given **Triangle**, a point is chosen using the following approach:

![Equation 1](Images/PointSampleTriangleGeometry_Eqn1.png)

where ![](Images/PSTG_2.png) are the coordinates of the sampled point; ![](Images/PSTG_3.png), ![](Images/PSTG_4.png), and ![](Images/PSTG_5.png) are the coordinates of the vertices beloning to the **Triangle**; and ![](Images/PSTG_6.png) and ![](Images/PSTG_7.png) are random real numbers on the interval ![](Images/PSTG_8.png).  This approach has the benefit of uniform sampling within the **Triangle** area, and functions correctly regardless of the dimensionality of the space embedding (i.e., whether the **Triangle** is in the plane or embedded in 3D).

The user may opt to use a mask to prevent certain **Triangles** from being sampled; where the mask is _false_, the **Triangle** will not be sampled.  Additionally, the user may choose any number of **Face Attribute Arrays** to transfer to the created **Vertex Geometry**. The vertices in the new **Vertex Geometry** will gain the values of the **Faces** from which they were sampled.


### Input Parameter(s)

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Number of Sample Points | Scalar Value |Int32 | The number of sample points to use |

### Optional Data Mask

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Use Mask Array | Bool |  | Specifies whether or not to use a mask array |
| Mask Array | Array Selection | Allowed Types: uint8, boolean Comp. Shape: 1 | DataPath to the boolean mask array. Values that are true will mark that cell/point as usable. |

### Random Number Seed Parameters

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Use Seed for Random Generation | Bool |  | When true the user will be able to put in a seed for random generation |
| Seed Value | Scalar Value |UInt64 | The seed fed into the random generator |
| Stored Seed Value Array Name | DataObjectName |  | Name of array holding the seed value |

### Input Triangle Geometry

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Triangle Geometry to Sample | Geometry Selection | Triangle | The complete path to the triangle Geometry from which to sample |

### Input Triangle Face Data

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Face Areas | Array Selection | Allowed Types: float64 Comp. Shape: 1 | The complete path to the array specifying the area of each Face |
| Face Attribute Arrays to Transfer | MultiArraySelection |  | The paths to the Face Attribute Arrays to transfer to the created Vertex Geometry where the mask is false, if Use Mask is checked |

### Output Vertex Geometry

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Vertex Geometry Name | DataGroupCreation |  | The complete path to the DataGroup holding the Vertex Geometry that represents the sampling points |

### Output Vertex Attribute Matrix

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Vertex Data | DataObjectName |  | The complete path to the vertex data arrays for the Vertex Geometry |

## Example Pipelines

## License & Copyright

Please see the description file distributed with this plugin.

## DREAM3D-NX Help

If you need help, need to file a bug report or want to request a new feature, please head over to the [DREAM3DNX-Issues](https://github.com/BlueQuartzSoftware/DREAM3DNX-Issues/discussions) GitHub site where the community of DREAM3D-NX users can help answer your questions.
