Skip to content

Commit

Permalink
Merge pull request #8 from dbertouille/cutter-example
Browse files Browse the repository at this point in the history
Add cutter example
  • Loading branch information
jourdain authored May 17, 2021
2 parents 090af8d + 6715b5a commit 350a976
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/AvailableClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import '@kitware/vtk.js/Filters/Sources/PointSource.js';
import '@kitware/vtk.js/Filters/Sources/SphereSource.js';

// Filters
import '@kitware/vtk.js/Filters/Core/Cutter.js';
import '@kitware/vtk.js/Filters/General/WarpScalar.js';
import '@kitware/vtk.js/Filters/General/TubeFilter.js';

Expand Down
35 changes: 35 additions & 0 deletions usage/Geometry/CutterExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import ReactDOM from 'react-dom';

import { newInstance as newVtkPlaneInstance } from '@kitware/vtk.js/Common/DataModel/Plane.js';

import { Algorithm, View, GeometryRepresentation, Reader } from 'react-vtk-js';

function Example(props) {
const plane = newVtkPlaneInstance({
origin: [0, 0, 0],
normal: [0, 0, 1],
});

return (
<div style={{ width: '100vw', height: '100vh' }}>
<View background={[0.0, 0.0, 0.0]}>
<GeometryRepresentation
property={{
color: [0.7, 0, 0],
}}
>
<Algorithm vtkClass='vtkCutter' state={{ cutFunction: plane }}>
<Reader
vtkClass='vtkOBJReader'
url='https://kitware.github.io/vtk-js-datasets/data/obj-mtl/star-wars-vader-tie-fighter.obj'
/>
</Algorithm>
</GeometryRepresentation>
</View>
</div>
);
}

// Render React object
ReactDOM.render(<Example />, document.querySelector('.root'));
1 change: 1 addition & 0 deletions usage/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<option>Geometry/ProcessingPipeline</option>
<option>Geometry/SourceViewer</option>
<option>Geometry/Glyph</option>
<option>Geometry/CutterExample</option>
<option>Volume/SliceRendering</option>
<option>Volume/SyntheticVolumeRendering</option>
<option>Volume/VolumeRendering</option>
Expand Down

0 comments on commit 350a976

Please sign in to comment.