See what's going on with flipcode!




This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  Surface Subdivision Code
  Submitted by



Here is a little library to do surface subdivision! It uses a simple scheme for surface subdivision: linear subdivision plus triangle averaging. Despite it's long name it is a simple process. Unfortunately it doesn't provide as nice subdivision as more advanced algorithms (ie: Catmull-Clark), but feel free to modify the code if you really want to.. this algorithm is an approximating, uniform, triangular scheme. Thus it moves the original points on the mesh, treats each point the same as all other points, and works on a triangular mesh. The library was meant to be simple to use (thus it's not fully optimized) and quite general. Simply pass in triangles to the SS_Surface and it will reconstruct the mesh (ie: connectedness between triangles). Then call SS_Surface::Subdivide() and presto-chango! You have a subdivided object. There's a little sample program included as well. This code is free for any use, however I'd be interested to know if anyone uses it, so email me and let me know!

Download Associated File: ss.tar.gz (6,625 bytes)

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.