# Points

## Description

`sealed` `class` `Tinman.Terrain.Util.Points`

Helper class that performs common computations on a list of points in 3D space.

## Public / Constructors

### Points

`public` `constructor` `Points` → `()`

Creates a new instance of Points.

## Public / Methods

`public` `method` `Add1` → `(2)`

point in : Vec3F

The point coordinates.

weight opt : float64 = 1

`[>=0]`
Optional point weight.

`public` `method` `Add2` → `(2)`

point in : Vec3D

The point coordinates.

weight opt : float64 = 1

`[>=0]`
Optional point weight.

`public` `method` `Add3` → `(4)`

in : float64

The point X-coordinate.

in : float64

The point Y-coordinate.

in : float64

The point Z-coordinate.

weight opt : float64 = 1

`[>=0]`
Optional point weight.

### Average​Plane

`public` `method` `AveragePlane` → `()`

returns → Plane

The average plane.

Computes an average plane for the given points.

### Bounding​Box

`public` `method` `BoundingBox` → `()`

returns → Box3D

The axis-aligned bounding box.

Computes the smallest axis-aligned bounding box that contains all points.

### Bounding​Cuboid

`public` `method` `BoundingCuboid` → `()`

returns → Cuboid

The bounding cuboid.

Computes a bounding cuboid aligned to the principal axes that contain all points.

### Bounding​Sphere

`public` `method` `BoundingSphere` → `()`

returns → Sphere

The bounding sphere.

Computes a non-minimal bounding sphere that contains all points.

This method uses Ritter’s algorithm:
https://en.wikipedia.org/wiki/Bounding_sphere

### Clear

`public` `method` `Clear` → `()`

Clears all points from the list.

### Get

`public` `method` `Get` → `(1)`

idx in : int32

`[0..Points.Count-1]`
The point index.

returns → Vec3D

The point coordinates.

Returns the idx in-th point, as it has been added (without weight).

### Mean​Position

`public` `method` `MeanPosition` → `()`

returns → Vec3D

The mean point position.

Computes the mean point position.

### Principal​Axis

`public` `method` `PrincipalAxis` → `(1)`

in : int32

`[0..2]`
The axis to return (`0` : most significant, `2` : least significant).

returns → Vec3D

The unit-length principal axis vector.

Returns the principal axis of the points.

## Public / Attributes

### Count

`public` `attribute` `Count` → `(get)`

value : int32

`[>=0]`
The number of points.

Returns the number of points in the list.