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