Code Monkey home page Code Monkey logo

py-linepath's Introduction

Python linepath geometry

Python library of linepath geometry. The addition for https://github.com/hirve/py-functional-mill to limit cut area by a shape, where the shape is a path from lines.

Features

  • Creating an enclosed shape from path of lines (polyline).

    from geometry import EnclosedShape
    SRC_PATH = [ [ -20, -10 ], [ -10, 55 ], [ 70, 55 ], [ 75, -25 ] ]
    shape = EnclosedShape(SRC_PATH);
  • Taking bounding box of the shape.

    box = shape.getBoundingBox()
    print(box)
    # ({'min': -20, 'max': 75}, {'min': -25, 'max': 55})
  • Moving, scaling, rotation of the shape.

    shape.scaleTo([ 50, 40 ], [ 190, 40 ])
    shape.scaleBy([ 50, 40 ], [ 1.5, 2 ])
    shape.moveTo([ 50, 40 ], [ 150, -20 ])
    shape.rotate([ 50, 40 ], -math.pi / 12)
    
    # Builder style
    shape.reset().moveTo([ 50, 40 ], [ 150, -20 ]).rotate([ 50, 40 ], -math.pi / 12)
  • Testing if the point is inside the shape.

    shape.isInside([ 15, 25 ])
  • Testing if the point is closer to shape edge than R value.

    shape.isCloserThan([ -5, 35 ], 5)

py-linepath's People

Contributors

hirve avatar

Watchers

 avatar

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.