Closed sczerwinski closed 1 year ago
Source: http://paulbourke.net/dataformats/obj/
The following syntax statements are listed in order of use.
cstype rat type
Free-form geometry statement.
Specifies the type of curve or surface and indicates a rational or
non-rational form.
rat is an optional argument.
rat specifies a rational form for the curve or surface type. If rat
is not included, the curve or surface is non-rational
type specifies the curve or surface type. Allowed types are:
bmatrix basis matrix
bezier Bezier
bspline B-spline
cardinal Cardinal
taylor Taylor
There is no default. A value must be supplied.
deg degu degv
Free-form geometry statement.
Sets the polynomial degree for curves and surfaces.
degu is the degree in the u direction. It is required for both
curves and surfaces.
degv is the degree in the v direction. It is required only for
surfaces. For Bezier, B-spline, Taylor, and basis matrix, there is
no default; a value must be supplied. For Cardinal, the degree is
always 3. If some other value is given for Cardinal, it will be
ignored.
bmat u matrix
bmat v matrix
Free-form geometry statement.
Sets the basis matrices used for basis matrix curves and surfaces.
The u and v values must be specified in separate bmat statements.
NOTE: The deg statement must be given before the bmat statements
and the size of the matrix must be appropriate for the degree.
u specifies that the basis matrix is applied in the u direction.
v specifies that the basis matrix is applied in the v direction.
matrix lists the contents of the basis matrix with column subscript
j varying the fastest. If n is the degree in the given u or v
direction, the matrix (i,j) should be of size (n + 1) x (n + 1).
There is no default. A value must be supplied.
NOTE: The arrangement of the matrix is different from that commonly
found in other references. For more information, see the examples
at the end of this section and also the section, "Mathematics for
free-form curves and surfaces."
step stepu stepv
Free-form geometry statement.
Sets the step size for curves and surfaces that use a basis
matrix.
stepu is the step size in the u direction. It is required for both
curves and surfaces that use a basis matrix.
stepv is the step size in the v direction. It is required only for
surfaces that use a basis matrix. There is no default. A value must
be supplied.
When a curve or surface is being evaluated and a transition from
one segment or patch to the next occurs, the set of control points
used is incremented by the step size. The appropriate step size
depends on the representation type, which is expressed through the
basis matrix, and on the degree.
That is, suppose we are given a curve with k control points:
{v , ... v }
1 k
If the curve is of degree n, then n + 1 control points are needed
for each polynomial segment. If the step size is given as s, then
the ith polynomial segment, where i = 0 is the first segment, will
use the control points:
{v ,...,v }
is+1 is+n+1
For example, for Bezier curves, s = n .
For surfaces, the above description applies independently to each
parametric direction.
When you create a file which uses the basis matrix type, be sure to
specify a step size appropriate for the current curve or surface
representation.
curv u0 u1 v1 v2 . . .
Element statement for free-form geometry.
Specifies a curve, its parameter range, and its control vertices.
Although curves cannot be shaded or rendered, they are used by
other Advanced Visualizer programs.
u0 is the starting parameter value for the curve. This is a
floating point number.
u1 is the ending parameter value for the curve. This is a floating
point number.
v is the vertex reference number for a control point. You can
specify multiple control points. A minimum of two control points
are required for a curve.
For a non-rational curve, the control points must be 3D. For a
rational curve, the control points are 3D or 4D. The fourth
coordinate (weight) defaults to 1.0 if omitted.
curv2 vp1 vp2 vp3. . .
Free-form geometry statement.
Specifies a 2D curve on a surface and its control points. A 2D
curve is used as an outer or inner trimming curve, as a special
curve, or for connectivity.
vp is the parameter vertex reference number for the control point.
You can specify multiple control points. A minimum of two control
points is required for a 2D curve.
The control points are parameter vertices because the curve must
lie in the parameter space of some surface. For a non-rational
curve, the control vertices can be 2D. For a rational curve, the
control vertices can be 2D or 3D. The third coordinate (weight)
defaults to 1.0 if omitted.
surf s0 s1 t0 t1 v1/vt1/vn1 v2/vt2/vn2 . . .
Element statement for free-form geometry.
Specifies a surface, its parameter range, and its control vertices.
The surface is evaluated within the global parameter range from s0
to s1 in the u direction and t0 to t1 in the v direction.
s0 is the starting parameter value for the surface in the u
direction.
s1 is the ending parameter value for the surface in the u
direction.
t0 is the starting parameter value for the surface in the v
direction.
t1 is the ending parameter value for the surface in the v
direction.
v is the reference number for a control vertex in the surface.
vt is an optional argument.
vt is the reference number for a texture vertex in the surface. It
must always follow the first slash.
vn is an optional argument.
vn is the reference number for a vertex normal in the surface. It
must always follow the second slash.
For a non-rational surface, the control vertices are 3D. For a
rational surface the control vertices can be 3D or 4D. The fourth
coordinate (weight) defaults to 1.0 if ommitted.
NOTE: For more information on the ordering of control points for
survaces, refer to the section on surfaces and control points in
"mathematics of free-form curves/surfaces" at the end of this
appendix.
You can specify additional information for free-form curve and surface
elements using a series of statements called body statements. The
series is concluded by an end statement.
Body statements are valid only when they appear between the free-form
element statement (curv, curv2, surf) and the end statement. If they
are anywhere else in the .obj file, they do not have any effect.
You can use body statements to specify the following values:
o parameter
o knot vector
o trimming loop
o hole
o special curve
o special point
You cannot use any other statements between the free-form curve or
surface statement and the end statement. Using any other of type of
statement may cause unpredictable results.
This portion of a sample file shows the knot vector values for a
rational B-spline surface with a trimming loop. Notice the end
statement to conclude the body statements.
cstype rat bspline
deg 2 2
surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
parm v -2.00 -2.00 -2.00 -2.00 -2.00 -2.00
trim 0.0 2.0 1
end
The following syntax statement are listed in order of normal use.
parm u p1 p2 p3. . .
parm v p1 p2 p3 . . .
Body statement for free-form geometry.
Specifies global parameter values. For B-spline curves and
surfaces, this specifies the knot vectors.
u is the u direction for the parameter values.
v is the v direction for the parameter values.
To set u and v values, use separate command lines.
p is the global parameter or knot value. You can specify multiple
values. A minimum of two parameter values are required. Parameter
values must increase monotonically. The type of surface and the
degree dictate the number of values required.
trim u0 u1 curv2d u0 u1 curv2d . . .
Body statement for free-form geometry.
Specifies a sequence of curves to build a single outer trimming
loop.
u0 is the starting parameter value for the trimming curve curv2d.
u1 is the ending parameter value for the trimming curve curv2d.
curv2d is the index of the trimming curve lying in the parameter
space of the surface. This curve must have been previously defined
with the curv2 statement.
hole u0 u1 curv2d u0 u1 curv2d . . .
Body statement for free-form geometry.
Specifies a sequence of curves to build a single inner trimming
loop (hole).
u0 is the starting parameter value for the trimming curve curv2d.
u1 is the ending parameter value for the trimming curve curv2d.
curv2d is the index of the trimming curve lying in the parameter
space of the surface. This curve must have been previously defined
with the curv2 statement.
scrv u0 u1 curv2d u0 u1 curv2d . . .
Body statement for free-form geometry.
Specifies a sequence of curves which lie on the given surface to
build a single special curve.
u0 is the starting parameter value for the special curve curv2d.
u1 is the ending parameter value for the special curve curv2d.
curv2d is the index of the special curve lying in the parameter
space of the surface. This curve must have been previously defined
with the curv2 statement.
sp vp1 vp. . .
Body statement for free-form geometry.
Specifies special geometric points to be associated with a curve or
surface. For space curves and trimming curves, the parameter
vertices must be 1D. For surfaces, the parameter vertices must be
2D.
vp is the reference number for the parameter vertex of a special
point to be associated with the parameter space point of the curve
or surface.
end
Body statement for free-form geometry.
Specifies the end of a curve or surface body begun by a curv,
curv2, or surf statement.
vp u v w
Free-form geometry statement.
Specifies a point in the parameter space of a curve or surface.
The usage determines how many coordinates are required. Special
points for curves require a 1D control point (u only) in the
parameter space of the curve. Special points for surfaces require a
2D point (u and v) in the parameter space of the surface. Control
points for non-rational trimming curves require u and v
coordinates. Control points for rational trimming curves require u,
v, and w (weight) coordinates.
u is the point in the parameter space of a curve or the first
coordinate in the parameter space of a surface.
v is the second coordinate in the parameter space of a surface.
w is the weight required for rational trimming curves. If you do
not specify a value for w, it defaults to 1.0.
NOTE: For additional information on parameter vertices, see the
curv2 and sp statements
Hello, looks like cstype is not supported either. Here's some example OBJ code...
Not sure if you want to track that as a separate feature request.
Originally posted by @phillipsconsulting in https://github.com/sczerwinski/wavefront-obj-intellij-plugin/issues/470#issuecomment-1523910009