Skip to main content

Geometry

getPolylineLength

To measure the length of a line or polyline, you can call the following query.

smplrClient.getPolylineLength({
line: {
levelIndex: number,
x: number,
z: number,
elevation: number
}[],
unit?: 'ft' | 'm' | 'cm' | 'mm'
}): number
  • line - the polyline you want to compute the length for. It has the same schema as the coordinates from the polyline data layers.
  • unit - optional - your unit of choice. Default value: m

getPolygonArea

To measure the area of a polygon, you can call the following query.

smplrClient.getPolygonArea({
polygon: {
levelIndex: number,
x: number,
z: number
}[],
unit?: 'sqft' | 'sqm'
}): number
  • polygon - the polygon you want to compute the length for. It has the same schema as the coordinates from the polygon data layers.
  • unit - optional - your unit of choice. Default value: sqm

getPolygonCenter

To get the center point of a polygon, you can call the following query.

smplrClient.getPolygonCenter({
polygon: {
levelIndex: number,
x: number,
z: number
}[]
}): {
levelIndex: number,
x: number,
z: number
}
  • polygon - the polygon you want to get the center for. It has the same schema as the coordinates from the polygon data layers.

getPointsBoundingBox

To get the bounding box of a set of points, 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.

smplrClient.getPointsBoundingBox({
points: {
levelIndex: number,
x: number,
z: number
}[],
padding?: number
}): {
levelIndex: number,
x: number,
z: number
}[]
  • 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.

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 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.

smplrClient.getLevelBoundingBoxFromCache({
spaceId: string,
levelIndex: number,
padding?: number
}): BoundingBox

where spaceId, levelIndex, padding, and BoundingBox 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.

Note that concave hulls are not suitable for sparse points, and you should use a convex hull instead โ€“ get in touch if you need this.

Similarly, walls (or any data represented by lines or polygons) are typically not suitable for pure concave hulls โ€” we have a dedicated query for such data with getLinesConcaveHull below.

smplrClient.getPointsConcaveHull({
points: {
levelIndex: number,
x: number,
z: number
}[],
simplify?: boolean,
simplifyTolerance?: number
}): {
levelIndex: number,
x: number,
z: number
}[]
  • points - the array of points you want to compute the bounding box for.
  • 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

getLinesConcaveHull

The concave hull of a set of lines is the smallest polygon that contains all the lines without "breaking" any of them, which makes it more suitable for "continuous" data (like walls) than the pure concave hulls computed in getPointsConcaveHull. It is similar to a contour. To get the concave hull of a set of lines, you can call the following query.

smplrClient.getLinesConcaveHull({
lines: {
levelIndex: number,
x: number,
z: number
}[][],
simplify?: boolean,
simplifyTolerance?: number
}): {
levelIndex: number,
x: number,
z: number
}[]
  • lines - the array of lines you want to compute the bounding box for.
  • 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

isPointInPolygon

To know whether a point is contained within an area defined by a polygon, you can call the following query.

smplrClient.isPointInPolygon({
point: {
levelIndex: number,
x: number,
z: number
},
polygon: {
levelIndex: number,
x: number,
z: number
}[]
}): boolean
  • point - the point coordinates in 2D, with the same schema as polygon below.
  • polygon - the definition of the area used as a mask to extract furniture. It has the same schema as the coordinates from the polygon data layers. It is assumed here that all coordinates have the same levelIndex value.

A similar query is available for furniture pieces, see isFurnitureInPolygon.

Need any other data?

Get in touch with any use-case that would require new queries to be exposed.