Skip to content

Commit

Permalink
Merge pull request #73 from smplrspace/next
Browse files Browse the repository at this point in the history
v2.21.0
  • Loading branch information
tibotiber authored Jul 29, 2024
2 parents b8dffa6 + df0dcbc commit 5b06fd3
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 75 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/queryclient/furniture.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 6
---

# Furniture
Expand Down
75 changes: 1 addition & 74 deletions docs/api-reference/queryclient/geometry.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 7
---

# Geometry
Expand Down Expand Up @@ -83,44 +83,6 @@ smplrClient.getPointsBoundingBox({
- `points` - the array of points you want to compute the bounding box for.
- `padding` - _optional_ - minimum space between the points and the bounding box in meters. _Default value: 0_

## getLevelBoundingBox

To get the bounding box of the entire floor plate of a space, you can call the following query. The bounding box is defined as a polygon which is always straight with respect to the (x, z) axes.

```ts
smplrClient.getLevelBoundingBox({
spaceId: string,
levelIndex: number,
padding?: number
}): Promise<{
levelIndex: number,
x: number,
z: number
}[]>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "fbc5617e-5a27-4138-851e-839446121b2e".
- `levelIndex` - zero-based index of the level. Refer to the [Furniture interface](/api-reference/queryclient/furniture#furniture-interface) to learn more.
- `padding` - _optional_ - minimum space between the floor plate's grounds/walls and the bounding box in meters. _Default value: 0_

## getLevelBoundingBoxFromCache

This is the synchronous equivalent of the query right above.

```ts
smplrClient.getLevelBoundingBoxFromCache({
spaceId: string,
levelIndex: number,
padding?: number
}): {
levelIndex: number,
x: number,
z: number
}[]
```

where `spaceId`, `levelIndex`, and `padding` are as defined in `getLevelBoundingBox`.

## getPointsConcaveHull

The concave hull of a set of points is the smallest polygon that contains all the points, similar to a contour. To get the concave hull of a set of points, you can call the following query.
Expand Down Expand Up @@ -173,41 +135,6 @@ smplrClient.getLinesConcaveHull({
- `simplify` - _optional_ - whether the returned hull should be simplified, which means consecutive points that are aligned will be removed to keep only the first and the last. _Default value: true_
- `simplifyTolerance` - _optional_ - authorized distance from the alignment used during the simplification process, given in meters. _Default value: 0.005_

## getLevelAutomaticGround

To get the automatic ground of the entire floor plate of a space, you can call the following query. The automatic ground is the [continuous concave hull](#getlinesconcavehull) of all the walls of the level put together. It may be enabled or disabled in the editor, but the value here will return a valid hull if the level exists and has walls.

```ts
smplrClient.getLevelAutomaticGround({
spaceId: string,
levelIndex: number,
}): Promise<{
levelIndex: number,
x: number,
z: number
}[] | null>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "fbc5617e-5a27-4138-851e-839446121b2e".
- `levelIndex` - zero-based index of the level. Refer to the [Furniture interface](/api-reference/queryclient/furniture#furniture-interface) to learn more.

## getLevelAutomaticGroundFromCache

This is the synchronous equivalent of the query right above.

```ts
smplrClient.getLevelAutomaticGroundFromCache({
spaceId: string,
levelIndex: number,
}): {
levelIndex: number,
x: number,
z: number
}[] | null
```

where `spaceId`, and `levelIndex` are as defined in `getLevelAutomaticGround`.

## isPointInPolygon

To know whether a point is contained within an area defined by a polygon, you can call the following query.
Expand Down
194 changes: 194 additions & 0 deletions docs/api-reference/queryclient/levels-rooms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
---
sidebar_position: 4
---

# Levels & rooms

## getLevelBoundingBox

To get the bounding box of the entire floor plate of a space, you can call the following query. The bounding box is defined as a polygon which is always straight with respect to the (x, z) axes.

```ts
smplrClient.getLevelBoundingBox({
spaceId: string,
levelIndex: number,
padding?: number
}): Promise<{
levelIndex: number,
x: number,
z: number
}[]>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "fbc5617e-5a27-4138-851e-839446121b2e".
- `levelIndex` - zero-based index of the level. Refer to the [Furniture interface](/api-reference/queryclient/furniture#furniture-interface) to learn more.
- `padding` - _optional_ - minimum space between the floor plate's grounds/walls and the bounding box in meters. _Default value: 0_

## getLevelBoundingBoxFromCache

This is the synchronous equivalent of the query right above.

```ts
smplrClient.getLevelBoundingBoxFromCache({
spaceId: string,
levelIndex: number,
padding?: number
}): {
levelIndex: number,
x: number,
z: number
}[]
```

where `spaceId`, `levelIndex`, and `padding` are as defined in `getLevelBoundingBox`.

## getLevelAutomaticGround

To get the automatic ground of the entire floor plate of a space, you can call the following query. The automatic ground is the [continuous concave hull](/api-reference/queryclient/geometry#getlinesconcavehull) of all the walls of the level put together. It may be enabled or disabled in the editor, but the value here will return a valid hull if the level exists and has walls.

```ts
smplrClient.getLevelAutomaticGround({
spaceId: string,
levelIndex: number,
}): Promise<{
levelIndex: number,
x: number,
z: number
}[] | null>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "fbc5617e-5a27-4138-851e-839446121b2e".
- `levelIndex` - zero-based index of the level. Refer to the [Furniture interface](/api-reference/queryclient/furniture#furniture-interface) to learn more.

## getLevelAutomaticGroundFromCache

This is the synchronous equivalent of the query right above.

```ts
smplrClient.getLevelAutomaticGroundFromCache({
spaceId: string,
levelIndex: number,
}): {
levelIndex: number,
x: number,
z: number
}[] | null
```

where `spaceId`, and `levelIndex` are as defined in `getLevelAutomaticGround`.

## getRoomsOnLevel

Rooms are automatically extracted closed polygons formed by the walls of a floor plan. To get the automatic rooms of the entire floor plate of a space, you can call the following query.

```ts
smplrClient.getRoomsOnLevel({
spaceId: string,
levelIndex: number,
useCache?: boolean
}): Promise<{
room: {
levelIndex: number,
x: number,
z: number
}[]
holes: {
levelIndex: number,
x: number,
z: number
}[][]
coordinates: {
levelIndex: number,
x: number,
z: number
}[][]
}[] | null>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "fbc5617e-5a27-4138-851e-839446121b2e".
- `levelIndex` - zero-based index of the level. Refer to the [Furniture interface](/api-reference/queryclient/furniture#furniture-interface) to learn more.
- `useCache` - _optional_ - set this to control whether the request should use the client's local cache of computed automatic rooms. You can call this query with `useCache` set to `false` to refresh the cache for all automatic rooms related queries. _Default value: true_

## getRoomsOnLevelFromCache

This is the synchronous equivalent of the query right above.

```ts
smplrClient.getRoomsOnLevelFromCache({
spaceId: string,
levelIndex: number,
}): {
levelIndex: number,
x: number,
z: number
}[] | null
```

where `spaceId`, and `levelIndex` are as defined in `getRoomsOnLevel`.

## getRoomAtPoint

Building on the automatic rooms described in `getRoomsOnLevel`, you can also request for the room located at a specific location.

```ts
smplrClient.getRoomAtPoint({
spaceId: string,
point: {
levelIndex: number,
x: number,
z: number
},
}): Promise<{
room: {
levelIndex: number,
x: number,
z: number
}[]
holes: {
levelIndex: number,
x: number,
z: number
}[][]
coordinates: {
levelIndex: number,
x: number,
z: number
}[][]
}[] | null>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "fbc5617e-5a27-4138-851e-839446121b2e".
- `point` - the point coordinates in 2D, with the same schema as `polygon` below.

## getRoomAtPointFromCache

This is the synchronous equivalent of the query right above.

```ts
smplrClient.getRoomAtPointFromCache({
spaceId: string,
point: {
levelIndex: number,
x: number,
z: number
},
}): {
room: {
levelIndex: number,
x: number,
z: number
}[]
holes: {
levelIndex: number,
x: number,
z: number
}[][]
coordinates: {
levelIndex: number,
x: number,
z: number
}[][]
}[] | null
```

where `spaceId`, and `point` are as defined in `getRoomAtPoint`.

0 comments on commit 5b06fd3

Please sign in to comment.