Just Launched: You can now import projects and releases from Google Code onto SourceForge

We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps.

#33 3d plot function for implicit functions

closed
nobody
None
5
2012-09-22
2012-03-28
Martin Helm
No

There is no good support for plotting implicit functions and while
the standard isosurface function can do that it has some drawbacks if
you don't want to use high resolutions and only a coarse grid. Due to
the inherent linear approximation done by the algorithm the intersection
points with the grid which are calculated are sometimes a poor
approximation.
Attached is a first draft for improved implicit function potting:

Attached are the functions and the output from the following test script shows how the precision compares

f = @(x,y,z) x.^2 + y.^2 + z.^2;
[T P] = implicit(f, 3, -2:2, -2:2, -2:2);
trimesh (T, P(:,1), P(:,2), P(:,3));
hold on
plot3(zeros(200,1),sqrt(3)exp(-1ilinspace(0,2pi,200)), "r-")
view(90,0)
axis equal
title "Implicit"
print sphere_exact.png
clf
[xx yy zz] = meshgrid(-2:2, -2:2, -2:2);
v = f(xx,yy,zz);
[T P] = isosurface(xx, yy, zz, v, 3);
trimesh (T, P(:,1), P(:,2), P(:,3));
hold on
plot3(zeros(200,1),sqrt(3)
exp(-1ilinspace(0,2pi,200)), "r-")
view(90,0)
axis equal
title "Isosurface"
print sphere_isosurface.png

Discussion

• Martin Helm
2012-03-28

Helper function for improved shading of 3d surfaces

Attachments

• Martin Helm
2012-03-28

Improved triangulation for functions in implicit form

Attachments

• Carnë Draug
2012-04-17

Hi

sorry for the very late response. I have added both functions to the plot package. Thank you for the contribution

Carnë