Skip to content

Commit d7ec0f0

Browse files
committed
update doc to add GlyphRepresentation info
1 parent 4382567 commit d7ec0f0

File tree

1 file changed

+93
-1
lines changed

1 file changed

+93
-1
lines changed

docs/README.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dash_vtk.View(
2626
interactorSettings=[...], # Binding of mouse events to camera action (Rotate, Pan, Zoom...)
2727
cameraPosition=[x,y,z], # Where the camera should be initially placed in 3D world
2828
cameraViewUp=[dx, dy, dz], # Vector to use as your view up for your initial camera
29-
cameraParallelProjection=False, # Should we see our 3D work with perspective or flat with no depth perception
29+
cameraParallelProjection=False, # Perspective or flat
3030
triggerRender=0, # Timestamp meant to trigger a render when different
3131
triggerResetCamera=0, # Timestamp meant to trigger a reset camera when different
3232
)
@@ -349,6 +349,97 @@ The list below show you the default values used for each argument:
349349

350350
On top of those previous settings we provide additional properties to configure a lookup table using one of our available [__colorMapPreset__](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/ColorTransferFunction/ColorMaps.json) and a convinient __colorDataRange__ to rescale to color map to your area of focus.
351351

352+
### GlyphRepresentation
353+
354+
GlyphRepresentation let you use a source as a Glyph which will then be cloned and position at every points of another source. The properties available on the __GlyphRepresentation__ let you tune the way you want to render your geometry.
355+
356+
In VTK a representation is composed of an [__Actor__](https://kitware.github.io/vtk-js/api/Rendering_Core_Actor.html), a [__Mapper__](https://kitware.github.io/vtk-js/api/Rendering_Core_Glyph3DMapper.html) and a [__Property__](https://kitware.github.io/vtk-js/api/Rendering_Core_Property.html). Each of those object can be configured using the __actor__, __mapper__ and __property__ arguments of the __GlyphRepresentation__.
357+
358+
The list below show you the default values used for each argument:
359+
360+
- __actor__:
361+
- origin = (0,0,0)
362+
- position = (0,0,0)
363+
- scale = (1,1,1)
364+
- visibility = 1
365+
- pickable = 1
366+
- dragable = 1
367+
- orientation = (0,0,0)
368+
- __property__:
369+
- lighting = true
370+
- interpolation = [Interpolation.GOURAUD](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Property/Constants.js#L1-L5)
371+
- ambient = 0
372+
- diffuse = 1
373+
- specular = 0
374+
- specularPower = 1
375+
- opacity = 1
376+
- edgeVisibility = false
377+
- lineWidth = 1
378+
- pointSize = 1
379+
- backfaceCulling = false
380+
- frontfaceCulling = false
381+
- representation = [Representation.SURFACE](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Property/Constants.js#L7-L11)
382+
- color = (1,1,1) # White
383+
- ambientColor = (1,1,1)
384+
- specularColor = (1,1,1)
385+
- diffuseColor = (1,1,1)
386+
- edgeColor = (0,0,0) # Black
387+
- __mapper__:
388+
- orient = true
389+
- orientationMode = 0 ([Available values](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Glyph3DMapper/Constants.js#L1-L5))
390+
- orientationArray = null
391+
- scaling = true
392+
- scaleFactor = 1.0
393+
- scaleMode = 1 ([Available values](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Glyph3DMapper/Constants.js#L7-L11))
394+
- scaleArray = null
395+
- static = false
396+
- scalarVisibility = true
397+
- scalarRange = [0, 1]
398+
- useLookupTableScalarRange = false
399+
- colorMode = 0 ([Available values](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Mapper/Constants.js#L1-L5))
400+
- scalarMode = 0 ([Available values](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Mapper/Constants.js#L7-L14))
401+
- arrayAccessMode = 1 ([Available values](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/Mapper/Constants.js#L16-L19))
402+
- colorByArrayName = ''
403+
- interpolateScalarsBeforeMapping = false
404+
- useInvertibleColors = false
405+
- fieldDataTupleId = -1
406+
- viewSpecificProperties = None
407+
- customShaderAttributes = []
408+
409+
On top of those previous settings we provide additional properties to configure a lookup table using one of our available [__colorMapPreset__](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/ColorTransferFunction/ColorMaps.json) and a convinient __colorDataRange__ to rescale to color map to your area of focus.
410+
411+
An example of the __GlyphRepresentation__ could be for creating a spicky sphere by positioning cones normal to the sphere.
412+
413+
```python
414+
def Example():
415+
return dash_vtk.View(
416+
children=[
417+
dash_vtk.GlyphRepresentation(
418+
mapper={'orientationArray': 'Normals'}
419+
children=[
420+
dash_vtk.Algorithm(
421+
port=0,
422+
vtkClass='vtkSphereSource',
423+
state={
424+
'phiResolution': 10,
425+
'thetaResolution': 20,
426+
},
427+
),
428+
dash_vtk.Algorithm(
429+
port=1,
430+
vtkClass='vtkConeSource'
431+
state={
432+
'resolution': 30,
433+
'height': 0.25,
434+
'radius': 0.08,
435+
},
436+
),
437+
]
438+
)
439+
]
440+
)
441+
```
442+
352443
### VolumeRepresentation
353444

354445
The properties available on the __VolumeRepresentation__ let you tune the way you want to render your volume.
@@ -586,6 +677,7 @@ The __Volume__ element expect a single __state__ property that is internaly spli
586677
- dimensions
587678
- spacing
588679
- origin
680+
- direction
589681
- field: (Contains the properties of __DataArray__)
590682
- values: Array of values for the field
591683
- numberOfComponents: Number of components per point/cell

0 commit comments

Comments
 (0)