API (v2.0.0) - Giro3D
    Preparing search index...

    Class PointCloud<TUserData>

    Displays point clouds coming from a PointCloudSource.

    This entity supports two coloring modes: 'attribute' and 'layer'. In coloring mode 'attribute', points are colorized from the selected attributes (e.g color, intensity, classification...).

    pointCloud.setColoringMode('attribute');
    pointCloud.setActiveAttribute('Intensity');

    In coloring mode 'layer', points are colorized using a ColorLayer that must be set with setColorLayer.

    Note: the layer does not have to be in the same coordinate system as the point cloud.

    const colorLayer = new ColorLayer(...);
    pointCloud.setColorLayer(colorLayer);
    pointCloud.setColoringMode('layer');

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _distance: { max: number; min: number }
    hasDefaultPointOfView: true = ...

    Readonly flag to check if a given object implements HasDefaultPointOfView.

    hasLayers: true = ...

    Read-only flag to check if a given object is of type HasLayers.

    id: string

    The unique identifier of this entity.

    intersectingVolumes: IntersectingVolume[] = []
    isEntity: boolean = ...

    Read-only flag to check if a given object is of type Entity.

    isEntity3D: boolean = ...

    Read-only flag to check if a given object is of type Entity3D.

    isMemoryUsage: true = ...

    Readonly flag to indicate that his object implements MemoryUsage.

    isPickable: true
    isPointCloud: true = ...

    Readonly flag to indicate that this object is a PointCloud instance.

    name: string | undefined

    The name of this entity.

    The source of this entity.

    type: "PointCloud" = ...

    The name of the type of this object.

    userData: TUserData

    An object that can be used to store custom data about the Entity.

    Accessors

    • get cleanupDelay(): number

      The delay, in milliseconds, to remove unused data for each node. Must be a positive integer greater or equal to zero.

      Setting it to zero will cleanup immediately after a node becomes invisible.

      Returns number

    • set cleanupDelay(delay: number): void

      Parameters

      • delay: number

      Returns void

    • get clippingPlanes(): Plane[] | null

      Gets or sets the clipping planes set on this entity. Default is null (no clipping planes).

      Note: custom entities must ensure that the materials and shaders used do support the clipping plane feature of three.js. Refer to the three.js documentation for more information.

      Returns Plane[] | null

    • set clippingPlanes(planes: Plane[] | null): void

      Parameters

      • planes: Plane[] | null

      Returns void

    • get decimation(): number

      The amount of decimation to apply to currently displayed point meshes. A value of 1 means that all points are displayed. A value of N means that we display only 1 every Nth point.

      Note: this has no effect on the quantity of data that point cloud sources must fetch, as it is a purely graphical setting. This does, however, improve rendering performance by reducing the number of points to draw on the screen.

      Returns number

    • set decimation(v: number): void

      Parameters

      • v: number

      Returns void

    • get displayedPointCount(): number

      Gets the number of points currently displayed.

      Returns number

    • get distance(): Readonly<{ max: number; min: number }>

      Returns Readonly<{ max: number; min: number }>

    • get frozen(): boolean

      Gets or sets the frozen status of this entity. A frozen entity is still visible but will not be updated automatically.

      Useful for debugging purposes.

      Returns boolean

    • set frozen(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    • get layerCount(): number

      Returns the number of layers currently in this object.

      Returns number

    • get loading(): boolean

      Gets whether this entity is currently loading data.

      Returns boolean

    • get object3d(): Object3D

      Returns the root object of this entity.

      Returns Object3D

    • get opacity(): number

      Gets or sets the opacity of this entity.

      Returns number

    • set opacity(v: number): void

      Parameters

      • v: number

      Returns void

    • get pointBudget(): number | null

      Gets or sets the point budget. A non-null point budget will automatically compute the decimation property every frame, based on the number of currently displayed points. A value of null removes the point budget and stop automatic decimation computation.

      Returns number | null

    • set pointBudget(v: number | null): void

      Parameters

      • v: number | null

      Returns void

    • get pointCount(): number | undefined

      Gets the total number of points in this point cloud, or undefined if this value is not known.

      Note: the entity must be initialized to be able to access this property.

      Returns number | undefined

    • get pointSize(): number

      The point size, in pixels.

      Note: a value of zero triggers automatic size computation.

      Returns number

      0
      
    • set pointSize(size: number): void

      Parameters

      • size: number

      Returns void

    • get progress(): number

      Gets the current loading progress (between 0 and 1). Note: This property is only meaningful if loading is true.

      Returns number

    • get ready(): boolean

      Determine if this entity is ready to use.

      Returns boolean

    • get showNodeDataVolumes(): boolean

      Toggles the visibility of individual node content volumes.

      Note: octree-based point clouds have cube-shaped node volumes, whereas their node data volume is a tight bounding box around the actual points of the node.

      Returns boolean

    • set showNodeDataVolumes(show: boolean): void

      Parameters

      • show: boolean

      Returns void

    • get subdivisionThreshold(): number

      The global factor that drives LOD computation. The lower this value, the sooner a node is subdivided. Note: changing this scale to a value less than 1 can drastically increase the number of nodes displayed in the scene, and can even lead to browser crashes.

      Returns number

      1
      
    • set subdivisionThreshold(v: number): void

      Parameters

      • v: number

      Returns void

    • get visible(): boolean

      Gets or sets the visibility of this entity. A non-visible entity will not be automatically updated.

      Returns boolean

    • set visible(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    Methods

    • Test whether this entity contains the given object.

      The object may be a component of the entity, or a 3D object.

      Parameters

      • obj: unknown

        The object to test.

      Returns boolean

      true if the entity contains the object.

    • Filters what objects need to be updated, based on updatedSources. The returned objects are then passed to preUpdate and postUpdate.

      Inherited classes should override shouldFullUpdate and shouldUpdate if they need to change this behavior.

      Parameters

      • updateSources: Set<unknown>

        Sources that triggered an update

      Returns Set<unknown>

      Set of objects to update

    • Gets the classification array. The array contains 256 entries that can be updated, but the array itself may not be resized.

      Parameters

      • attributeName: string

        Name of the attribute

      Returns readonly Classification[]

      ASPRS_CLASSIFICATIONS

    • Gets the colormap used for coloring an attribute.

      Parameters

      • attributeName: string

        The name of the attribute

      Returns ColorMap

    • Returns an approximated bounding box of this entity in the scene.

      Returns Box3 | null

      the resulting bounding box, or null if it could not be computed.

    • Default implementation that computes a point of view from the bounding box of the entity, if any.

      Parameters

      • params: { camera: Camera }
        • camera: Camera

          The camera to compute the point of view.

      Returns Readonly<PointOfView> | null

    • Returns a new array containing the layers in this object. Optionally, the predicate can be used to filter out unwanted layers.

      // Get all layers from the object.
      const allLayers = obj.getLayers();

      // Get all color layers from the object.
      const colorLayers = obj.getLayers((layer) => layer.isColorLayer);

      Parameters

      • Optionalpredicate: (arg0: Layer) => boolean

      Returns Layer<LayerEvents, LayerUserData>[]

    • Returns true if this object belongs to this entity.

      Parameters

      • obj: unknown

        The object to test.

      Returns boolean

    • Notifies the parent instance that a change occured in the scene.

      Parameters

      • Optionalsource: unknown

      Returns void

    • Applies entity-level setup on a new object.

      Note: this method should be called from the subclassed entity to notify the parent class that a new 3D object has just been created, so that it can be setup with entity-wide parameters.

      Parameters

      • obj: Object3D

        The object to prepare.

      Returns void

      // In the subclass
      const obj = new Object3D();

      // Notify the parent class
      this.onObjectCreated(obj);
    • Called when the rendering context has been lost.

      Parameters

      • options: { canvas: HTMLCanvasElement }

        The options.

      Returns void

    • This method is called just before update() to filter and select which elements should be actually updated. For example, in the case of complex entities made of a hierarchy of elements, the entire hierarchy may not need to be updated.

      Use this method to optimize the update step by reducing the number of elements to process.

      Note: if this functions returns nothing, update() will not be called.

      Parameters

      • context: Context

        the update context.

      Returns unknown[] | null

      the elements to update during update().

    • Sets the colormap used for coloring an attribute.

      Parameters

      • attributeName: string

        The name of the attribute

      • colorMap: ColorMap | null

        The colormap to use

      Returns void

    • Sets the coloring mode of the entity:

      • layer: the point cloud is colorized from a color layer previously set with setColorLayer.
      • attribute: the point cloud is colorized from the source attributes (e.g color, classification...) previously set with setActiveAttribute.

      Parameters

      • mode: "layer" | "attribute"

      Returns void

    • Applies entity-level setup on new object's material.

      Subclasses can override this to setup custom logic, for instance if the entity can produce objects that are naturally transparent.

      Parameters

      • material: Material

        the material of the newly created object

      Returns void

    • This method is called before update to check if the MainLoop should try to update this entity or not. For better performances, it should return false if the entity has no impact on the rendering (e.g. the element is not visible).

      The inherited child can completely ignore this value if it makes sense.

      Returns boolean

      true if should check for update

    • This method is called at the beginning of the update step to determine if we should do a full render of the object. This should be the case if, for instance, the source is the camera.

      You can override this depending on your needs. The inherited child should not ignore this value, it should do a boolean OR, e.g.: return super.shouldFullUpdate(updateSource) || this.contains(updateSource);

      Parameters

      • updateSource: unknown

        Source of change

      Returns boolean

      true if requires a full update of this object

    • This method is called at the beginning of the update step to determine if we should re-render updateSource. Not used when shouldFullUpdate returns true.

      You can override this depending on your needs. The inherited child should not ignore this value, it should do a boolean OR, e.g.: return super.shouldUpdate(updateSource) || this.contains(updateSource);

      Parameters

      • updateSource: unknown

        Source of change

      Returns boolean

      true if requires an update of updateSource

    • Traverses all objects in the hierarchy of this entity.

      Parameters

      • callback: (arg0: Object3D) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The traversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Traverses all materials in the hierarchy of this entity.

      Parameters

      • callback: (arg0: Material) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The traversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Traverses all meshes in the hierarchy of this entity.

      Parameters

      • callback: (arg0: Mesh) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The raversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Performs an update on an element of the entity.

      Note: this method will be called for each element returned by preUpdate().

      Parameters

      • context: Context

        the update context. This is the same object that the entity whose update() is being called.

      • element: unknown

        the element to update. This is one of the elements returned by preUpdate.

      Returns unknown[] | null | undefined

      New elements to update