Skip to content

Instantly share code, notes, and snippets.

View mikedh's full-sized avatar

Michael Dawson-Haggerty mikedh

View GitHub Profile
@mikedh
mikedh / rtree_stream_check
Created July 18, 2015 19:26
rtree stream issue
import numpy as np
import rtree
import time
def random_tree_stream(points_count, include_object):
properties = rtree.index.Property()
properties.dimension = 3
points_random = np.random.random((points_count,3,3))
points_bounds = np.column_stack((points_random.min(axis=1),
@mikedh
mikedh / bump.py
Created January 28, 2018 19:18
quick script to do version bumps
import sys
import numpy as np
file_name = 'trimesh/version.py'
if __name__ == '__main__':
with open(file_name, 'r') as f:
text = f.read()
split = text.split("'")
import trimesh
import numpy as np
from scipy.spatial import Voronoi
if __name__ == '__main__':
points = np.random.random((20,3))
v = Voronoi(points)
"""
bricks.py
-------------
Fun with meshes of bricks.
"""
import trimesh
import numpy as np
import os
import trimesh
class FileSystemResolver(object):
def __init__(self, source):
"""
Resolve files based on a source path.
"""
import numpy as np
import trimesh
import timeit
import time
from collections import deque
import matplotlib.pyplot as plt
from scipy.spatial import cKDTree as KDTree
@mikedh
mikedh / arg.json
Created January 16, 2019 21:56
triangles error
{"vertices": [[11.0, 0.0], [10.995184726672196, -0.0980171403295605], [10.98078528040323, -0.19509032201612808], [10.95694033573221, -0.2902846772544621], [10.923879532511286, -0.3826834323650894], [10.881921264348355, -0.4713967368259972], [10.831469612302545, -0.5555702330196017], [10.773010453362737, -0.6343932841636449], [10.707106781186548, -0.7071067811865469], [10.634393284163647, -0.7730104533627363], [10.555570233019603, -0.8314696123025447], [10.471396736825998, -0.8819212643483545], [10.382683432365091, -0.9238795325112863], [10.290284677254464, -0.9569403357322085], [10.19509032201613, -0.9807852804032302], [10.098017140329562, -0.9951847266721967], [10.000000000000002, -1.0], [9.901982859670442, -0.995184726672197], [9.804909677983874, -0.9807852804032308], [9.70971532274554, -0.9569403357322094], [9.617316567634912, -0.9238795325112875], [9.528603263174004, -0.881921264348356], [9.444429766980399, -0.8314696123025463], [9.365606715836357, -0.7730104533627382], [9.292893218813454, -0.707106781186
import os
import trimesh
import numpy as np
tol_norm = 1e-4
def test_align(align):
"""
import os
import time
import trimesh
import numpy as np
tol_norm = 1e-4
def test_align(align):
@mikedh
mikedh / headless.py
Created December 15, 2017 19:20
Manual pyglet event loop headless rendering
import pyglet
import pyglet.gl as gl
import numpy as np
import os
import tempfile
import subprocess
import collections