LatticeVisualizer is a React-based application for visualizing lattice points in 2D and 3D space. I created this project to visualize lattices while studying lattice-based cryptography independently.
- 2D and 3D Visualization: Visualize lattice points in 2D and 3D space.
- Dynamic Basis Vectors: Modify the basis vectors to see how the lattice changes.
- Dimension Support: Supports up to 3D visualization.
- Shading Parallelepiped: Shade a random parallelepiped within the lattice.
- Unshading Parallelepiped: Unshade the previously shaded parallelepiped.
- Node.js and npm installed on your machine.
-
Clone the repository:
git clone https://github.com/yourusername/LatticeVisualizer.git cd LatticeVisualizer
-
Install the dependencies:
npm install
-
Start the development server:
npm start
-
Open your web browser and navigate to
http://localhost:3000
to see the application in action.
- Dimension: Use the input field to set the lattice dimension (2D or 3D).
- Sum Limit: Set the range for the coefficients used in generating lattice points.
- Basis Vectors: Modify the basis vectors to see how the lattice changes.
- Shade Parallelepiped: Click the "Shade Parallelepiped" button to shade a random parallelepiped within the lattice.
- Unshade Parallelepiped: Click the "Unshade Parallelepiped" button to remove the shading.
To visualize a 2D lattice:
- Set the dimension to 2.
- Set the basis vectors to
[[1, 0], [0, 1]]
. - Click "Shade Parallelepiped" to shade a random area within the lattice.
To visualize a 3D lattice:
- Set the dimension to 3.
- Set the basis vectors to
[[1, 0, 0], [0, 1, 0], [0, 0, 1]]
. - Click "Shade Parallelepiped" to shade a random area within the lattice.
You can see it in action on my blog: CryptiCosmos
LatticeVisualizer.js
:
- Handles the state and logic for dimension, basis vectors, sum limit, and shading.
- Generates lattice points based on user inputs.
- Renders 2D and 3D lattice visualizations using D3.js and Three.js.
- Provides buttons to shade and unshade parallelepipeds within the lattice.
- React: UI library for building the application.
- Three.js: Library for 3D visualization.
- D3.js: Library for 2D visualization.
- OrbitControls: Three.js add-on for interactive controls.
Contributions are welcome! Please fork the repository and submit a pull request for any feature requests, bug fixes, or improvements.
This project is licensed under the MIT License.