polyclipNP 0.2__tar.gz → 0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- polyclipnp-0.3/PKG-INFO +5 -0
- polyclipnp-0.3/README.md +45 -0
- polyclipnp-0.3/polyclipNP.egg-info/PKG-INFO +5 -0
- polyclipnp-0.3/polyclipNP.egg-info/SOURCES.txt +7 -0
- polyclipnp-0.3/polyclipNP.egg-info/dependency_links.txt +1 -0
- polyclipnp-0.3/polyclipNP.egg-info/top_level.txt +1 -0
- {polyclipNP-0.2 → polyclipnp-0.3}/polyclipNP.py +3 -32
- polyclipnp-0.3/setup.cfg +4 -0
- {polyclipNP-0.2 → polyclipnp-0.3}/setup.py +4 -4
- polyclipNP-0.2/PKG-INFO +0 -10
- polyclipNP-0.2/polyclipNP_c.c +0 -662
- polyclipNP-0.2/polyclipNP_c_wrap.c +0 -4334
polyclipnp-0.3/PKG-INFO
ADDED
polyclipnp-0.3/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# polyclip
|
|
2
|
+
|
|
3
|
+
This is a small SWIG wrapper around the function polyclip_multi4() of J.D. Smith polyclip C code.
|
|
4
|
+
|
|
5
|
+
# Installing: #
|
|
6
|
+
```
|
|
7
|
+
pip install polyclipNP
|
|
8
|
+
```
|
|
9
|
+
or clone github depo and
|
|
10
|
+
```
|
|
11
|
+
python setup.py install
|
|
12
|
+
```
|
|
13
|
+
# Sample Usage: #
|
|
14
|
+
```
|
|
15
|
+
import numpy as np
|
|
16
|
+
import polyclipNP
|
|
17
|
+
|
|
18
|
+
# Input polygon indices
|
|
19
|
+
px=np.array([[3.4,3.4,4.5,4.5],[3.5,3.5,5.5,5.5]]).astype(np.float32)
|
|
20
|
+
py=np.array([[1.4,2.0,2.0,1.4],[3.5,4.3,4.3,3.5]]).astype(np.float32)
|
|
21
|
+
|
|
22
|
+
# polygon indices in px and py
|
|
23
|
+
polyinds=np.array((0,4,8)).astype(np.int32)
|
|
24
|
+
|
|
25
|
+
# Bound-box to consider
|
|
26
|
+
l=np.floor(px.min(axis=1)-1).astype(np.int32)
|
|
27
|
+
r=np.floor(px.max(axis=1)+1).astype(np.int32)
|
|
28
|
+
b=np.floor(py.min(axis=1)-1).astype(np.int32)
|
|
29
|
+
t=np.floor(py.max(axis=1)+1).astype(np.int32)
|
|
30
|
+
|
|
31
|
+
n = len(l)
|
|
32
|
+
npx = len(px)
|
|
33
|
+
npol = len(polyinds)
|
|
34
|
+
|
|
35
|
+
nx = 10
|
|
36
|
+
|
|
37
|
+
index = np.zeros(nx,np.int32)
|
|
38
|
+
nclip_poly = np.zeros(nx,np.int32)
|
|
39
|
+
x = np.zeros(nx,np.int32) # Output pixel x coordinates
|
|
40
|
+
y = np.zeros(nx,np.int32) # Output pixel y coordinates
|
|
41
|
+
areas = np.zeros(nx,np.float32) # Output areas
|
|
42
|
+
|
|
43
|
+
polyclipNP.polyclip_multi4(l,r,b,t, np.ravel(px), np.ravel(py) , npol-1, polyinds, x, y, nclip_poly, areas, index)
|
|
44
|
+
|
|
45
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
polyclipNP
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# This file was automatically generated by SWIG (http://www.swig.org).
|
|
2
|
-
# Version 4.0.
|
|
2
|
+
# Version 4.0.2
|
|
3
3
|
#
|
|
4
4
|
# Do not make changes to this file unless you know what you are doing--modify
|
|
5
5
|
# the SWIG interface file instead.
|
|
6
6
|
|
|
7
7
|
from sys import version_info as _swig_python_version_info
|
|
8
8
|
if _swig_python_version_info < (2, 7, 0):
|
|
9
|
-
raise RuntimeError(
|
|
9
|
+
raise RuntimeError("Python 2.7 or later required")
|
|
10
10
|
|
|
11
11
|
# Import the low-level C/C++ module
|
|
12
|
-
if __package__ or
|
|
12
|
+
if __package__ or "." in __name__:
|
|
13
13
|
from . import _polyclipNP
|
|
14
14
|
else:
|
|
15
15
|
import _polyclipNP
|
|
@@ -19,35 +19,6 @@ try:
|
|
|
19
19
|
except ImportError:
|
|
20
20
|
import __builtin__
|
|
21
21
|
|
|
22
|
-
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
|
|
23
|
-
if name == "thisown":
|
|
24
|
-
return self.this.own(value)
|
|
25
|
-
if name == "this":
|
|
26
|
-
if type(value).__name__ == 'SwigPyObject':
|
|
27
|
-
self.__dict__[name] = value
|
|
28
|
-
return
|
|
29
|
-
method = class_type.__swig_setmethods__.get(name, None)
|
|
30
|
-
if method:
|
|
31
|
-
return method(self, value)
|
|
32
|
-
if not static:
|
|
33
|
-
object.__setattr__(self, name, value)
|
|
34
|
-
else:
|
|
35
|
-
raise AttributeError("You cannot add attributes to %s" % self)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def _swig_setattr(self, class_type, name, value):
|
|
39
|
-
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def _swig_getattr(self, class_type, name):
|
|
43
|
-
if name == "thisown":
|
|
44
|
-
return self.this.own()
|
|
45
|
-
method = class_type.__swig_getmethods__.get(name, None)
|
|
46
|
-
if method:
|
|
47
|
-
return method(self)
|
|
48
|
-
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
|
|
49
|
-
|
|
50
|
-
|
|
51
22
|
def _swig_repr(self):
|
|
52
23
|
try:
|
|
53
24
|
strthis = "proxy of " + self.this.__repr__()
|
polyclipnp-0.3/setup.cfg
ADDED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"""
|
|
3
3
|
setup.py file """
|
|
4
4
|
from distutils.core import setup, Extension
|
|
5
|
-
import numpy as np
|
|
5
|
+
#import numpy as np
|
|
6
6
|
|
|
7
7
|
example_module = Extension('_polyclipNP',
|
|
8
8
|
sources=['polyclipNP_c_wrap.c', 'polyclipNP_c.c'],
|
|
9
9
|
)
|
|
10
|
-
setup (name = 'polyclipNP', version = '0.
|
|
10
|
+
setup (name = 'polyclipNP', version = '0.3',
|
|
11
11
|
author = "N. Pirzkal",
|
|
12
12
|
description = """Swig wrapper of polyclip.c from J.D. Smith""",
|
|
13
|
-
include_dirs = [np.get_include()],
|
|
14
|
-
ext_modules = [example_module],
|
|
13
|
+
# include_dirs = [np.get_include()],
|
|
14
|
+
# ext_modules = [example_module],
|
|
15
15
|
py_modules = ["polyclipNP"],
|
|
16
16
|
)
|
polyclipNP-0.2/PKG-INFO
DELETED