[examples] some cleanup
This commit is contained in:
parent
43ccd8de2f
commit
395244ee83
2 changed files with 5 additions and 7 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
import numpy
|
|
||||||
from pyclipper import (
|
from pyclipper import (
|
||||||
Pyclipper, PT_CLIP, PT_SUBJECT, CT_UNION, CT_INTERSECTION, PFT_NONZERO,
|
Pyclipper, PT_SUBJECT, CT_UNION, PFT_NONZERO,
|
||||||
scale_to_clipper, scale_from_clipper,
|
|
||||||
)
|
)
|
||||||
p = Pyclipper()
|
p = Pyclipper()
|
||||||
p.AddPaths([
|
p.AddPaths([
|
||||||
|
|
@ -12,8 +10,8 @@ p.AddPaths([
|
||||||
], PT_SUBJECT, closed=True)
|
], PT_SUBJECT, closed=True)
|
||||||
#p.Execute2?
|
#p.Execute2?
|
||||||
#p.Execute?
|
#p.Execute?
|
||||||
p.Execute(PT_UNION, PT_NONZERO, PT_NONZERO)
|
p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO)
|
||||||
p.Execute(CT_UNION, PT_NONZERO, PT_NONZERO)
|
p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO)
|
||||||
p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO)
|
p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO)
|
||||||
|
|
||||||
p = Pyclipper()
|
p = Pyclipper()
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ def triangular_lattice(
|
||||||
elif origin == 'corner':
|
elif origin == 'corner':
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise Exception(f'Invalid value for `origin`: {origin}')
|
raise ValueError(f'Invalid value for `origin`: {origin}')
|
||||||
|
|
||||||
return xy[xy[:, 0].argsort(), :]
|
return xy[xy[:, 0].argsort(), :]
|
||||||
|
|
||||||
|
|
@ -197,7 +197,7 @@ def ln_defect(
|
||||||
`[[x0, y0], [x1, y1], ...]` for all the holes
|
`[[x0, y0], [x1, y1], ...]` for all the holes
|
||||||
"""
|
"""
|
||||||
if defect_length % 2 != 1:
|
if defect_length % 2 != 1:
|
||||||
raise Exception('defect_length must be odd!')
|
raise ValueError('defect_length must be odd!')
|
||||||
pp = triangular_lattice([2 * dd + 1 for dd in mirror_dims])
|
pp = triangular_lattice([2 * dd + 1 for dd in mirror_dims])
|
||||||
half_length = numpy.floor(defect_length / 2)
|
half_length = numpy.floor(defect_length / 2)
|
||||||
hole_nums = numpy.arange(-half_length, half_length + 1)
|
hole_nums = numpy.arange(-half_length, half_length + 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue