
#############
ParticleModel
#############

.. js:class:: cee.pt.ParticleModel

   Client-side particle model. Fetches, decodes, caches, and renders time-stepped particle frames via the PtServer REST API (``/api/v1/models``\ ).
   
   .. code-block:: typescript
   
      const model = new cee.pt.ParticleModel();
      await model.openModel('http://server/api/v1/models/mydata.ptfx');
      await model.setFrame(0);
      model.closeModel();
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~cee.pt.ParticleModel.constructor`
   
   .. rubric:: Accessors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~cee.pt.ParticleModel.activeScalarField`
   * :js:func:`~cee.pt.ParticleModel.animation`
   * :js:func:`~cee.pt.ParticleModel.currentFrameIndex`
   * :js:func:`~cee.pt.ParticleModel.datasetInfo`
   * :js:func:`~cee.pt.ParticleModel.frameCount`
   * :js:func:`~cee.pt.ParticleModel.maxParticleCount`
   * :js:func:`~cee.pt.ParticleModel.name`
   * :js:func:`~cee.pt.ParticleModel.scalarFieldNames`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~cee.pt.ParticleModel.closeModel`
   * :js:meth:`~cee.pt.ParticleModel.getBoundingBox`
   * :js:meth:`~cee.pt.ParticleModel.getCurrentFrameScalarRange`
   * :js:meth:`~cee.pt.ParticleModel.getDecimationFactor`
   * :js:meth:`~cee.pt.ParticleModel.getDefaultCameraConfig`
   * :js:meth:`~cee.pt.ParticleModel.getOpacity`
   * :js:meth:`~cee.pt.ParticleModel.getParticleColor`
   * :js:meth:`~cee.pt.ParticleModel.getParticleSize`
   * :js:meth:`~cee.pt.ParticleModel.getScalarMapper`
   * :js:meth:`~cee.pt.ParticleModel.getUseScalarMapping`
   * :js:meth:`~cee.pt.ParticleModel.isOpen`
   * :js:meth:`~cee.pt.ParticleModel.openModel`
   * :js:meth:`~cee.pt.ParticleModel.setActiveScalarField`
   * :js:meth:`~cee.pt.ParticleModel.setDecimationFactor`
   * :js:meth:`~cee.pt.ParticleModel.setFrame`
   * :js:meth:`~cee.pt.ParticleModel.setOpacity`
   * :js:meth:`~cee.pt.ParticleModel.setParticleColor`
   * :js:meth:`~cee.pt.ParticleModel.setParticleSize`
   * :js:meth:`~cee.pt.ParticleModel.setPreloadFrameCount`
   * :js:meth:`~cee.pt.ParticleModel.setScalarMapper`
   * :js:meth:`~cee.pt.ParticleModel.setServerErrorHandler`
   * :js:meth:`~cee.pt.ParticleModel.setUseScalarMapping`
   
   



.. rst-class:: kind-group kind-constructors

.. rubric:: Constructors
   :class: kind-group-title


.. js:method:: cee.pt.ParticleModel.constructor

      .. rst-class:: sig-pretty-signature
      
         | ParticleModel(**properties**\ : *Partial*\ ): :js:class:`ParticleModel <cee.pt.ParticleModel>`
      
      **Parameters**
      
      
         **properties**\ : *Partial*
      
      
      **Returns**\ : :js:class:`ParticleModel <cee.pt.ParticleModel>`
      



.. rst-class:: kind-group kind-accessors

.. rubric:: Accessors
   :class: kind-group-title


.. js:method:: cee.pt.ParticleModel.activeScalarField

      .. rst-class:: sig-pretty-signature
      
         | *get* activeScalarField(): *string*
      
      **Returns**\ : *string*
      



.. js:method:: cee.pt.ParticleModel.animation

      .. rst-class:: sig-pretty-signature
      
         | *get* animation(): :js:class:`Animation <cee.pt.Animation>`
      
      The animation controller for this model.
      
      **Returns**\ : :js:class:`Animation <cee.pt.Animation>`
      



.. js:method:: cee.pt.ParticleModel.currentFrameIndex

      .. rst-class:: sig-pretty-signature
      
         | *get* currentFrameIndex(): *number*
      
      **Returns**\ : *number*
      



.. js:method:: cee.pt.ParticleModel.datasetInfo

      .. rst-class:: sig-pretty-signature
      
         | *get* datasetInfo(): :js:class:`DatasetInfo <cee.pt.DatasetInfo>`
      
      **Returns**\ : :js:class:`DatasetInfo <cee.pt.DatasetInfo>`
      



.. js:method:: cee.pt.ParticleModel.frameCount

      .. rst-class:: sig-pretty-signature
      
         | *get* frameCount(): *number*
      
      **Returns**\ : *number*
      



.. js:method:: cee.pt.ParticleModel.maxParticleCount

      .. rst-class:: sig-pretty-signature
      
         | *get* maxParticleCount(): *number*
      
      **Returns**\ : *number*
      



.. js:method:: cee.pt.ParticleModel.name

      Name of the model.
      
      Mainly used for debugging.
      
      .. rst-class:: sig-pretty-signature
      
         | *get* name(): *string*
      
      Name of the model.
      
      Mainly used for debugging.
      
      **Returns**\ : *string*
      
      .. rst-class:: sig-pretty-signature
      
         | *set* name(**value**\ : *string*\ ): *void*
      
      Name of the model.
      
      Mainly used for debugging.
      
      **Parameters**
      
      
         **value**\ : *string*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.scalarFieldNames

      .. rst-class:: sig-pretty-signature
      
         | *get* scalarFieldNames(): *string*\ []
      
      **Returns**\ : *string*\ []
      



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: cee.pt.ParticleModel.closeModel

      .. rst-class:: sig-pretty-signature
      
         | closeModel(): *void*
      
      Close the model and release resources. Error handler is preserved.
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.getBoundingBox

      .. rst-class:: sig-pretty-signature
      
         | getBoundingBox(**options**\ : :js:class:`ModelBoundingBoxOptions <cee.ModelBoundingBoxOptions>`\ ): :js:class:`BoundingBox <cee.BoundingBox>`
      
      Returns the current :js:class:`BoundingBox <cee.BoundingBox>` (in world coordinates) of the model.
      
      When called without any parameters this method will return the current bounding box of the model, including only visible parts/objects. For models that support it, the full bounding box can may queried by specifying the optional :js:class:`ModelBoundingBoxOptions <cee.ModelBoundingBoxOptions>` and setting :js:data:`ModelBoundingBoxOptions.includeHiddenParts <cee.ModelBoundingBoxOptions.includeHiddenParts>` to true.
      
      **Parameters**
      
      
         **options**\ : :js:class:`ModelBoundingBoxOptions <cee.ModelBoundingBoxOptions>`
      
      
      **Returns**\ : :js:class:`BoundingBox <cee.BoundingBox>`
      



.. js:method:: cee.pt.ParticleModel.getCurrentFrameScalarRange

      .. rst-class:: sig-pretty-signature
      
         | getCurrentFrameScalarRange(): { max: *number*\ , min: *number* }
      
      Per-frame scalar range de-quantized from uint16 via the global range.
      
      **Returns**\ : { max: *number*\ , min: *number* }
      



.. js:method:: cee.pt.ParticleModel.getDecimationFactor

      .. rst-class:: sig-pretty-signature
      
         | getDecimationFactor(): *number*
      
      **Returns**\ : *number*
      



.. js:method:: cee.pt.ParticleModel.getDefaultCameraConfig

      .. rst-class:: sig-pretty-signature
      
         | getDefaultCameraConfig(): :js:class:`CameraConfig <cee.CameraConfig>`
      
      Can return an optional default camera configuration for this model.
      
      If a model returns a default camera config, any views displaying the model may utilize the information to do first-time setup of their camera. The camera config will not have any effect on views where the camera has already been set by the user. If multiple models are shown in the same view, the first model with a default camera config will take precedence.
      
      **Returns**\ : :js:class:`CameraConfig <cee.CameraConfig>`
      



.. js:method:: cee.pt.ParticleModel.getOpacity

      .. rst-class:: sig-pretty-signature
      
         | getOpacity(): *number*
      
      Get the opacity of the particles. 0 = fully transparent, 1 = fully opaque.
      
      **Returns**\ : *number*
      



.. js:method:: cee.pt.ParticleModel.getParticleColor

      .. rst-class:: sig-pretty-signature
      
         | getParticleColor(): :js:class:`Color3Like <cee.Color3Like>`
      
      **Returns**\ : :js:class:`Color3Like <cee.Color3Like>`
      



.. js:method:: cee.pt.ParticleModel.getParticleSize

      .. rst-class:: sig-pretty-signature
      
         | getParticleSize(): *number*
      
      **Returns**\ : *number*
      



.. js:method:: cee.pt.ParticleModel.getScalarMapper

      .. rst-class:: sig-pretty-signature
      
         | getScalarMapper(): :js:class:`ScalarMapper <cee.ScalarMapper>`
      
      **Returns**\ : :js:class:`ScalarMapper <cee.ScalarMapper>`
      



.. js:method:: cee.pt.ParticleModel.getUseScalarMapping

      .. rst-class:: sig-pretty-signature
      
         | getUseScalarMapping(): *boolean*
      
      **Returns**\ : *boolean*
      



.. js:method:: cee.pt.ParticleModel.isOpen

      .. rst-class:: sig-pretty-signature
      
         | isOpen(): *boolean*
      
      **Returns**\ : *boolean*
      



.. js:method:: cee.pt.ParticleModel.openModel

      .. rst-class:: sig-pretty-signature
      
         | openModel(**datasetUrl**\ : *string*\ ): *Promise*
      
      Open a particle dataset from a URL.
      
      **Parameters**
      
      
         **datasetUrl**\ : *string*
      
      
      **Returns**\ : *Promise*
      



.. js:method:: cee.pt.ParticleModel.setActiveScalarField

      .. rst-class:: sig-pretty-signature
      
         | setActiveScalarField(**fieldName**\ : *string*\ ): *Promise*
      
      Switch active scalar field on the server. Invalidates cache and reloads current frame.
      
      **Parameters**
      
      
         **fieldName**\ : *string*
      
      
      **Returns**\ : *Promise*
      



.. js:method:: cee.pt.ParticleModel.setDecimationFactor

      .. rst-class:: sig-pretty-signature
      
         | setDecimationFactor(**factor**\ : *number*\ ): *void*
      
      Set server-side decimation factor [0.01, 1.0]. Invalidates cache and reloads current frame.
      
      **Parameters**
      
      
         **factor**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setFrame

      .. rst-class:: sig-pretty-signature
      
         | setFrame(**frameIndex**\ : *number*\ ): *Promise*
      
      Load and display a frame. Cancels any previous inflight request.
      
      **Parameters**
      
      
         **frameIndex**\ : *number*
      
      
            0-based index in ``[0, frameCount)``
      
      
      
      **Returns**\ : *Promise*
      



.. js:method:: cee.pt.ParticleModel.setOpacity

      .. rst-class:: sig-pretty-signature
      
         | setOpacity(**opacity**\ : *number*\ ): *void*
      
      Set the opacity of the particles (clamped to [0, 1]).
      
      **Parameters**
      
      
         **opacity**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setParticleColor

      .. rst-class:: sig-pretty-signature
      
         | setParticleColor(**color**\ : :js:class:`Color3Like <cee.Color3Like>`\ ): *void*
      
      Set solid particle color (used when scalar mapping is off).
      
      **Parameters**
      
      
         **color**\ : :js:class:`Color3Like <cee.Color3Like>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setParticleSize

      .. rst-class:: sig-pretty-signature
      
         | setParticleSize(**size**\ : *number*\ ): *void*
      
      Set point size in pixels (clamped to >= 1).
      
      **Parameters**
      
      
         **size**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setPreloadFrameCount

      .. rst-class:: sig-pretty-signature
      
         | setPreloadFrameCount(**count**\ : *number*\ ): *void*
      
      Set the number of frames to preload ahead. 0 disables preloading. Takes effect immediately: if the model is open and a frame is loaded, a new preload batch is started from the current frame.
      
      **Parameters**
      
      
         **count**\ : *number*
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setScalarMapper

      .. rst-class:: sig-pretty-signature
      
         | setScalarMapper(**mapper**\ : :js:class:`ScalarMapper <cee.ScalarMapper>`\ ): *void*
      
      Set scalar mapper for color mapping.
      
      **Parameters**
      
      
         **mapper**\ : :js:class:`ScalarMapper <cee.ScalarMapper>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setServerErrorHandler

      .. rst-class:: sig-pretty-signature
      
         | setServerErrorHandler(**handler**\ : :js:class:`ServerErrorHandler <cee.pt.ServerErrorHandler>`\ ): *void*
      
      Set error handler. Persists across close/open cycles. Pass ``null`` to clear.
      
      **Parameters**
      
      
         **handler**\ : :js:class:`ServerErrorHandler <cee.pt.ServerErrorHandler>`
      
      
      **Returns**\ : *void*
      



.. js:method:: cee.pt.ParticleModel.setUseScalarMapping

      .. rst-class:: sig-pretty-signature
      
         | setUseScalarMapping(**enable**\ : *boolean*\ ): *Promise*
      
      Enable or disable scalar-based color mapping. Toggles the server wire format between 12 BPP (scalar) and 10 BPP (position-only).
      
      **Parameters**
      
      
         **enable**\ : *boolean*
      
      
      **Returns**\ : *Promise*
      




