Save loading step in trimesh

This commit is contained in:
Chris Hodapp 2019-10-12 20:26:40 +02:00
parent ac022b3b9b
commit 2f83efdb39
4 changed files with 76 additions and 28 deletions

View File

@ -7,6 +7,10 @@
have in my notes, then this still lets me split any way I want have in my notes, then this still lets me split any way I want
to without having to worry about joining N boundaries instead to without having to worry about joining N boundaries instead
of 2, doesn't it? of 2, doesn't it?
- Note that for this to work right, either gen2mesh has to be
called separately on every straight portion, or I have to
make a version of gen2mesh that can handle something more
like trees of boundaries, not just flat lists.
- More complicated: Examples of *merging*. I'm not sure on the theory - More complicated: Examples of *merging*. I'm not sure on the theory
behind this. behind this.

File diff suppressed because one or more lines are too long

View File

@ -95,6 +95,23 @@ def ram_horn2():
mesh = meshutil.FaceVertexMesh.concat_many(meshes) mesh = meshutil.FaceVertexMesh.concat_many(meshes)
return mesh return mesh
def branch_test():
b0 = numpy.array([
[0, 0, 0],
[1, 0, 0],
[1, 1, 0],
[0, 1, 0],
], dtype=numpy.float64) - [0.5, 0.5, 0]
parts = [meshutil.Transform().scale(0.5).translate(dx, dy, 1)
for dx in (-0.25,+0.25) for dy in (-0.25,+0.25)]
xf = meshutil.Transform().translate(0,0,0.1).scale(0.95)
def gen():
b = b0
for i in range(10):
b = xf.apply_to(b)
yield [b]
return meshgen.gen2mesh(gen(), close_first=True, close_last=True)
# Interlocking twists. # Interlocking twists.
# ang/dz control resolution. dx0 controls radius. count controls # ang/dz control resolution. dx0 controls radius. count controls
# how many twists. scale controls speed they shrink at. # how many twists. scale controls speed they shrink at.

View File

@ -66,7 +66,7 @@ def gen_torus_xy(gen, rad=2, frames=100):
def gen2mesh(gen, count=0, flip_order=False, loop=False, def gen2mesh(gen, count=0, flip_order=False, loop=False,
close_first = False, close_first = False,
close_last = False, close_last = False,
join_fn=meshutil.join_boundary_optim): join_fn=meshutil.join_boundary_simple):
# Get first list of boundaries: # Get first list of boundaries:
bs_first = next(gen) bs_first = next(gen)
bs_last = bs_first bs_last = bs_first