kopia lustrzana https://github.com/vilemduha/blendercam
made more code use numpy
rodzic
631e667c99
commit
b925de1b3d
|
@ -138,7 +138,7 @@ def useBridges(ch, o):
|
|||
|
||||
vi = 0
|
||||
newpoints = []
|
||||
ch_points=ch.get_points()
|
||||
ch_points=ch.get_points_np()
|
||||
p1 = sgeometry.Point(ch_points[0])
|
||||
startinside = o.bridgespoly.contains(p1)
|
||||
interrupted = False
|
||||
|
|
|
@ -125,6 +125,9 @@ class camPathChunk:
|
|||
def get_points(self):
|
||||
return self._points.tolist()
|
||||
|
||||
def get_points_np(self):
|
||||
return self._points
|
||||
|
||||
def set_points(self,points):
|
||||
self._points=np.array(points)
|
||||
|
||||
|
@ -670,7 +673,7 @@ def setChunksZ(chunks, z):
|
|||
|
||||
# don't make this @jit parallel, because it sometimes gets called with small N
|
||||
# and the overhead of threading is too much.
|
||||
@jit(nopython=True,fastmath=True)
|
||||
@jit(nopython=True,fastmath=True,cache=True)
|
||||
def _optimize_internal(points,keep_points,e,protect_vertical,protect_vertical_limit):
|
||||
# inlined so that numba can optimize it nicely
|
||||
def _mag_sq(v1):
|
||||
|
|
|
@ -82,7 +82,7 @@ async def ocl_sample(operation, chunks,use_cached_mesh = False):
|
|||
bdc.setCutter(cutter)
|
||||
|
||||
for chunk in chunks:
|
||||
for coord in chunk.get_points():
|
||||
for coord in chunk.get_points_np():
|
||||
bdc.appendPoint(ocl.CLPoint(coord[0] * 1000, coord[1] * 1000, op_minz * 1000))
|
||||
await progress_async("OpenCAMLib sampling")
|
||||
bdc.run()
|
||||
|
|
|
@ -362,8 +362,8 @@ def getBoundsMultiple(operations):
|
|||
|
||||
|
||||
def samplePathLow(o, ch1, ch2, dosample):
|
||||
v1 = Vector(ch1.get_points()[-1])
|
||||
v2 = Vector(ch2.get_points()[0])
|
||||
v1 = Vector(ch1.get_point(-1))
|
||||
v2 = Vector(ch2.get_point(0))
|
||||
|
||||
v = v2 - v1
|
||||
d = v.length
|
||||
|
@ -1046,8 +1046,8 @@ async def connectChunksLow(chunks, o):
|
|||
chunks_to_resample.append(
|
||||
(connectedchunks[-1], connectedchunks[-1].count(), between.count()))
|
||||
|
||||
connectedchunks[-1].extend(between.get_points())
|
||||
connectedchunks[-1].extend(ch.get_points())
|
||||
connectedchunks[-1].extend(between.get_points_np())
|
||||
connectedchunks[-1].extend(ch.get_points_np())
|
||||
else:
|
||||
connectedchunks.append(ch)
|
||||
lastch = ch
|
||||
|
|
Ładowanie…
Reference in New Issue