# ArPointCloud

Contains a set of observed 3D points and confidence values.

## Summary

| ### Typedefs ||
|---|---|
| `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud` | typedef `struct ArPointCloud_` A cloud of tracked 3D visual feature points ([reference type, large data](https://developers.google.com/ar/reference/c/group/concepts#object-ownership)). |

| ### Functions ||
|---|---|
| `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_getdata(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud *point_cloud, const float **out_point_cloud_data)` | `void` Retrieves a pointer to the Point Cloud data. |
| `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_getnumberofpoints(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud *point_cloud, int32_t *out_number_of_points)` | `void` Retrieves the number of points in the Point Cloud. |
| `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_getpointids(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud *point_cloud, const int32_t **out_point_ids)` | `void` Retrieves a pointer to the Point Cloud point IDs. |
| `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_gettimestamp(const https://developers.google.com/ar/reference/c/group/ar-session#arsession *session, const https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud *point_cloud, int64_t *out_timestamp_ns)` | `void` Returns the timestamp in nanoseconds when this Point Cloud was observed. |
| `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_release(https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud *point_cloud)` | `void` Releases a reference to the Point Cloud. |

## Typedefs

### ArPointCloud

```
struct ArPointCloud_ ArPointCloud
```
A cloud of tracked 3D visual feature points ([reference type, large data](https://developers.google.com/ar/reference/c/group/concepts#object-ownership)).


- Acquire with: `https://developers.google.com/ar/reference/c/group/ar-frame#arframe_acquirepointcloud`
- Release with: `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_release`

<br />

## Functions

### ArPointCloud_getData

```
void ArPointCloud_getData(
  const ArSession *session,
  const ArPointCloud *point_cloud,
  const float **out_point_cloud_data
)
```
Retrieves a pointer to the Point Cloud data.

Each point is represented by four consecutive values in the array; first the X, Y, Z position coordinates, followed by a confidence value. This is the same format as described in [DEPTH_POINT_CLOUD](https://developer.android.com/reference/android/graphics/ImageFormat#DEPTH_POINT_CLOUD).

The pointer returned by this function is valid until `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_release` is called. If the number of points is zero, then the value of `*out_point_cloud_data` is undefined.

If your app needs to keep some Point Cloud data, for example to compare Point Cloud data frame to frame, consider copying just the data points your app needs, and then calling `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_release` to reduce the amount of memory required.

### ArPointCloud_getNumberOfPoints

```
void ArPointCloud_getNumberOfPoints(
  const ArSession *session,
  const ArPointCloud *point_cloud,
  int32_t *out_number_of_points
)
```
Retrieves the number of points in the Point Cloud.

### ArPointCloud_getPointIds

```
void ArPointCloud_getPointIds(
  const ArSession *session,
  const ArPointCloud *point_cloud,
  const int32_t **out_point_ids
)
```
Retrieves a pointer to the Point Cloud point IDs.

The number of IDs is the same as number of points, and is given by `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_getnumberofpoints`.

Each point has a unique identifier (within a session) that is persistent across frames. That is, if a point from Point Cloud 1 has the same id as the point from Point Cloud 2, then it represents the same point in space.

The pointer returned by this function is valid until `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_release` is called. If the number of points is zero, then the value of `*out_point_ids` is undefined.

If your app needs to keep some Point Cloud data, for example to compare Point Cloud data frame to frame, consider copying just the data points your app needs, and then calling `https://developers.google.com/ar/reference/c/group/ar-point-cloud#arpointcloud_release` to reduce the amount of memory required.

### ArPointCloud_getTimestamp

```
void ArPointCloud_getTimestamp(
  const ArSession *session,
  const ArPointCloud *point_cloud,
  int64_t *out_timestamp_ns
)
```
Returns the timestamp in nanoseconds when this Point Cloud was observed.

This timestamp uses the same time base as `https://developers.google.com/ar/reference/c/group/ar-frame#arframe_gettimestamp`.

### ArPointCloud_release

```
void ArPointCloud_release(
  ArPointCloud *point_cloud
)
```
Releases a reference to the Point Cloud.

This must match a call to `https://developers.google.com/ar/reference/c/group/ar-frame#arframe_acquirepointcloud`.

This function may safely be called with `NULL` - it will do nothing.