Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
reals = np.float64([
virtuals = np.float64([
def reflect(real, plane):
return virtual
#because this is a test, we synethesise some data
def generateVirtuals():
create a random plane
synthesise the virtuals data using your reflect function and your random plane
add some noise (have a variable for the amount of noise)
def functionToOptimize(parameters):
make plane from parameters
#presume reals and virtuals are same length here
error = 0
for i in range(len(reals)):
thisError = reflect(reals[i], plane) - virtuals[i]
error += thisError ** 2
return np.sqrt(error)
scipy.optimize(functionToOptimize, [0, 0, 0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment