Inverse Distance Weighted (IDW) Interpolation with Python

changed 20 Oct: this class Invdisttree combines inverse-distance weighting and scipy.spatial.KDTree. Forget the original brute-force answer; this is imho the method of choice for scattered-data interpolation. “”” invdisttree.py: inverse-distance-weighted interpolation using KDTree fast, solid, local “”” from __future__ import division import numpy as np from scipy.spatial import cKDTree as KDTree # http://docs.scipy.org/doc/scipy/reference/spatial.html __date__ = “2010-11-09 … Read more

Android How to draw a smooth line following your finger

An easy solution, as you mentioned, is to simply connect the points with a straight line. Here’s the code to do so: public void onDraw(Canvas canvas) { Path path = new Path(); boolean first = true; for(Point point : points){ if(first){ first = false; path.moveTo(point.x, point.y); } else{ path.lineTo(point.x, point.y); } } canvas.drawPath(path, paint); } … Read more