Skip to content

Instantly share code, notes, and snippets.

@elliotwoods
Created October 17, 2017 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotwoods/2acd612a608dea4fabbae358862a7c21 to your computer and use it in GitHub Desktop.
Save elliotwoods/2acd612a608dea4fabbae358862a7c21 to your computer and use it in GitHub Desktop.
reals = np.float64([
points
])
virtuals = np.float64([
points
])
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