Skip to content

Instantly share code, notes, and snippets.

import triangle
import numpy
import matplotlib.pyplot as plt
# monkey-patch triangle library to enable -A option (see what happens
# if do_patch is false)
do_patch = True
if do_patch:
from __future__ import print_function # still using Python 2.7
import sympy
print(sympy.__version__) # displays 1.1.1
# create some symbols for angles
p, q, r = sympy.symbols('p, q, r', real=True)
# create some symbols for unknown elements of lQ
x1, y1, z1 = sympy.symbols('x1, y1, z1')
# Matt Zucker - April 2018
# Showing something went wrong with my proof sketch at
# https://mzucker.github.io/pdfs/disc_vs_sphere.pdf
import numpy as np
import matplotlib.pyplot as plt
def rejection_sample(n, dim):
pts = np.random.random((n, dim))*2-1
import cv2
import numpy as np
######################################################################
def mouse_input(window):
'''Return an x, y location from a click in a window using cv2.'''
# mouse callback to collect input
import cv2
import numpy
# generate a test image with odd dimensions
h = 47
w = 63
img = numpy.random.randint(0, 256, size=(h, w, 3)).astype('uint8')
print 'img has shape', img.shape
# scale it down