Rendering
Rendering Curves
- Evaluate p(u) for serveral values of u, and draw line segments between these points.
- The finer the divisions of the curve (the more values of u), the better the rendering will look.
- For efficiency : p(u)=c0+uc1+u2c2+u3c3=c0+u(c1+u(c2uc3))
- Smaller number of point in flat curve
Subdivision of ezier Curves
- Divide a curve into 2 halves (l(u) & r(u))
- Find l0,l1,l2,l3 and r0,r1,r2,r3 -> points
- Recursively draw l(u) and r(u)
- When to Stop?
- Divide until the curve is flat or close to flat
- Measure how far l1 and l2 are from the line between l0 and l3. When this is below a threshold, stop dividing.
- Compute new control points for each half curve :
- p0=l0, p3=r3, p(12)=l3=r0
- l1, r2 : magnitude of derivative is half, and direction is same.
- l(0)=l0=p0=p(0)
- l(1)=l3=p(12)
- l′(0)=3(l1−l0)=12p′(0)
- l′(1)=3(l3−l2)=12p′(12)
- Solve algebraically for l0,l1,l2,l3
- Similarly solve for r0,r1,r2,r3
- Geometric method
- p0=l0
- p3=r3
- l1=12(p0+p1)
- l2=12(l1+p1+p22)
- $l_3 = r_0 = \frac{1}{2}(l_2 + r_1)
- r2=12(p2+p3)
- r1=12(r2+p1+p22)
Subdividing Other Curves
- Calculations more complex
- Transform control points to obtain identical curve as Bezier curve
- Use the Bezier recursive subdivision algorithm
- Converting to a Bezier curve : Suppose the curve is given by : p(u)=uTMp
- We can find Bezier control points, q : p(u)=uTMBq
- it follows that : q=M−1BMp
Subdividing Other Curves : Example
- Interpolation to Bezier
M−1BMI=[1000−563−321313−323560001]
- B-Spline to Bezier
M−1BMS=16[1410042002400141]
Subdivision of Surfaces
1. Hold u constant at u=0,1/3,2/3,1 subdivide the 4 curves in the v direction.
2. Holde v constant at v=0,1/3,2/3,1 for each of 8 half curves generated in 1. Subdivide the 8 curves in the u direction.
3. Divide the surface into 4 patches (one of each quadrant) and repeat for each of the 4 patches.
4. When done dividing, render with GL_QUADS
'학교수업 > 수치해석' 카테고리의 다른 글
[Numerical Analysis] 8. Triangular Systems (0) | 2022.05.20 |
---|---|
[Numerical Analysis] 7. PCA (0) | 2022.05.20 |
[Numerical Analysis] 5. Surface (0) | 2022.05.20 |
[Numerical Analysis] 4. Curve (0) | 2022.05.20 |
[Numerical Analysis] 3. Transformation (0) | 2022.05.19 |