polyclipNP 0.2__tar.gz → 0.6__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.6/PKG-INFO +7 -0
- polyclipnp-0.6/README.md +45 -0
- polyclipnp-0.6/polyclipNP.egg-info/PKG-INFO +7 -0
- polyclipnp-0.6/polyclipNP.egg-info/SOURCES.txt +9 -0
- polyclipnp-0.6/polyclipNP.egg-info/dependency_links.txt +1 -0
- polyclipnp-0.6/polyclipNP.egg-info/top_level.txt +2 -0
- {polyclipNP-0.2 → polyclipnp-0.6}/polyclipNP.py +7 -40
- {polyclipNP-0.2 → polyclipnp-0.6}/polyclipNP_c_wrap.c +1479 -756
- polyclipnp-0.6/setup.cfg +4 -0
- polyclipnp-0.6/setup.py +21 -0
- polyclipNP-0.2/PKG-INFO +0 -10
- polyclipNP-0.2/setup.py +0 -16
- {polyclipNP-0.2 → polyclipnp-0.6}/polyclipNP_c.c +0 -0
polyclipnp-0.6/PKG-INFO
ADDED
polyclipnp-0.6/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 -m pip install . --no-build-isolation
|
|
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
|
+
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
# This file was automatically generated by SWIG (
|
|
2
|
-
# Version 4.
|
|
1
|
+
# This file was automatically generated by SWIG (https://www.swig.org).
|
|
2
|
+
# Version 4.4.1
|
|
3
3
|
#
|
|
4
|
-
# Do not make changes to this file unless you know what you are doing
|
|
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
|
-
if _swig_python_version_info < (2, 7, 0):
|
|
9
|
-
raise RuntimeError('Python 2.7 or later required')
|
|
10
|
-
|
|
11
8
|
# Import the low-level C/C++ module
|
|
12
|
-
if __package__ or
|
|
9
|
+
if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
|
|
13
10
|
from . import _polyclipNP
|
|
14
11
|
else:
|
|
15
12
|
import _polyclipNP
|
|
@@ -19,35 +16,6 @@ try:
|
|
|
19
16
|
except ImportError:
|
|
20
17
|
import __builtin__
|
|
21
18
|
|
|
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
19
|
def _swig_repr(self):
|
|
52
20
|
try:
|
|
53
21
|
strthis = "proxy of " + self.this.__repr__()
|
|
@@ -58,10 +26,10 @@ def _swig_repr(self):
|
|
|
58
26
|
|
|
59
27
|
def _swig_setattr_nondynamic_instance_variable(set):
|
|
60
28
|
def set_instance_attr(self, name, value):
|
|
61
|
-
if name == "
|
|
62
|
-
self.this.own(value)
|
|
63
|
-
elif name == "this":
|
|
29
|
+
if name == "this":
|
|
64
30
|
set(self, name, value)
|
|
31
|
+
elif name == "thisown":
|
|
32
|
+
self.this.own(value)
|
|
65
33
|
elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
|
|
66
34
|
set(self, name, value)
|
|
67
35
|
else:
|
|
@@ -94,4 +62,3 @@ class _SwigNonDynamicMeta(type):
|
|
|
94
62
|
def polyclip_multi4(len_l, len_r, len_b, len_t, len_px, len_py, n_poly, len_poly_inds, len_x, len_y, len_nclip_poly, len_areas, len_index):
|
|
95
63
|
return _polyclipNP.polyclip_multi4(len_l, len_r, len_b, len_t, len_px, len_py, n_poly, len_poly_inds, len_x, len_y, len_nclip_poly, len_areas, len_index)
|
|
96
64
|
|
|
97
|
-
|