ParticleModel

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).

const model = new cee.pt.ParticleModel();
await model.openModel('http://server/api/v1/models/mydata.ptfx');
await model.setFrame(0);
model.closeModel();

Constructors


Constructors

ParticleModel.constructor([properties])
Arguments:
  • properties (Partial) – optional None
Return type:

ParticleModel

Accessors

ParticleModel.activeScalarField()
Return type:string
ParticleModel.animation()

The animation controller for this model.

Return type:Animation
ParticleModel.currentFrameIndex()
Return type:number
ParticleModel.datasetInfo()
Return type:DatasetInfo
ParticleModel.frameCount()
Return type:number
ParticleModel.maxParticleCount()
Return type:number
ParticleModel.name()

Name of the model.

Mainly used for debugging.

Return type:string
ParticleModel.name(value)
Arguments:
  • value (string) – None

Name of the model.

Mainly used for debugging.

Return type:void
ParticleModel.scalarFieldNames()
Return type:[string]

Methods

closeModel

ParticleModel.closeModel()

Close the model and release resources. Error handler is preserved.

Return type:void

getBoundingBox

ParticleModel.getBoundingBox([options])
Arguments:
  • options (ModelBoundingBoxOptions) – optional None

Returns the current 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 ModelBoundingBoxOptions and setting ModelBoundingBoxOptions.includeHiddenParts to true.

Return type:BoundingBox

getCurrentFrameScalarRange

ParticleModel.getCurrentFrameScalarRange()

Per-frame scalar range de-quantized from uint16 via the global range.

Return type:function

getDecimationFactor

ParticleModel.getDecimationFactor()
Return type:number

getDefaultCameraConfig

ParticleModel.getDefaultCameraConfig()

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.

Return type:CameraConfig

getOpacity

ParticleModel.getOpacity()

Get the opacity of the particles. 0 = fully transparent, 1 = fully opaque.

Return type:number

getParticleColor

ParticleModel.getParticleColor()
Return type:Color3Like

getParticleSize

ParticleModel.getParticleSize()
Return type:number

getScalarMapper

ParticleModel.getScalarMapper()
Return type:ScalarMapper

getUseScalarMapping

ParticleModel.getUseScalarMapping()
Return type:boolean

isOpen

ParticleModel.isOpen()
Return type:boolean

openModel

ParticleModel.openModel(datasetUrl)
Arguments:
  • datasetUrl (string) – None

Open a particle dataset from a URL.

Return type:Promise <DatasetInfo>

setActiveScalarField

ParticleModel.setActiveScalarField(fieldName)
Arguments:
  • fieldName (string) – None

Switch active scalar field on the server. Invalidates cache and reloads current frame.

Return type:Promise <void>

setDecimationFactor

ParticleModel.setDecimationFactor(factor)
Arguments:
  • factor (number) – None

Set server-side decimation factor [0.01, 1.0]. Invalidates cache and reloads current frame.

Return type:void

setFrame

ParticleModel.setFrame(frameIndex)
Arguments:
  • frameIndex (number) – 0-based index in [0, frameCount)

Load and display a frame. Cancels any previous inflight request.

Return type:Promise <void>

setOpacity

ParticleModel.setOpacity(opacity)
Arguments:
  • opacity (number) – None

Set the opacity of the particles (clamped to [0, 1]).

Return type:void

setParticleColor

ParticleModel.setParticleColor(color)
Arguments:
  • color (Color3Like) – None

Set solid particle color (used when scalar mapping is off).

Return type:void

setParticleSize

ParticleModel.setParticleSize(size)
Arguments:
  • size (number) – None

Set point size in pixels (clamped to >= 1).

Return type:void

setPreloadFrameCount

ParticleModel.setPreloadFrameCount(count)
Arguments:
  • count (number) – None

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.

Return type:void

setScalarMapper

ParticleModel.setScalarMapper(mapper)
Arguments:
  • mapper (ScalarMapper) – None

Set scalar mapper for color mapping.

Return type:void

setServerErrorHandler

ParticleModel.setServerErrorHandler(handler)
Arguments:

Set error handler. Persists across close/open cycles. Pass null to clear.

Return type:void

setUseScalarMapping

ParticleModel.setUseScalarMapping(enable)
Arguments:
  • enable (boolean) – None

Enable or disable scalar-based color mapping. Toggles the server wire format between 12 BPP (scalar) and 10 BPP (position-only).

Return type:Promise <void>