From 2e367da3b4db976018c8b04f2a9ef75514a0b9a6 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Tue, 11 Jun 2019 17:27:16 -0400 Subject: OBJ.spec: Added some mathematical formulas. --- doc/OBJ.spec | 72 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/doc/OBJ.spec b/doc/OBJ.spec index 13f49a5..2962721 100644 --- a/doc/OBJ.spec +++ b/doc/OBJ.spec @@ -2476,46 +2476,58 @@ Rational and non-rational curves and surfaces In general, any non-rational curve segment may be written as: + + C(t) = Σ[i=0..K] d_i N_{i,n}(t) + where -K + 1 is the number of control points +K + 1 is the number of control points -di are the control points +d_i are the control points -n is the degree of the curve +n is the degree of the curve -Ni,n(t) are the degree n basis functions +N_{i,n}(t) are the degree n basis functions Extending this to the bivariate case, any non-rational surface patch may be written as: + S(u,v) = Σ[i=0..K₁] Σ[j=0..K₂] d_{i,j} N_{i,m}(u) N_{j,n}(v) + where: -K1 + 1 is the number of control points in the u direction +K₁ + 1 is the number of control points in the u direction -K2 + 1 is the number of control points in the v direction +K₂ + 1 is the number of control points in the v direction -di,j are the control points +d_{i,j} are the control points -m is the degree of the surface in the u direction +m is the degree of the surface in the u direction -n is the degree of the surface in the v direction +n is the degree of the surface in the v direction -Ni,m(u) are the degree m basis functions in the u direction +N_{i,m}(u) are the degree m basis functions in the u direction -Nj,n(v) are the degree n basis functions in the v direction +N_{j,n}(v) are the degree n basis functions in the v direction NOTE: The front of the surface is defined as the side where the u parameter increases to the right and the v parameter increases upward. We may extend this curve to the rational case as: + Σ[i=0..K] w_i d_i N_{i,n}(t) +C(t) = ──────────────────────────── + Σ[i=0..K] w_i N_{i,n}(t) -where wi are the weights associated with the control points di. +where w_i are the weights associated with the control points d_i. Similarly, a rational surface may be expressed as: -where wi,j are the weights associated with the control points di,j. + Σ[i=0..K₁] Σ[j=0..K₂] w_{i,j} d_{i,j} N_{i,m}(u) N_{j,n}(v) +S(u,v) = ─────────────────────────────────────────────────────────── + Σ[i=0..K₁] Σ[j=0..K₂] w_{i,j} N_{i,m}(u) N_{j,n}(v) + +where w_{i,j} are the weights associated with the control points d_{i,j}. NOTE: If a curve or surface in an .obj file is rational, it must use the rat option with the cstype statement and it requires some weight @@ -2531,7 +2543,7 @@ given. This default weight is only reasonable for curves and surfaces whose -basis functions sum to 1.0, such as Bezier, Cardinal, and NURB. It does +basis functions sum to 1.0, such as Bezier, Cardinal, and NURBS. It does not make sense for Taylor and may or may not make sense for a representation given in basis-matrix form. @@ -2542,9 +2554,13 @@ entire composite curve or surface using the parameter vector given with the parm statement. The parameter vector for a curve is a list of p global parameter values -{t1, . . . , tp}. If t1 t < ti+1 is a point in global parameter space, +{τ₁, . . . , τ_p}. If τ₁ ≤ t < t_{i+1} is a point in global parameter space, then: + τ - τ_i +t = ───────────── + τ_{i+1} - τ_i + is the corresponding point in local parameter space for the ith polynomial segment. It is this t which is used when evaluating a given segment of the piecewise curve. For surfaces, this mapping from global @@ -2571,22 +2587,30 @@ Type bspline specifies arbitrary degree non-uniform B-splines which are commonly referred to as NURBs in their rational form. The basis functions are defined by the Cox-deBoor recursion formulas as: + ⎧ 1 if x_i ≤ t < x_{i+1} +N_{i,0}(t) = ⎨ + ⎩ 0 otherwise + and: + N_{i,n-1}(t) N_{i+1,n-1}(t) +N_{i,n}(t) = (t - x_i)───────────── + (x_{i+n+1} - t)─────────────────── + x_{i+n} - x_i x_{i+n+1} - x_{i+1} + where, by convention, 0/0 = 0. -The xi {x0, . . . ,xq} form a set known as the knot vector which is +The x_i ∈ {x₀, . . . ,x_q} form a set known as the knot vector which is given by the parm statement. It is required that -1. xi xi + 1, +1. x_i ≤ x_{i+1}, -2. x0 < xn + 1, +2. x₀ < x_{n+1}, -3. xq -n -1 < xq, +3. x_{q-n-1} < x_q, -4. xi < xi + n for 0 < i < q - n - 1, +4. x_i < x_{i+n} for 0 < i < q - n - 1, -5. xn t min < tmax xK+ 1, where [tmin, tmax] is the parameter +5. x_n ≤ t_min < t_max ≤ x_{K+1}, where [t_min, t_max] is the parameter over which the B-spline is to be evaluated, and 6. K = q - n - 1. @@ -2606,8 +2630,14 @@ Bezier Type bezier specifies arbitrary degree Bezier curves and surfaces. This basis function is defined as: + n +N_{i,n}(t) = i t^i (1-t)^(n-i) + where: + n + i = n! / i!(n-i)! + When using type bezier, the number of global parameter values given with the parm statement must be K/n + 1, where K is the number of control points. For surfaces, this requirement applies independently -- cgit v1.2.3