https://github.com/astrodynamic/geometry
Geometry: A program to draw geometric primitives using SFML. Create lines, circles, triangles, rectangles, and squares easily. MIT licensed.
https://github.com/astrodynamic/geometry
affine-transformation cmake cmakelists cpp cpp17 drawing-app geometry graphics make makefile primitives sfml sfml-library
Last synced: 7 months ago
JSON representation
Geometry: A program to draw geometric primitives using SFML. Create lines, circles, triangles, rectangles, and squares easily. MIT licensed.
- Host: GitHub
- URL: https://github.com/astrodynamic/geometry
- Owner: Astrodynamic
- License: mit
- Created: 2023-05-02T09:40:02.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2023-05-10T10:50:50.000Z (over 2 years ago)
- Last Synced: 2025-01-12T18:09:32.290Z (9 months ago)
- Topics: affine-transformation, cmake, cmakelists, cpp, cpp17, drawing-app, geometry, graphics, make, makefile, primitives, sfml, sfml-library
- Language: C++
- Homepage:
- Size: 201 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Geometry
This program allows you to draw geometric primitives using SFML.

## Installation
To build and install the project, follow these steps:
1. Clone the repository:
```
git clone https://github.com/your/repository.git
```2. Change to the project directory:
```
cd Geometry
```3. Build the project using CMake:
```
cmake -S . -B ./build
cmake --build ./build
```4. Run the executable:
```
./build/Geometry
```## Dependencies
The project uses the SFML library (version 2.5.1) for graphics, window management, and system functionality. The library source code will be downloaded automatically during the build process.
## Usage
The program allows you to draw different types of primitives, such as lines, circles, triangles, rectangles, and squares. The following code snippet demonstrates how to use the program:
```cpp
#include
#include#include "line.h"
#include "circle.h"
#include "triangle.h"
#include "rectangle.h"
#include "square.h"int main() {
sf::RenderWindow window(sf::VideoMode(800, 600), "Geometry");
std::vector> primitives;
primitives.emplace_back(std::make_unique(100, 100, 200, 200));
primitives.emplace_back(std::make_unique(400, 300, 50));
primitives.emplace_back(std::make_unique(300, 100, 400, 200, 200, 200));
primitives.emplace_back(std::make_unique(500, 400, 100, 50));
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) window.close();
}
window.clear();
for (auto& primitive : primitives) {
primitive->draw(window);
primitive->rotate(0.2f);
}
window.display();
sf::sleep(sf::milliseconds(50));
}
return 0;
}
```## License
This project is licensed under the [MIT License](LICENSE).