/cg-penrose

:triangular_ruler: Written in Python 3 and Qt5, this software allows the application of 2D graphical geometric transformations like translation, shearing, scale, rotation, and reflection/mirroring in a polygon specified by the user.

Primary LanguagePythonMIT LicenseMIT

Welcome to CG-Penrose v1.2b

Python versions License

CG-Penrose is a software developed using Python 3.6 and Qt5, in Computer Graphics discipline, taught by prof. Jonatas Oliveira. It can help you to simulate lines rasterization and calculate 2D transformations on polygons.

Features:

  • 2D Geometric transformations like translation, shearing, scaling, rotation and reflection/mirroring in any polygon specified by you.
  • Simulate line rasterization using algorithms like Digital Differential Analyzer (DDA) and Bresenham Line-Drawing

🌟 Don't forget to give a star to this repo =)

Index

  1. Setup
  2. Basic usage

Setup

  1. Clone the repo

    $ git clone https://github.com/allexlima/cg-penrose.git
    $ cd cg-penrose/
  2. Using Makefile:

    Supported only in Linux-like operating systems yet 💁

    Prepare everything using only

    $ make

    Then,

    $ make run

    and be happy :)

~OR~

  1. Create virtualenv and install the requirements

    $ virtualenv -p python3 env  
    $ source env/bin/activate
    $ pip install -r requirements.txt
  2. Compile the UIs

    $ python setup.py build_ui
  3. Install the package

    $ pip install -e .
  4. And finally, run penrose =)

    $ python -m penrose

Basic Usage

How to use line rasterization functions?

  • Insert, using the push button exactly 2 vertices. Then, navigate to Tools > Rasterize line with... and choose any algorithm.

How to apply one or more transformations in a 2D polygon?

  • First, you should know that you must insert at least 3 vertices through the 'push' button, in the main screen. After this, you can render your polygon clicking in Tools > Render, or pressing F4 key shortcut.

  • With your polygon rendered, now you can apply any of one transformation available in the 2D Transformations tab. You can check the selected transformation and set the necessary parameters, then you should click in Tools > Update or press F5 key to apply and see the output.


Developed by Allex Lima, Paulo Moraes and Renan Barroncas with ❤️ using Python 3.6 and PyQt5!

Copyright © 2017 CG-Penrose - Licensed by MIT LICENSE.