Skip to content

Clipping Plane

Description of the clippingPlane field

interface ClippingPlaneState {
    clippingPlanes: ClippingPlane[]
    defaultDistance: number
    currentlyEditedClippingPlane: TemporaryClippingPlaneData | undefined
    editedClippingPlaneId: string | undefined
}

clippingPlanes

Updated by: UI

List of the Clipping Planes for the current file.

Data model

interface ClippingPlane {
    colorId: number
    equation: {
        x: number
        y: number
        z: number
        w: number
    }
    file: string
    id: string
    name: string
}

Examples

Delete all Clipping Planes

{
    ...
  "clippingPlane": {
    "clippingPlanes": []
    ...
  }
}

Add one Clipping Plane

{
    ...
  "clippingPlane": {
    "clippingPlanes": [{
      "colorId": 0,
      "equation": {
        "x": 0,
        "y": 1,
        "z": 0,
        "w": -0.5
      },
      "file": "61f80dee22cae301cb6d9aef",
      "id": "61f80dfccc66b301b0e7c7f4",
      "name": "Clipping Plane 0"
    }]
    ...
  }
}

defaultDistance

Updated by: Player

Default value of the plane's w component.

Data model

defaultDistance: number

Operations done by the Player

When a file is loaded by the Player, a defaultDistance is computed and sent to the UI:

[
  {
    "op": "replace",
    "path": "/clippingPlane/defaultDistance",
    "value": -0.7882795333862305
  }
]

currentlyEditedClippingPlane

Updated by: Player/UI

Data of the temporary Clipping Plane representing the Clipping Plane being edited or created.

Data model

interface TemporaryClippingPlaneData {
    colorId: number
    equation: {
        x: number
        y: number
        z: number
        w: number
    }
    name: string
}

Examples

A Clipping Plane is being edited

{
    ...
  "clippingPlane": {
    "currentlyEditedClippingPlane": [{
      "colorId": 0,
      "equation": {
        "x": 0,
        "y": 1,
        "z": 0,
        "w": -0.5
      },
      "name": "Clipping Plane 0"
    }],
    "editedClippingPlaneId": "61f80dfccc66b301b0e7c7f4"
    ...
  }
}

Operations done by the Player

When the edited Clipping Plane is being dragged in the Player, the w component of the temporary Clipping Plane is modified and sent to the UI:

[
  {
    "op": "replace",
    "path": "/clippingPlane/currentlyEditedClippingPlane/equation/w",
    "value": -0.6
  }
]

editedClippingPlaneId

Updated by: UI

The ID of the edited Clipping Plane, goes in pair with currentlyEditedClippingPlane.

Data model

editedClippingPlaneId: string | undefined

A Clipping Plane is being edited

{
  ...
  "clippingPlane": {
    ...
    "editedClippingPlaneId": "61f80dfccc66b301b0e7c7f4"
    ...
  }
  ...
}

November 24, 2022 March 8, 2022