interpolate 3D volume with numpy and or scipy

In scipy 0.14 or later, there is a new function scipy.interpolate.RegularGridInterpolator which closely resembles interp3. The MATLAB command Vi = interp3(x,y,z,V,xi,yi,zi) would translate to something like: from numpy import array from scipy.interpolate import RegularGridInterpolator as rgi my_interpolating_function = rgi((x,y,z), V) Vi = my_interpolating_function(array([xi,yi,zi]).T) Here is a full example demonstrating both; it will help you understand … Read more

Using javascript for custom purposes

This shows the two-way interaction between Javascript and c#. Javascript calls a c# method C# gets the result of an expression in Javascript – Type scriptType = Type.GetTypeFromCLSID(Guid.Parse(“0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC”)); dynamic obj = Activator.CreateInstance(scriptType, false); obj.Language = “javascript”; obj.AddObject(“MyClass”,new JSAccessibleClass()); obj.Eval(“MyClass.MsgBox(‘Hello World’)”); //<–1 var result = obj.Eval(“3+5”); //<–2 [ComVisible(true)] public class JSAccessibleClass { public void MsgBox(string s) … Read more

Transformation of 3D objects related to vanishing points and horizon line

This is nowhere near my cup of tea so handle with extreme prejudice and also far form solution just some start point hints… First of all we need to define some constraints/assumptions in order to make this to work. user selects 4 lines representing 2 perpendicular planes and these 2 QUADs have the same height … Read more

How do I rotate a Quaternion with 2nd Quaternion on its local or world axes without using transform.Rotate?

Use the Quaternion operator *. In Unity, when you multiply two quaternions, it applies the second quaternion (expressed in global axes) to the first quaternion along the local axes produced after the first Quaternion). So, if you want to do the equivalent of Rotate(q2, Space.Self), where q1 is the transform’s original rotation, and q3 is … Read more