summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-06-11 17:27:16 -0400
committerJoe Crayne <joe@jerkface.net>2019-06-11 17:27:16 -0400
commit2e367da3b4db976018c8b04f2a9ef75514a0b9a6 (patch)
tree912d02f66f4c53ceae1b9f54bbcaa379f77e0fd4
parent083779f1bdf92aed9519c9d1f1e6c4042f574a82 (diff)
OBJ.spec: Added some mathematical formulas.
-rw-r--r--doc/OBJ.spec72
1 files 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
2476 2476
2477In general, any non-rational curve segment may be written as: 2477In general, any non-rational curve segment may be written as:
2478 2478
2479
2480 C(t) = Σ[i=0..K] d_i N_{i,n}(t)
2481
2479where 2482where
2480 2483
2481K + 1 is the number of control points 2484K + 1 is the number of control points
2482 2485
2483di are the control points 2486d_i are the control points
2484 2487
2485n is the degree of the curve 2488n is the degree of the curve
2486 2489
2487Ni,n(t) are the degree n basis functions 2490N_{i,n}(t) are the degree n basis functions
2488 2491
2489Extending this to the bivariate case, any non-rational surface patch 2492Extending this to the bivariate case, any non-rational surface patch
2490may be written as: 2493may be written as:
2491 2494
2495 S(u,v) = Σ[i=0..K₁] Σ[j=0..K₂] d_{i,j} N_{i,m}(u) N_{j,n}(v)
2496
2492where: 2497where:
2493 2498
2494K1 + 1 is the number of control points in the u direction 2499K + 1 is the number of control points in the u direction
2495 2500
2496K2 + 1 is the number of control points in the v direction 2501K + 1 is the number of control points in the v direction
2497 2502
2498di,j are the control points 2503d_{i,j} are the control points
2499 2504
2500m is the degree of the surface in the u direction 2505m is the degree of the surface in the u direction
2501 2506
2502n is the degree of the surface in the v direction 2507n is the degree of the surface in the v direction
2503 2508
2504Ni,m(u) are the degree m basis functions in the u direction 2509N_{i,m}(u) are the degree m basis functions in the u direction
2505 2510
2506Nj,n(v) are the degree n basis functions in the v direction 2511N_{j,n}(v) are the degree n basis functions in the v direction
2507 2512
2508NOTE: The front of the surface is defined as the side where the u 2513NOTE: The front of the surface is defined as the side where the u
2509parameter increases to the right and the v parameter increases upward. 2514parameter increases to the right and the v parameter increases upward.
2510 2515
2511We may extend this curve to the rational case as: 2516We may extend this curve to the rational case as:
2512 2517
2518 Σ[i=0..K] w_i d_i N_{i,n}(t)
2519C(t) = ────────────────────────────
2520 Σ[i=0..K] w_i N_{i,n}(t)
2513 2521
2514 2522
2515where wi are the weights associated with the control points di. 2523where w_i are the weights associated with the control points d_i.
2516Similarly, a rational surface may be expressed as: 2524Similarly, a rational surface may be expressed as:
2517 2525
2518where wi,j are the weights associated with the control points di,j. 2526 Σ[i=0..K₁] Σ[j=0..K₂] w_{i,j} d_{i,j} N_{i,m}(u) N_{j,n}(v)
2527S(u,v) = ───────────────────────────────────────────────────────────
2528 Σ[i=0..K₁] Σ[j=0..K₂] w_{i,j} N_{i,m}(u) N_{j,n}(v)
2529
2530where w_{i,j} are the weights associated with the control points d_{i,j}.
2519 2531
2520NOTE: If a curve or surface in an .obj file is rational, it must use 2532NOTE: If a curve or surface in an .obj file is rational, it must use
2521the rat option with the cstype statement and it requires some weight 2533the rat option with the cstype statement and it requires some weight
@@ -2531,7 +2543,7 @@ given.
2531 2543
2532 2544
2533This default weight is only reasonable for curves and surfaces whose 2545This default weight is only reasonable for curves and surfaces whose
2534basis functions sum to 1.0, such as Bezier, Cardinal, and NURB. It does 2546basis functions sum to 1.0, such as Bezier, Cardinal, and NURBS. It does
2535not make sense for Taylor and may or may not make sense for a 2547not make sense for Taylor and may or may not make sense for a
2536representation given in basis-matrix form. 2548representation given in basis-matrix form.
2537 2549
@@ -2542,9 +2554,13 @@ entire composite curve or surface using the parameter vector given with
2542the parm statement. 2554the parm statement.
2543 2555
2544The parameter vector for a curve is a list of p global parameter values 2556The parameter vector for a curve is a list of p global parameter values
2545{t1, . . . , tp}. If t1 t < ti+1 is a point in global parameter space, 2557{τ₁, . . . , τ_p}. If τ₁ t < t_{i+1} is a point in global parameter space,
2546then: 2558then:
2547 2559
2560 τ - τ_i
2561t = ─────────────
2562 τ_{i+1} - τ_i
2563
2548is the corresponding point in local parameter space for the ith 2564is the corresponding point in local parameter space for the ith
2549polynomial segment. It is this t which is used when evaluating a given 2565polynomial segment. It is this t which is used when evaluating a given
2550segment of the piecewise curve. For surfaces, this mapping from global 2566segment 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
2571commonly referred to as NURBs in their rational form. The basis 2587commonly referred to as NURBs in their rational form. The basis
2572functions are defined by the Cox-deBoor recursion formulas as: 2588functions are defined by the Cox-deBoor recursion formulas as:
2573 2589
2590 ⎧ 1 if x_i ≤ t < x_{i+1}
2591N_{i,0}(t) = ⎨
2592 ⎩ 0 otherwise
2593
2574and: 2594and:
2575 2595
2596 N_{i,n-1}(t) N_{i+1,n-1}(t)
2597N_{i,n}(t) = (t - x_i)───────────── + (x_{i+n+1} - t)───────────────────
2598 x_{i+n} - x_i x_{i+n+1} - x_{i+1}
2599
2576where, by convention, 0/0 = 0. 2600where, by convention, 0/0 = 0.
2577 2601
2578The xi {x0, . . . ,xq} form a set known as the knot vector which is 2602The x_i {x, . . . ,x_q} form a set known as the knot vector which is
2579given by the parm statement. It is required that 2603given by the parm statement. It is required that
2580 2604
25811. xi xi + 1, 26051. x_i x_{i+1},
2582 2606
25832. x0 < xn + 1, 26072. x < x_{n+1},
2584 2608
25853. xq -n -1 < xq, 26093. x_{q-n-1} < x_q,
2586 2610
25874. xi < xi + n for 0 < i < q - n - 1, 26114. x_i < x_{i+n} for 0 < i < q - n - 1,
2588 2612
25895. xn t min < tmax xK+ 1, where [tmin, tmax] is the parameter 26135. x_n t_min < t_max x_{K+1}, where [t_min, t_max] is the parameter
2590over which the B-spline is to be evaluated, and 2614over which the B-spline is to be evaluated, and
2591 2615
25926. K = q - n - 1. 26166. K = q - n - 1.
@@ -2606,8 +2630,14 @@ Bezier
2606Type bezier specifies arbitrary degree Bezier curves and surfaces. This 2630Type bezier specifies arbitrary degree Bezier curves and surfaces. This
2607basis function is defined as: 2631basis function is defined as:
2608 2632
2633 n
2634N_{i,n}(t) = i t^i (1-t)^(n-i)
2635
2609where: 2636where:
2610 2637
2638 n
2639 i = n! / i!(n-i)!
2640
2611When using type bezier, the number of global parameter values given 2641When using type bezier, the number of global parameter values given
2612with the parm statement must be K/n + 1, where K is the number of 2642with the parm statement must be K/n + 1, where K is the number of
2613control points. For surfaces, this requirement applies independently 2643control points. For surfaces, this requirement applies independently