An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Geometry

This program allows you to draw geometric primitives using SFML.

![promo](img/promo.gif)

## 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).