File Exchange

image thumbnail

SpringLab

version 1.0.0.0 (135 KB) by Ofek Shilon
Interactive RT simulation of elastic bodies

3 Downloads

Updated 24 Aug 2006

No License

Editor's Note: This file was a File Exchange Pick of the Week

This program is a prototype of an interactive elastic model. It makes use of both spring and FEM forces, and several of the elasticity parameters can be modified in run-time (key bindings are displayed in the figure).
To use, left click and drag any point on any face of the model. When the mouse is released, new constraints can be added in the same way. To release such a constraint, right click on its face.

Play around with the parameters - the simulation (although using implicit time integration) can become unstable at certain parameters setup.

The model input format is a VOL file, the (ascii) simple output format of the freeware NetGen. Few sample models are included.

Usage:

SpringLab('sphere')
SpringLab('tissue_cut2')
SpringLab('stomach')
SpringLab('y')

REQUIRES ADDITIONAL FILES:
select3d by Joe Conti, and cameratoolbarnokeys by me.

Cite As

Ofek Shilon (2021). SpringLab (https://www.mathworks.com/matlabcentral/fileexchange/11305-springlab), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Bryce Henson

It seems that this project needs multiple updates to make it compatible with recent matab versions.
As a first step update to the select3d included in brainstorm-tools which in turn requires rendertransform (in the same directory)
https://github.com/brainstorm-tools/brainstorm3/tree/5475f209165e2d5c934213a94ef18c60cf5fb5f6/external/other

Abdullah Al-Azzawi

Hi,
looks like it has a compatibility issues with Matlab version (I'm using R2017b), I'm getting these errors:

SpringLab('Tissue_cut2')
Out of memory. The likely cause is an infinite recursion within the program.

Error in cameratoolbarnokeys>currenthandles (line 1493)
if ~isempty(gcbf)

Error using matlab.graphics.axis.Axes/get
There is no x_RenderTransform property on the Axes class.

Error in select3d>local_Data2PixelTransform (line 329)
xform = get(ax,'x_RenderTransform');

Error in select3d (line 176)
xvert = local_Data2PixelTransform(ax,vert)';

Error in SpringLab/MouseDown (line 254)
[P Vdump VIdump Face FaceInd] =select3d(gco);

Error while evaluating Figure WindowButtonDownFcn.

Any solution please?

Syed Afaq Shah

Hi,

In my case, I got this error:

Out of memory. The likely cause is an infinite recursion within the program.

Error in
cameratoolbarnokeys>currenthandles
(line 1493)
if ~isempty(gcbf)

Any advice will be appreciated.

Patrick

Anton Semechko

Incredible! Many thanks for posting this!

Tim Davis

Very nice simulation, but I have a suggestion for improvment. There are some suspicious numerical techniques used here. See line 417 of Springlab.m, for example. You should never multiply by the inverse of a matrix. Using inv that way is inaccurate and very slow (althought it appears you're doing it only for matrices of modest size, so speed is not an issue). Anyway, "multiplying by the inverse" is what slash and backslash are for (they do not explicitly compute the inverse). This might be the source of instability that you've observed.

ForceCoeffMat=1/(dt*dt) *inv((U*W)*(Minv*U'));

Jesse Parker

Wow, this is really cool! Way more advanced than what I'm trying to do, but fun to play with.

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!