Skip to content
Michael Keilman edited this page Jul 13, 2022 · 16 revisions

in progress

VTK is open-source 3D rendering code authored by KitWare (link)

dev most active on c++ (link) - can be useful to see what is available

we use javascript (link) which is typically behind the c++

we update on major version releases (x of x.y.z) (or soon thereafter) because they release several per day

class wrappers for ease of use

API

sirepo-vtk-plotting.js

VTKUtils

(generated jsdoc)

VTKScene

(generated jsdoc)

ActorBundle

A convenient object bundling a source, actor, and mapper, which almost always appear together anyway

Constructor

new ActorBundle(source, transform, actorProperties)

Parameters:
Name Type Description
source * a vtk source, reader, etc.
transform SIREPO.GEOMETRY.Transform a Transform to translate between "lab" and "local" coordinate systems
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

Members

actor :vtk.Rendering.Core.vtkActor

the transform

Type:
  • vtk.Rendering.Core.vtkActor

Source:

actorProperties :vtk.Rendering.Core.Property

properties of the actor

Type:
  • vtk.Rendering.Core.Property

Source:

mapper :vtk.Rendering.Core.vtkMapper

a mapper

Type:
  • vtk.Rendering.Core.vtkMapper

Source:

transform :SIREPO.GEOMETRY.Transform

the transform

Type:
  • SIREPO.GEOMETRY.Transform

Source:

Methods

actorBoundingBox(padPct) → {BoxBundle}

Builds a wireframe box around this actor, with optional padding

Parameters:
Name Type Default Description
padPct number 0 additional padding as a percentage of the size

Source:

Returns:

Type
BoxBundle

getActorProperty(name) → {*}

Gets the value of the actor property with the given name

Parameters:
Name Type Description
name string the name of the property

Source:

Returns:

Type
*

setActorProperty(name, value)

Sets the actor property with the given name to the given value

Parameters:
Name Type Description
name string the name of the property
value * the value to set

Source:

setColor(color)

Convenience method for setting the color. Uses colorToFloat to convert

Parameters:
Name Type Description
color string | Array.<number>

Source:

setMapper(mapper)

Sets the mapper for this bundle as well as the actor

Parameters:
Name Type Description
mapper vtk.Rendering.Core.vtkMapper

Source:

setSource(source)

Sets the source for this bundle. Also sets the mapper's input connection to the source's output

Parameters:
Name Type Description
source * vtk source

Source:

Documentation generated by JSDoc 3.6.10 on Wed Jul 13 2022 15:19:06 GMT+0000 (GMT)

BoxBundle

A bundle for a cube source

Constructor

new BoxBundle(labSize, labCenter, transform, actorProperties)

Parameters:
Name Type Description
labSize Array.<number> array of the x, y, z sides of the box in the lab
labCenter Array.<number> array of the x, y, z coords of the box's center in the lab
transform SIREPO.GEOMETRY.Transform a Transform to translate between "lab" and "local" coordinate systems
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

Methods

setCenter(labCenter)

Sets the center of the box

Parameters:
Name Type Description
labCenter Array.<number> array of the x, y, z coords of the box's center in the lab

Source:

setSize(labSize-)

Sets the size of the box

Parameters:
Name Type Description
labSize- Array.<number> array of the x, y, z lengths of the box

Source:

Documentation generated by JSDoc 3.6.10 on Wed Jul 13 2022 15:19:06 GMT+0000 (GMT)

CoordMapper

Provides a mapping from "lab" coordinates to vtk's coordinates via a SIREPO.GEOMETRY.Transform. Also wraps the creation of various Bundles so the transform gets applied automatically

Constructor

new CoordMapper(transform)

Parameters:
Name Type Description
transform SIREPO.GEOMETRY.Transform a Transform to translate between "lab" and "local" coordinate systems

Source:

Methods

buildActorBundle(source, transform, actorProperties)

Creates a Bundle from an arbitrary source

Parameters:
Name Type Description
source * a vtk source, reader, etc.
transform SIREPO.GEOMETRY.Transform a Transform to translate between "lab" and "local" coordinate systems
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

buildBox(labSize, labCenter, actorProperties) → {BoxBundle}

Builds a box

Parameters:
Name Type Description
labSize Array.<number> array of the x, y, z sides of the box in the lab
labCenter Array.<number> array of the x, y, z coords of the box's center in the lab
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

Returns:

Type
BoxBundle

buildLine(labP1, labP2, actorProperties) → {LineBundle}

Builds a line

Parameters:
Name Type Description
labP1 Array.<number> 1st point
labP2 Array.<number> 2nd point
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

Returns:

Type
LineBundle

buildPlane(labOrigin, labP1, labP2, actorProperties) → {LineBundle}

Builds a plane

Parameters:
Name Type Description
labOrigin Array.<number> origin
labP1 Array.<number> 1st point
labP2 Array.<number> 2nd point
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

Returns:

Type
LineBundle

buildSphere(labCenter, radius, actorProperties) → {SphereBundle}

Builds a sphere

Parameters:
Name Type Description
labCenter Array.<number> center in the lab
radius number
actorProperties Object a map of actor properties (e.g. 'color') to values

Source:

Returns:

Type
SphereBundle

Documentation generated by JSDoc 3.6.10 on Wed Jul 13 2022 15:19:06 GMT+0000 (GMT)

Also see sirepo-geometry.js

Clone this wiki locally