Visualizing dynamics of 500 translating and rotating spheres - visualization

I have used MATLAB to show the dynamics of two spheres that are translating and rotating in space. Here is the youtube link. https://www.youtube.com/watch?v=uONPJZreQC8&t=82s
I want to extend this to 500 spheres which is extremely slow using MATLAB. I have the position, translational and angular velocity of these spheres for 2000 time steps. Are there any other elegant ways using Paraview or VMD or POVRAY any other softwares ?
Here is an example that I would like to try but don't know how it is made:
http://ryuon.sourceforge.net/stokes/index.html#visualization

Related

Fluid simulation in Matlab

I have a (vertical) cylinder in Matlab, built using the patch command. For every 'level' of the cylinder I have a different radius, so that the 3D plot displays something like this:
Also, I used a sequence of images to simulate the movement of the structure (the radius at every level changes overtime).
What I would like to do now is the simulation of a certain mass of fluid passing through the cylinder. Say, the first image will show the fluid (a sphere?) on top, and the successive ones will show the fluid following the shape of the cylinder.
I tried to solve this problem by simply colouring the facets of the cylinder, but I would need something more "hydraulic-like".
How can I approach this problem? How fluids can be treated/modelled in Matlab environment?
Any suggestion/tip would be appreciated.

Corner Detection in 2D Vector Data

I am trying to detect corners (x/y coordinates) in 2D scatter vectors of data.
The data is from a laser rangefinder and our current platform uses Matlab (though standalone programs/libs are an option, but the Nav/Control code is on Matlab so it must have an interface).
Corner detection is part of a SLAM algorithm and the corners will serve as the landmarks.
I am also looking to achieve something close to 100Hz in terms of speed if possible (I know its Matlab, but my data set is pretty small.)
Sample Data:
[Blue is the raw data, red is what I need to detect. (This view is effectively top down.)]
[Actual vector data from above shots]
Thus far I've tried many different approaches, some more successful than others.
I've never formally studied machine vision of any kind.
My first approach was a homebrew least squares line fitter, that would split lines in half resurivly until they met some r^2 value and then try to merge ones with similar slope/intercepts. It would then calculate the intersections of these lines. It wasn't very good, but did work around 70% of the time with decent accuracy, though it had some bad issues with missing certain features completely.
My current approach uses the clusterdata function to segment my data based on mahalanobis distance, and then does basically the same thing (least squares line fitting / merging). It works ok, but I'm assuming there are better methods.
[Source Code to Current Method] [cnrs, dat, ~, ~] = CornerDetect(data, 4, 1) using the above data will produce the locations I am getting.
I do not need to write this from scratch, it just seemed like most of the higher-class methods are meant for 2D images or 3D point clouds, not 2D scatter data. I've read a lot about Hough transforms and all sorts of data clustering methods (k-Means etc). I also tried a few canned line detectors without much success. I tried to play around with Line Segment Detector but it needs a greyscale image as an input and I figured it would be prohibitivly slow to convert my vector into a full 2D image to feed it into something like LSD.
Any help is greatly appreciated!
I'd approach it as a problem of finding extrema of curvature that are stable at multiple scales - and the split-and-merge method you have tried with lines hints at that.
You could use harris corner detector for detecting corners.

List of point into smooth curve (airfoil shape)

I have a list of 200 points I garnered from a graph digitization software I would like to transform into a smooth curve and then into Solidworks.
My points form an ellipse (airfoil shape to be more precise), so the commands I've tried in Matlab didn't have a circular curve.
My issues are:
* Obtaining a smooth curve that doesn't necessarily pass through all points, smooth being motus operandi.
* Being able to have a elliptical curve
* Somehow being able to export this curve into Solidwords
If anyone knows the right software, command line or anything that could get me started, I would be extremely thankful.
imacube
I've used Solid Works before. It's a very powerful tool. There should be some way to draw a curved spline through these points, such as a cubic spline.
If you are using a standard(ish) airfoil, then you can use a variety of tools to plot the points without having to use a graph digitization software.
Javafoil, for instance, is one of those. Even if you know the characteristics of your airfoil, you can use this to give you a smooth set of points.
Again, if your airfoil is a naca 4-series, then these are governed by a set of equations.
But I take it that the airfoil you want a more complicated one. Let me know if I can help anymore.

Matlab: animation

I want to write a program which shows a visual animation of the orbit of satellite in 3D space, with the Earth's rotation.
I can write a code which shows a visualisation of the orbit (simply comet3()). It is possible to rotate the 3D model of the Earth either.
But I can't merge these two programs.
I've seen some Youtube videos like "Satellite Orbit Analysis and Simulation (in MATLAB)". How has he done it?
Is there any special stackexchange site for Matlab questions?
You can see a demo how to draw the Earth in 3D or 2D here:
Earth's Topography
To rotate an object like surface you can use function ROTATE. For example:
rotate(hsurf, [0 0 1], 20) #% rotates surface with handle hsurf around z axis by 20 deg
In addition have a look at Orbit Determination Toolbox (ODTBX).
And yeh, the best MATLAB SE site is here at SO. Just add or search for matlab tag.
UPDATE: Another beautiful Earth plot at FileExchange: http://www.mathworks.com/matlabcentral/fileexchange/25048
Consider doing the graphical front-end in Java. MATLAB interfaces flawlessly with Java, and it's much easier to do GUI stuff in Java. If you don't know Java and you have time, start learning, it's worth the effort as a general purpose programming language that's everywhere, and it's an invaluable companion to MATLAB.

Kinect (Microsoft Sdk) Skeleton (recorded) Data from pixel to 3d real world coordinates

I have a dataset of partial joints (right elbow, shoulder and wrist) taken from a fellow who acquired this data with OpenNi.
The joints are in pixel as regarding to x and y, while z is in mm. I have to convert them to real world space to match them with data acquired by me (using Microsoft Sdk) for a gesture recognition application. I'm working in Matlab.
Searching on web and papers, I found that a floor reference is necessary for the conversion but I don't have any, so how could this conversion be done, possibly in matlab, and which candidate should I pick ? (maybe height of kinect from the floor?)
Here's a not-so-awesome solution:
Plot the 3D points you have of both data sets
Look for a pose where the arm and the forearm seems to be making a similar pose (as L-shaped as possible).
Use this to compute the transformation.