## 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

## forwarding (drawing) line in 3d grid

Consider using of Woo and Amanatides grid traversal algorithm: article “Fast Voxel Traversal Algorithm…” Practical implementation is in grid traversal section here 2d-case illustration:

## 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

Categories c#

## Wrap an image around a cylindrical object in HTML5 / JavaScript

Simple cylinder wrap with Canvas 2D Very simple example using sin and cos to create the curved map. The images is cut into strips approx 1 pixel wide then rendered as half a squashed circle. As perspective is a linear effect related to distance I also add a small amount of perspective by scaling up … Read more

## Plotting a point on the edge of a sphere

Your position in 3d is given by two angles (+ radius, which in your case is constant) x = r * cos(s) * sin(t) y = r * sin(s) * sin(t) z = r * cos(t) here, s is the angle around the z-axis, and t is the height angle, measured ‘down’ from the z-axis. … Read more

## How can I connect scatter points in a 3D space?

I recommend to not use Matplotlib for 3d plotting at all. You will hit a wall sooner or later. Even though there are cool looking plots around, it does not work well especially if you want to visualize scatter plots with many data points. And it will fail for sure if you want to plot … Read more

## How to create custom 3d model in JavaFX 8?

nothing appeared in the scene Your sample mesh rendered OK for me. Perhaps you didn’t have your camera setup correctly or have your mesh scaled so that it was visible. Your sample mesh doesn’t do much, it is one triangle facing towards the camera and a second triangle facing away from the camera. And is … Read more