-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Cutter): Add vtkCutter class along with example
* Add vtkCutter to AvailableClasses to prevent tree-shaking * Add an example of using the cutter
- Loading branch information
David Bertouille
committed
May 17, 2021
1 parent
090af8d
commit 6715b5a
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters