React components for displaying optical design diagrams.
Currently the following diagrams are provided:
npm install react-optics-diagrams
Use the component diagrams like you would any other React component. For example, as a script:
// ...
const rayTraceResults: RayTraceResults = data;
const props = {
rayTraceResults,
wavelengths: [
{ value: 0.4861, units: 'µm' },
{ value: 0.5876, units: 'µm' },
{ value: 0.6563, units: 'µm' },
],
fieldSpecs: [
{ value: 0.0, units: 'deg', type: 'angle' } as const,
{ value: 5.0, units: 'deg', type: 'angle' } as const,
],
};
ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(
<React.StrictMode>
<SpotDiagramsGrid {...props} />
</React.StrictMode>,
);
This will create a grid of spot diagrams that looks like the following, one for each field and wavelength combination.
See the demo folder for examples.
# Run the demo on the development server
npm run dev
# Run tests
npm run test