Git Product home page Git Product logo

shapepy's Introduction

Documentation Status Build Status Lint with Black Code Coverage

PyPI Version Python Versions License: MIT

shapepy logo

Shape

A python package for bidimensional geometric shapes boolean manipulation

Installation:

This library is available in PyPI. To install it

$ pip install shapepy

For more details, refer to the documentation

Documentation

The documentation can be found at shapepy.readthedocs.io

Contribute

Please use the Issues or refer to the email [email protected]

shapepy's People

Contributors

carlos-adir avatar

Stargazers

 avatar  avatar  avatar

shapepy's Issues

Add support for `shapely` ?

This package is pretty similar to shapely.

An idea of optional configuration would be add support for this library, more specifically to convert shapely.Polygon into a shape

pip install compmec-shape[shapely]

XOR operation of two circles are not correct

The operation XOR between to circles does not give the correct result:

from compmec.shape import Primitive

circle_left = Primitive.circle(radius = 50, center = (-15, 0))
circle_right = Primitive.circle(radius = 50, center = (15, 0))
circle_xor = circle_left ^ circle_right 

Although using this operation we get the correct shape

circle_or = circle_left | circle_right
circle_and = circle_left & circle_right
circle_xor = circle_or - circle_and

The current implementation of __xor__ is theorically correct:

def __xor__(self, other):
    return (self - other) | (other - self)

Import and export of shapes

We can create shapes by operating primitive shapes or by creating simple shapes, but it would be nice to have functions to import and export these shapes from a file

Move boolean operations from `shape` to `bool`

Currently the boolean operation between two shapes is made by FollowPath, which is inside the file shape.py.
The proposition is to move this responsibility to a new file called bool.py.

The main problem is: these functions receives BaseShape entities, Therefore we would have a circular import.
They are used to know if the midpoint of a segment is inside/outside the other shape.

A solution is to create a JordansContainer, like a tuple(tuple(JordanCurve)), that is used as input/output for a boolean operation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.