Skip to content

Geometries

Geometry pipeline

sg-extrusions

Geometries can be defined as shared resources, and may be defined locally for an element or product, or be generated at run-time for parametric elements.

All Space Graph geometries are described using the components below. A parametric element like a railing generates a set of parametric geometries from its parameters leveraging operators.

The geometry pipeline resolves complex nested geometries, including csg or list & range operators, converting them into a standardized mesh output so they can be visualized or exported.

Coordinate system

Space graph uses a left-handed coordinate system. Y is up, and positive rotation is counter-clockwise.
Nodes can specify position, rotation in degrees and optionally a rotationAxis.
That way the transform is human readable while still offering full 3d transform capabilities.

sg-axis

jsonc
// Standard transform
{
  "position": [0, 0, 0],
  "rotation": 0,
  // up vector by default if not specified
  "rotationAxis": [0, 1, 0]
}

Parametric geometry

geometry:extrusion

Extrusion of a profile with a curve which forms side surfaces and a top and bottom surface. This is the standard geometry for most parametric objects.

sg-extrusion

json
{
  "type": "geometry:extrusion",
  "height": 2.4,
  "profile": {
    "type": "curve:circle",
    "radius": 0.8
  }
}

geometry:cuboid

6 faces, 3 dimensions, 12 edges, ... a cuboid.

sg-cuboid

json
{
  "type": "geometry:cuboid",
  "dimensions": [1, 1, 1.5]
}

geometry:sphere

sg-sphere

json
{
  "type": "geometry:sphere",
  "radius": 1
}

geometry:plane

A simple 2d plane.

sg-plane

json
{
  "type": "geometry:plane",
  "dimensions": [1, 1.5]
}

Static geometry

geometry:mesh

Mesh geometry described by vertices and their indices. Uvs and material assignments to divided surfaces are also supported.

sg-mesh

json
{
  "type": "geometry:mesh",
  "vertices": [0, 0, 0, 2, 0, 0, 1, 1, 0],
  "indices": [0, 1, 2]
}

geometry:uri

References external geometry.

sg-cuboid

json
{
  "type": "geometry:uri",
  "uri": "https://storage.archilogic.com/<storage-key>/geometry.data3d.gz.buffer",
  "format": "data3d"
}

Curves

Mostly used inside extrusions geometries.

curve:polygon

json
{
  "type": "curve:polygon",
  "points": [
    [0, 0],
    [0, 2],
    [1, 1]
  ]
}

curve:rectangle

json
{
  "type": "curve:rectangle",
  "dimensions": [1, 1]
}

curve:circle

json
{
  "type": "curve:circle",
  "radius": 1
}

curve:composite

jsonc
{
  "type": "curve:composite",
  "segments": [] // set of open curves ( line, arc )
}

curve:line

json
{
  "type": "curve:line",
  "start": [0, 0],
  "end": [1, 1]
}

curve:arc

json
{
  "type": "curve:arc",
  "startAngle": 0,
  "endAngle": 90,
  "radius": 0.5
}

CSG operators

Constructive solid geometry (CSG) operations allow merging, slicing, or intersecting geometries. This is used for instance to cut openings out of walls.

Geometries can have nested geometries: geometry.geometries = []
Also CSG operators can be used here and further nested.

csg:intersect

csg-intersect

json
{
  "type": "csg:intersect",
  "geometry": "geometry-id"
}

csg:subtract

csg-subtract

json
{
  "type": "csg:subtract",
  "geometry": "geometry-id"
}

csg:union

csg-union

json
{
  "type": "csg:union",
  "geometry": "geometry-id"
}

csg:clip

csg-clip

json
{
  "type": "csg:clip",
  "plane": {
    "position": [1, 1, 1],
    "normal": [1, 1, 0]
  }
}

List and range operators

List and range operators can be used in geometry transforms to place several geometry instances while changing their position and or rotation values.

To place a railing pole, for instance, 20 times with 0.1m distance, we can use the vector:range operator on the position.
The number:range operator could be used on the rotation to give each placed instance a different angle.

json
{
  "type": "geometry:cuboid",
  "dimensions": [0.02, 1, 0.02],
  "position": {
    "type": "vector3:range",
    "range": {
      "start": [0, 0, 0],
      "step": [0.1, 0, 0],
      "count": 20
    }
  },
  "rotation": 0
}

number:list

json
{
  "type": "number:list",
  "list": [0, 10, 20, 30, 40]
}


// [0, 10, 20, 30, 40]

number:range

jsonc
{
  "type": "number:range",
  "range": {
    "start": 0,
    "step": 0.2,
    "count": 5
  }
}


// [0, 0.2, 0.4, 0.6, 0.8, 1]

vector3:list

jsonc
{
  "type": "vector3:list",
  "list": [
    [0, 0, 0],
    [2, 0, 0],
    [2, 0, 2],
    [0, 0, 2]
  ]
}


// [[0, 0, 0], [2, 0, 0], [2, 0, 2], [0, 0, 2]]

vector3:range

jsonc
{
  "type": "vector3:range",
  "range": {
    "start": [0, 0, 0],
    "step": [0.2, 0.1, 0],
    "count": 3
  }
}


// [[0, 0, 0], [0.2, 0.1, 0], [0.4, 0.2, 0], [0.6, 0.2, 0]]