Papervision3D: Graphics3D Using Delaunay Triangulation

Posted by on December 30, 2008


[View Source Code]

Delaunay triangulation breaks a shape consisting of a set of points into triangles. We can then use those triangles to create a mesh in Papervision3D.

Hole detection is implemented by creating polygons that define each set of edges. Each triangle’s mid point is then check to see if it falls inside or outside of a shape. If it is in a shape, we also check that it is not in a hole represented by a sub polygon.

    Graphics3D currently supports:

  • beginFill
  • moveTo
  • lineTo
  • curveTo
  • drawRect
  • endFill

The curveTo command breaks up the curve into a number of line segments defined by Graphics3D.linesPerCurve.

Example code for drawing the two blue bars above:

1
2
3
4
5
6
7
8
9
var blueColor:FlatShadeMaterial = new FlatShadeMaterial(light, 0x0000ff);
blueColor.doubleSided = true;
 
var textHolder:Surface3D = new Surface3D();
 
textHolder.graphics3D.beginFill(blueColor);
textHolder.graphics3D.drawRect(0,35, 0, len, 4);			
textHolder.graphics3D.drawRect(0,25, 0, len, 4);			
textHolder.graphics3D.endFill();

This is most definitely a work in progress. Hole detection, when it works, is slow. Triangles outside of the draw area are not always caught. Sometimes it just doesn’t work.

3 Comments on Papervision3D: Graphics3D Using Delaunay Triangulation

Respond | Trackback

  1. Amazing work! Can’t wait to see what else you come up with.

  2. Wow! That is very cool. Keep it up!

  3. [...] have been exploring this subject as well, you can find their experiments here and here and [...]

Respond

Comments

Comments: