This Rust project demonstrates how to draw various geometrical shapes using the raster
crate. The shapes include points, lines, triangles, rectangles, circles, pentagons, and cubes.
- Point: Represents a single point on the image canvas.
- Line: Draws a line between two points using Bresenham's line algorithm.
- Triangle: Draws a triangle using three points.
- Rectangle: Draws a rectangle given two opposite corners.
- Circle: Draws a circle centered at a point with a specified radius.
- Pentagon: Draws a regular pentagon centered at a point with a specified radius.
- Cube: Draws a 2D representation of a cube.
To build and run the application using Docker, follow these steps:
-
Build the Docker image:
docker build -t rust-drawing-app .
-
Run the Docker container:
docker run --rm -v $(pwd):/usr/src/app rust-drawing-app
-
Clone the repository:
git clone https://github.com/K11E3R/drawing.git cd geometrical_shapes
-
Ensure you have Rust and Cargo installed.
-
Build and run the project:
cargo build --release cargo run
-
The program will generate an
image.png
file in the current directory, showcasing the drawn shapes.
raster
: A 2D graphics library for Rust used to handle images and pixel manipulation.rand
: Provides random number generation capabilities.
- Author: Yassine Naanani @K11E3R
- Email: prs.online.00@gmail.com
Contributions are welcome! If you find any bugs or want to add more shapes or features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the MIT License file for details.
Enjoy