I am trying to write a wavefront .OBJ file that contains 3D NURBS curves (not surfaces). I found the following link that describes how to correctly format curves and surfaces within .OBJ files: http://www.martinreddy.net/gfx/3d/OBJ.spec
There is no example for a rational b-spline curve, and it's not clear to me from the documentation how the knot vector is formatted within the parm u
section. Any help would be appreciated.
Examples of related code follow. At the link above, there is a description of a rational b-spline surface:
v -1.3 -1.0 0.0
v 0.1 -1.0 0.4 7.6
v 1.4 -1.0 0.0 2.3
v -1.4 0.0 0.2
v 0.1 0.0 0.9 0.5
v 1.3 0.0 0.4 1.5
v -1.4 1.0 0.0 2.3
v 0.1 1.0 0.3 6.1
v 1.1 1.0 0.0 3.3
vt 0.0 0.0
vt 0.5 0.0
vt 1.0 0.0
vt 0.0 0.5
vt 0.5 0.5
vt 1.0 0.5
vt 0.0 1.0
vt 0.5 1.0
vt 1.0 1.0
cstype rat bspline
deg 2 2
surf 0.0 1.0 0.0 1.0 1/1 2/2 3/3 4/4 5/5 6/6 \
7/7 8/8 9/9
parm u 0.0 0.0 0.0 1.0 1.0 1.0
parm v 0.0 0.0 0.0 1.0 1.0 1.0
end
and another example for a bezier curve:
v -2.300000 1.950000 0.000000
v -2.200000 0.790000 0.000000
v -2.340000 -1.510000 0.000000
v -1.530000 -1.490000 0.000000
v -0.720000 -1.470000 0.000000
v -0.780000 0.230000 0.000000
v 0.070000 0.250000 0.000000
v 0.920000 0.270000 0.000000
v 0.800000 -1.610000 0.000000
v 1.620000 -1.590000 0.000000
v 2.440000 -1.570000 0.000000
v 2.690000 0.670000 0.000000
v 2.900000 1.980000 0.000000
# 13 vertices
cstype bezier
ctech cparm 1.000000
deg 3
curv 0.000000 4.000000 1 2 3 4 5 6 7 8 9 10 \
11 12 13
parm u 0.000000 1.000000 2.000000 3.000000 \
4.000000
end
# 1 element