# support_plane

Python API: `depthai_nodes.message.support_plane`

Portable support plane geometry, independent of running pipeline nodes.

## Classes

### SupportPlane

The normalized plane equation `normal · point + offset_mm = 0`.

Coordinates are in millimeters. Construction scales the normal to unit length and the offset with it, so equations that differ
only by a positive factor give equal planes.

Calibration emits planes whose normal points along gravity, away from the camera, so `offset_mm` is at most zero.
[depthai_nodes.node.BoxDimensioner](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_dimensioner/box_dimensioner.md)
and plane verification accept either sign.

Raises

 * `TypeError`: If `normal` is not a list or tuple, or a component is not a real number.
 * `ValueError`: If `normal` does not have three components, is zero, or a value is not finite.

#### Methods

##### fromJson

```python
def fromJson(data: dict[str, Any]) -> SupportPlane:
```

Create a plane from a dictionary written by `toJson`.

Parameters

 * `data` (`dict[str, Any]`): Dictionary with exactly `normal` and `offset_mm`.

Returns

 * `SupportPlane`: The normalized support plane.

Raises

 * `TypeError`: If `data` is not a dictionary or holds non-numeric geometry.
 * `ValueError`: If the keys differ from `normal` and `offset_mm`, or the geometry is invalid.

##### fromJsonFile

```python
def fromJsonFile(path: str | Path) -> SupportPlane:
```

Read a plane from a JSON file written by `toJsonFile`.

Parameters

 * `path` (`str | Path`): Source file path.

Returns

 * `SupportPlane`: The normalized support plane.

Raises

 * `OSError`: If the file cannot be read.
 * `json.JSONDecodeError`: If the file is not valid JSON.
 * `TypeError`: If the JSON has the wrong types.
 * `ValueError`: If the JSON has the wrong keys or invalid geometry.

##### toJson

```python
def toJson(self) -> dict[str, Any]:
```

Return the normalized geometry as a JSON-compatible dictionary.

Returns

 * `dict[str, Any]`: A dictionary with exactly `normal` (a list) and `offset_mm`.

##### toJsonFile

```python
def toJsonFile(path: str | Path):
```

Write the plane as JSON to a file.

Parameters

 * `path` (`str | Path`): Destination file path.

Raises

 * `OSError`: If the file cannot be written.

#### Attributes

##### normal

Unit normal `(x, y, z)`.

##### offset_mm

Offset in millimeters.

### SupportPlaneCandidate

A support plane found by calibration, with how much of the scene supports it.

Raises

 * `TypeError`: If a field has the wrong type.
 * `ValueError`: If a field is out of range or not finite.

#### Attributes

##### inlier_count

Points of the calibration cloud on the plane, at least 1.

##### inlier_ratio

Share of the calibration cloud on the plane, in (0, 1]; at least the config's `min_inlier_ratio`. Not the on-plane ratio of a
plane verification.

##### plane

The support plane.
