Convert spline to mesh help required.

Blitz3D Forums/Blitz3D Programming/Convert spline to mesh help required.

CyberHeater(Posted 2004) [#1]
I'm trying to program a track editor and have got a nice editor going that can define anchor points which define the shape of a bezier spline thingy which forms a continuous loop for a race track.

So. I have generated a array or x,y and z coords derived from my spline shape.

What is the best way to turn them into a mesh. I've tried a few things but have got myself into a right pickle and can't quit figure it out.

Please help. Code snippets would be very helpful. Thanks.


fredborg(Posted 2004) [#2]
If you just want a flat track it's very simple:

Pseudo codeish thingie:
Create an empty mesh
For every anchor point
  Position a dummy pivot and align it to the anchor point
  TFormPoint -1,0,0,dummy pivot,0
  Add a vertex at TformedX,Y,Z
  TFormPoint 1,0,0,dummy pivot,0
  Add a vertex at TformedX,Y,Z
  If anchor point>first
    add triangles between previous anchor point vertices
       and this anchor points vertices
  else if anchor point = last
    add triangles between the first anchor point vertices
       and this anchor points vertices  
  end if 
Next anchor point
That's it :)


CyberHeater(Posted 2004) [#3]
Thanks Fredborg. I'll let you know how I get on.


Picklesworth(Posted 2004) [#4]
speakin gof splines - does anyone know how to extrude a spline into a full 3d object?