[Computer Graphics] Curves & Surfaces

2023. 10. 10. 18:29Run/Computer Graphics

 

 

- 이전까지는 직선으로만 도형을 형성했다.

- Curves, Sufaces는 디자인 측면에서 중요하다.

- Curves: 1D objects in 2D or 3D space

- Surfaces: 2D objects in 3D space

 

곡선을 나타내는 방법

 

Polynomials

n: degree / a0, a1, ... an: constants

 

 

Drawing Polynomials Using Control Points

- point들을 Control Points 라고 한다.

- 위 그림에는 총 21개의 point가 있다. → degree 20 polynomial (20차 방정식) 사용

   (ex. 일차방정식 y = ax + b 를 표현하려면 점 2개가 필요하다.)

- 이 방식을 사용하면 high degree polynomial을 사용할 때 굉장히 형태가 불안정하다.

 

- Cubic Polynomial (degree 3 polynomial) 을 사용하면 깔끔한 결과가 나온다.

- 여러 cubic polynomail을 합친다.

- Cubic polynomial는 4개의 점을 필요로 한다. → 4개의 점을 가지고 진행

 

 

Interpolating Cubic

 

- Express x, y, z points of a curve as functions of a parameter u.

- Each set of 4 control points is connected by a cubic polynomial.

 

- 0 ≤ u ≤ 1

- At control points, u = 0, 1/3, 2/3, 1

- Coefficient들은 각 control point의 (x, y, z) 좌표를 통해 구할 수 있다.

- C = MI * P

 

- p0~p3: used to interpolate the first curve, p3~p6: used to interpolate the second curve, ... and so on.

- Use n points, where (n - 1) is divisble by 3.

 

Bezier Curve

- 지나치게 curvy한 것을 방지하기 위해 사용한다.

- Curve is tangent to line segments p0p1 and p2p3 (위 사진에서 빨간색이 tangent line)

- Curve is within convex hull of p0, p1, p2, p3. (위 사진에서 파란색이 convex hull)

 

- Convex polygon: 도형 내 모든 각도가 180도 미만 (↔ Non-convex polygon)

 

- C = MB * P

 

- Issue: 각 곡선이 만나는 cusps가 sharp하다.

- Slope(tangent) changes drastically at cusp.

 

B-Spline

- Tangent of adjacent cubics are forced to be the same.

- 4 points control a curve near 2 points.

 

- p0, p1, p2, p3 control a curve near p1 and p2.

- p1, p2, p3, p4 control a curve near p2 and p3.

...

 

- Bezeir & Interpolated Cubic use p0~p3, p3~p6, p6~p9...

- B-Splines use p0~p3, p1~p4, p2~p5, ...

 

- C = Ms * P

 

- Issue: Endpoints(양끝 점)을 잇지 않는다.

- B-Spline does not have cusps.

- Cusps 또는 연결된 endpoints가 필요하다면, replicating points를 사용한다.

   (ex. p0, p1, p2, ... → p0, p0, p1, p2, ... or p0, p0, p0, p1, p2, ...)

 

- p0 repeated 2 times: pulls curve toward p0. (cusp near p3)

 

- p0 repeated 3 times: forces curve to start at p0. (sharp cusp at p3)

 

- With repeated points, B-splines turn out to be incredibly powerful in modeling curves.

- B-spline with repeated points ≠ Bezier curve

- Both tangent to the line segments, but B-spline is closer to the control points

 

모든 공식을 요약하면,

p = C^T * u 로 표현할 수 있다.

 

 

 

Modeling Surfaces Using Polynomials

- Need 16 points (4 along u * 4 along v)

- x, y, z를 u와 v를 이용하여 표현한다.

 

- curve/surface를 n개의 점으로 분할하고, line 또는 triangle을 이용해 점을 연결하는 방식은 비효율적이다.

  (∵ need to do polynomial evaluations for several points)

 

Recursive Subdivison (작성 중)

- 장점: Curve approaches smoothness in few steps (without polynomial calculations)

- Bezier cubic does this curve approximate.

- Bezier curve lies within convex hull, unlike Interpolated Cubic, and curve ends at endpoints, unlike B-Spline.

 

- Interpolated Cubic and B-Spline are converted to Bezier and modeled using recursive subdivison.

 

Recursive Subdivision : Interpolated Cubic

- Apply recursive subdivision to control points in PI→B

 

Recursive Subdivision : B-Spline

- Apply recursive subdivision to control points in PS→B

 

Recursive Subdivision : Bezier Surfaces

 

Recursive Subdivision : Sphere from Regular Tetrahedron