# [Numpy-discussion] OT: A Way to Approximate and Compress a 3D Surface

Geoffrey Zhu zyzhu2000 at gmail.com
Fri Nov 23 11:19:47 EST 2007

```Hi Bob, Anne, and everyone,

On Nov 21, 2007 1:41 PM, Bob Lewis <bobl at tricity.wsu.edu> wrote:
> On 11/20/07, Anne Archibald posted:
>
> > Subject:
> > Re: [Numpy-discussion] OT: A Way to Approximate and Compress a 3D Surface
> > From:
> > "Anne Archibald" <peridot.faceted at gmail.com>
> > Date:
> > Tue, 20 Nov 2007 17:13:31 -0500
> > To:
> > "Discussion of Numerical Python" <numpy-discussion at scipy.org>
> >
> > To:
> > "Discussion of Numerical Python" <numpy-discussion at scipy.org>
> >
> >
> > On 20/11/2007, Geoffrey Zhu <zyzhu2000 at gmail.com> wrote:
> >
> >> I have N tabulated data points { (x_i, y_i, z_i) } that describes a 3D
> >> surface. The surface is pretty "smooth." However, the number of data
> >> points is too large to be stored and manipulated efficiently. To make
> >> it easier to deal with, I am looking for an easy method to compress
> >> and approximate the data. Maybe the approximation can be described by
> >> far fewer number of coefficients.
> >>
> >> If you can give me some hints about possible numpy or non-numpy
> >> solutions or let me know where is better to ask this kind of question,
> >> I would really appreciate it.
> >
> > This is an important task in computer graphics, in particular, in the
> > field of multiresolution modelling. If you look up "surface
> > simplification" you'll find many references to articles. I don't know
> > of a library offhand that does it, let alone one that is accessible
> > from python, but you could try looking at a toolkit that does
> > isosurface visualization - these are surfaces that can often be
> > simplified enormously. In particular it looks like VTK might be able
> > to do what you want.
>
> Anne Archibald is correct that surface simplification may ultimately
> be of great help.  Other place to look besides VTK are GTS, the GNU
> Triangulated Surface library, and CGAL, the Computational Geometry
> Algorithms Library, which has a Python binding.
>
> It occurs to me, though, that we should first verify that you do
> indeed have a surface in the first place.  All you tell us is that you
> have a set of N points in 3-space.  Are they connected?  That is, does
> each point have well-defined neighbors?  If so, do these vertices and
> connections form a mesh that defines a surface?
>
>        - Bob Lewis
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

First I'd like to thank everyone for helping me on this.  It does look
like surface simplification will greatly help my problem.

Yes, I indeed have a surface and the points are connected. In fact, I
have a function z=f(x,y). Except at certain points, it is continuous
and smooth. It is very computationally intensive to calculate f(x,y),
so I have to calculate certain points {(x_i,y_i_,z_i)} and store the
data in a database. However, I have thousands of such functions and
therefore a lot of points to deal with and that makes manipulating and
storing them difficult and slow.

One thing about triangulation I haven't figured out is how to add
multiple such functions together. So if I have a set of triangles that
represent f1(x,y) and another set of triangles that represent f2(x,y),
is there any quick way to get f1(x,y)+f2(x,y) from the triangulation
results of the parts?

Thanks again for all your help,
Geoffrey

```