Giter Club home page Giter Club logo

wapy's Introduction

WApy(Weiler-Atherton clipping algorithm in python)

This rep is python implementation of Weiler-Atherton clipping algorithm.

Reference:https://www.cnblogs.com/lsxqw2004/p/4843417.html

Reference rep:https://github.com/lsxqw2004/blog_sample_codes

How to use?

Just copy the python file into the path of your project and import:

from PolygonCut import *

The two Polygons you input should be like this:

#"x y x y ... x y" in clockwise by Default, otherwise transform to clockwise
S = "161 137 429 376 558 192 619 418 281 431"
C = "183 391 224 240 610 107 657 361 429 376"

Then get the clipped Polygons:

result = PolyClipping(S, C)			# True by default
#result = PolyClipping(S, C, False) # if you want anticlockwise output

The format of result should be like this:

#"x y x y ... x y" in clockwise by Default
["261.867222 226.952486 429.000000 376.000000 262.690141 386.140845 215.627162 270.836548 224.000000 240.000000",
"429.000000 376.000000 558.000000 192.000000 604.546479 364.450890"]

Moreover: The coordinate frame is:

------------------------------------>x+
|
|
|
|
|
|
|
|
|
v
y+

wapy's People

Contributors

zhanglz95 avatar angelmusonda 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.