CSG

Class for building Constructive Solid Geometry

Hierarchy

  • CSG

Index

Properties

matrix

Find examples in Playground
matrix: Matrix

The world matrix

position

Find examples in Playground
position: Vector3

Stores the position

rotation

Find examples in Playground
rotation: Vector3

Stores the rotation

rotationQuaternion

Find examples in Playground
rotationQuaternion: Nullable<Quaternion>

Stores the rotation quaternion

scaling

Find examples in Playground
scaling: Vector3

Stores the scaling vector

Methods

buildMeshGeometry

Find examples in Playground
  • buildMeshGeometry(name: string, scene?: Scene, keepSubMeshes?: boolean): Mesh
  • Build Raw mesh from CSG Coordinates here are in world space

    Parameters

    • name: string

      The name of the mesh geometry

    • Optional scene: Scene

      The Scene

    • Optional keepSubMeshes: boolean

      Specifies if the submeshes should be kept

    Returns Mesh

    A new Mesh

clone

Find examples in Playground
  • Clones, or makes a deep copy, of the CSG

    Returns CSG

    A new CSG

copyTransformAttributes

Find examples in Playground
  • copyTransformAttributes(csg: CSG): CSG
  • This is used to keep meshes transformations so they can be restored when we build back a Babylon Mesh NB : All CSG operations are performed in world coordinates

    Parameters

    • csg: CSG

      The CSG to copy the transform attributes from

    Returns CSG

    This CSG

intersect

Find examples in Playground
  • Intersect this CSG with another CSG

    Parameters

    • csg: CSG

      The CSG to intersect against this CSG

    Returns CSG

    A new CSG

intersectInPlace

Find examples in Playground
  • intersectInPlace(csg: CSG): void
  • Intersects this CSG with another CSG in place

    Parameters

    • csg: CSG

      The CSG to intersect against this CSG

    Returns void

inverse

Find examples in Playground
  • inverse(): CSG
  • Return a new CSG solid with solid and empty space switched. This solid is not modified.

    Returns CSG

    A new CSG solid with solid and empty space switched

inverseInPlace

Find examples in Playground
  • inverseInPlace(): void
  • Inverses the CSG in place

    Returns void

subtract

Find examples in Playground
  • Subtracts this CSG with another CSG

    Parameters

    • csg: CSG

      The CSG to subtract against this CSG

    Returns CSG

    A new CSG

subtractInPlace

Find examples in Playground
  • subtractInPlace(csg: CSG): void
  • Subtracts this CSG with another CSG in place

    Parameters

    • csg: CSG

      The CSG to subtact against this CSG

    Returns void

toMesh

Find examples in Playground
  • Build Mesh from CSG taking material and transforms into account

    Parameters

    • name: string

      The name of the Mesh

    • Optional material: Nullable<Material>

      The material of the Mesh

    • Optional scene: Scene

      The Scene

    • Optional keepSubMeshes: boolean

      Specifies if submeshes should be kept

    Returns Mesh

    The new Mesh

union

Find examples in Playground
  • Unions this CSG with another CSG

    Parameters

    • csg: CSG

      The CSG to union against this CSG

    Returns CSG

    The unioned CSG

unionInPlace

Find examples in Playground
  • unionInPlace(csg: CSG): void
  • Unions this CSG with another CSG in place

    Parameters

    • csg: CSG

      The CSG to union against this CSG

    Returns void

Static FromMesh

Find examples in Playground
  • Convert the Mesh to CSG

    Parameters

    • mesh: Mesh

      The Mesh to convert to CSG

    Returns CSG

    A new CSG from the Mesh

Generated using TypeDoc