PolyData 数据结构介绍
<pre><code class="language-javascript">{
vtkClass: 'vtkPolyData',
metadata: {
name: 'example.vtk',
size: 2345,
},
points: {
vtkClass: 'vtkPoints',
name: '_points',
numberOfComponents: 3,
size: 300,
dataType: 'Float32Array',
buffer: new ArrayBuffer(),
values: new Float32Array(this.buffer),
ranges: [
{ min: -1, max: 1, component: 0, name: 'X' },
{ min: -1, max: 1, component: 1, name: 'Y' },
{ min: -1, max: 1, component: 2, name: 'Z' },
],
},
verts: {
vtkClass: 'vtkCellArray',
name: '_verts',
numberOfComponents: 1,
size: 123,
dataType: 'Uint32Array', // or Uint16Array
buffer: new ArrayBuffer(),
values: new Uint32Array(this.buffer), // Follow the CellArray Mapping [{nbPoints}, {pointIdx...}]
},
lines: {
vtkClass: 'vtkCellArray',
name: '_lines',
numberOfComponents: 1,
size: 0,
dataType: 'Uint32Array', // or Uint16Array
values: null,
},
polys: {
vtkClass: 'vtkCellArray',
name: '_lines',
numberOfComponents: 1,
size: 8,
dataType: 'Uint32Array', // or Uint16Array
values: new Uint32Array([3, 0, 1, 2, 3, 3, 4, 5]), // 2 triangles (0,1,2)+(3,4,5)
},
strips: {
vtkClass: 'vtkCellArray',
name: '_lines',
numberOfComponents: 1,
size: 0,
dataType: 'Uint32Array', // or Uint16Array
values: null,
},
pointData: {
&quot;vtkClass&quot;: &quot;vtkDataSetAttributes&quot;,
&quot;activeGlobalIds&quot;: -1,
&quot;activeNormals&quot;: -1,
&quot;activePedigreeIds&quot;: -1,
&quot;activeScalars&quot;: 0,
&quot;activeTCoords&quot;: -1,
&quot;activeTensors&quot;: -1,
&quot;activeVectors&quot;: -1,
&quot;copyFieldFlags&quot;: [],
&quot;doCopyAllOff&quot;: false,
&quot;doCopyAllOn&quot;: true,
&quot;arrays&quot;: [
{
&quot;data&quot;: {
vtkClass: 'vtkDataArray',
name: 'Temperature',
numberOfComponents: 1,
size: 300,
dataType: 'Float32Array',
buffer: new ArrayBuffer(), // Optional: Available if fetch from Network
values: new Float32Array(this.buffer)
}
}
],
},
cellData: {
&quot;vtkClass&quot;: &quot;vtkDataSetAttributes&quot;,
&quot;activeGlobalIds&quot;: -1,
&quot;activeNormals&quot;: -1,
&quot;activePedigreeIds&quot;: -1,
&quot;activeScalars&quot;: 0,
&quot;activeTCoords&quot;: -1,
&quot;activeTensors&quot;: -1,
&quot;activeVectors&quot;: -1,
&quot;copyFieldFlags&quot;: [],
&quot;doCopyAllOff&quot;: false,
&quot;doCopyAllOn&quot;: true,
&quot;arrays&quot;: [
{
&quot;data&quot;: {
type: 'vtkDataArray',
name: 'CellId',
numberOfComponents: 1,
size: 132,
dataType: 'Uint32Array',
values: new Uint32Array(this.buffer)
}
}
]
},
fieldData: {
&quot;vtkClass&quot;: &quot;vtkDataSetAttributes&quot;,
&quot;activeGlobalIds&quot;: -1,
&quot;activeNormals&quot;: -1,
&quot;activePedigreeIds&quot;: -1,
&quot;activeScalars&quot;: -1,
&quot;activeTCoords&quot;: -1,
&quot;activeTensors&quot;: -1,
&quot;activeVectors&quot;: -1,
&quot;copyFieldFlags&quot;: [],
&quot;doCopyAllOff&quot;: false,
&quot;doCopyAllOn&quot;: true,
&quot;arrays&quot;: [
{
&quot;data&quot;: {
vtkClass: 'vtkVariantArray',
name: 'Meta',
size: 3,
dataType: 'JSON',
values: ['Some string', [1, 2, 3], { ex: 'obj' }],
}
}
]
}
}</code></pre>