2010-1 학기 Chapter 7. Three-Dimensional Viewing 1.
-
Upload
kellie-may -
Category
Documents
-
view
220 -
download
1
Transcript of 2010-1 학기 Chapter 7. Three-Dimensional Viewing 1.
2010-1 학기 Chapter 7. Three-Dimensional Viewing 1
Chapter 7. Three-Dimensional Viewing
2010-1 학기 Chapter 7. Three-Dimensional Viewing 2
Overview of three-dimensional viewing conceptsOverview of three-dimensional viewing concepts
three-dimensional scene 을 디스플레이 하려면 camera 를 위한 coordinate reference 를 설정해야 함
camera film 의 plane 을 위한 position 과 orientation 정의 object description 이 camera reference coordinates 로 전달되고 display plane 에
투영되어 , wireframe 형태나 lighting and surface-rendering 으로 디스플레이 됨 그림 7-1
2010-1 학기 Chapter 7. Three-Dimensional Viewing 3
ProjectionsProjections
Parallel Projection object surface 의 점들을 평행선을 따라 display plane 에 투영시키는 것 different viewing position 에 따라 한 물체에 대해 different two-dimensional
views 를 형성
Perspective Projection 물체의 점들을 converging path 를 따라 display plane 에 투영시키는 방법
viewing position 에서 멀리 있는 물체를 가까이 있는 같은 크기의 물체보다 작게 표현함
more realistic
2010-1 학기 Chapter 7. Three-Dimensional Viewing 4
Depth cueing Depth cueing
a particular viewing direction 에서 디스플레이된 물체의 앞과 뒤를 구분할 수 있도록 depth information 을 주는 방법 wireframe display 에서 depth 를 주는 간단한 방법으로 viewing position
으로부터 거리에 따라 intensity 를 변화시키는 방법이 있다 . 다른 방법으로 effect of atmosphere ( 대기 , 기압 , 분위기 ): 멀리 있는
물체는 가까이에 있는 것보다 light scattering 으로 인해 희미하게 표현
2010-1 학기 Chapter 7. Three-Dimensional Viewing 5
(Fig. 7-5) The wireframe representation of the pyramid (a) no depth information (b) viewing direction: downward (c) viewing direction: upward
(a) (b) (c)
Ambiguity without depth informationAmbiguity without depth information
2010-1 학기 Chapter 7. Three-Dimensional Viewing 6
Visible line and surface identificationVisible line and surface identification
wireframe display 에서 depth relationship 을 구분할 때 visible lines 을 표시하는 방법이 있다 visible lines 을 highlight 하거나 다른 색으로 표현 nonvisible lines 을 제거하거나 dashed line 으로 표현하기도 함 surface 의 경우엔 hidden surface 를 보이지 않게 함 visible surface algorithm 에 따라 viewing plane 에 대해 픽셀 하나 하나의
visibility 를 첵크해 감
2010-1 학기 Chapter 7. Three-Dimensional Viewing 7
Surface renderingSurface rendering
scene 의 light condition 이나 surface characteristics 에 따라 물체의 surface intensity 를 조정함
물체의 surface property 로는 transparency 의 정도나 surface 의 매끄러운 정도를 포함함
이러한 property 에 따라 scene 의 correct illumination 과 shadow region 을 표현함
2010-1 학기 Chapter 7. Three-Dimensional Viewing 8
Exploded ( 분해 ) and cutaway ( 일부를 잘라냄 ) views 물체를 여러 부분들로 구성했을 경우 각 부분의 내부 구조나 관계를
표현하는데 이용 그림 7-8 그림 7-9
Three-dimensional and stereoscopic views three-dimensional views 는 vibrating flexible mirror 로부터 raster image 를
반사하여 얻어짐 . mirror 의 진동에 의하여 scene 안의 각 점들이 depth 에 따라 다르게 투영된다 .
stereoscopic device 는 scene 을 two views 로 표현하여 left eye, right eye 에 대한 view 를 각각 생성해냄 - 이러한 two views 가 raster monitor 에 alternate refresh cycles 로 디스플레이 됨
2010-1 학기 Chapter 7. Three-Dimensional Viewing 9
Three-Dimensional Viewing PipelineThree-Dimensional Viewing Pipeline
2 차원 viewing 과의 차이 공간의 어떤 위치에서도 물체를 바라볼 수 있다 (front, above, back,
inside, ..) 3 차원으로 기술된 물체를 출력장치의 평면으로 투영해야 한다 . Clipping boundaries 가 공간상의 한 용적 (volume) 을 에워싸며 이 용적의
모양은 투영의 타입에 따라 다르다 .
2010-1 학기 Chapter 7. Three-Dimensional Viewing 10
3 차원 장면을 컴퓨터에 나타내는 방법은 사진을 찍는 것과 같은 과정을 거침 공간상의 특정 위치에 카메라를 놓는다 . 카메라 방향을 조정한다 . 셔터를 내려 사진을 찍으면 , 3 차원 장면은 카메라의 윈도우 크기로
잘라지고 눈에 보이는 표면으로부터의 빛이 카메라 필름에 투영된다 .
한 장면을 기술한 world coordinates 를 device coordinates 로 변환시키는 일반적 처리 방법
2010-1 학기 Chapter 7. Three-Dimensional Viewing 11
General three-dimensional transformation pipelineGeneral three-dimensional transformation pipeline
Modeling Coordinates
Modeling Transformation
WorldCoordinates
Viewing Transformation
Projection Transformation
ViewingCoordinates
WorkstationTransformation
ProjectionCoordinates
DeviceCoordinates
Normalized Transformation and
Clipping
Viewport Transformation
Device Coordinates
2010-1 학기 Chapter 7. Three-Dimensional Viewing 12
Three-dimensional Viewing-Coordinate ParametersThree-dimensional Viewing-Coordinate Parameters
3 차원에서의 한 물체의 view 생성은 카메라로 사진을 찍는 것과 같음 : spatial position, orientation, aperture size of the “camera” 변화시킴
specifying the view plane ( 그림 7-13) establish the viewing-coordinate system (called view reference coordinate system) view plane (projection plane): viewing Zv axis 에 수직인 평면 ( 그림 7-14)
camera 에서 필름 평면에 해당 world coordinate position 이 viewing coordinates 로 변환되고 다시 viewing
coordinates 가 view plane 에 투영된다 .
2010-1 학기 Chapter 7. Three-Dimensional Viewing 13
A right-handed viewing coordinate systemA right-handed viewing coordinate system
xw
yw
zw
xv
zv
yv
P0 = (x0, y0, z0)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 14
Figure 7-13 Orientations of the view plane for specified normal vector coordinates relative to the world origin
Figure 7-13 Orientations of the view plane for specified normal vector coordinates relative to the world origin
xw
yw
zw
N
View plane
(a)
xw
yw
zw
(b)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 15
Figure 7-14 Three possible positions for the view plane along the z-view axis
Figure 7-14 Three possible positions for the view plane along the z-view axis
xv
yv
zv
2010-1 학기 Chapter 7. Three-Dimensional Viewing 16
viewing coordinate reference frame viewing coordinate reference frame
view reference point(viewing coordinate system 의 원점 ) 지정 보통 scene 중 한 물체에 근접하거나 그 물체의 표면에 있는 점으로 정함 .
혹은 물체의 중심이나 물체들로 구성된 그룹 내 한 점이 되기도 함 viewing Zv axis 를 위한 positive direction 과 view plane 방향 지정
view plane normal vector N 지정 world origin 이나 viewing coordinate origin 으로부터 선택된 한 점에
이르기까지의 선을 따라 N 방향 설정 (GKS, PHIGS 의 경우 ) 혹은 viewing coordinate origin 에 대한 look-at point 로 지정된 coordinate position
을 N 의 방향으로 정함 (GL 의 경우 ) ( 그림 7-15)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 17
Figure 7-15 Specifying the view-plane normal vector N as the direction Figure 7-15 Specifying the view-plane normal vector N as the direction
xw
yw
zw
yv xv
zv
NP0
P
2010-1 학기 Chapter 7. Three-Dimensional Viewing 18
view-up vector V 지정 positive Yv axis world-coordinate origin 에 대한 한 점을 선택하여 정의하며 , 결국 원점에서
그 점에 이르는 view-up vector 가 된다 . N 에 정확하게 직각인 V 벡터를 구하는 일이 어려우므로 보통 유저가 정의하는 벡터 V 를 normal vector 에 수직인 평면에 투영하는 방법으로 조정하여 얻는다 ( 그림 7-16)
따라서 view up vector V 는 N 과 평행하지 않는 어느 방향의 편리한 벡터로 정한다 .
N 과 V vector 를 이용하여 U vector 를 계산하여 Xv axis 를 정의한다 . uvn viewing-coordinate reference system ( 그림 7-17)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 19
Adjusting the input position of the view-up vector V to a position perpendicular to the normal vector N
Adjusting the input position of the view-up vector V to a position perpendicular to the normal vector N
VAdjusted V
Po N
2010-1 학기 Chapter 7. Three-Dimensional Viewing 20
The uvn viewing-coordinate reference frameThe uvn viewing-coordinate reference frame
view plane normal N zview axis 방향을 정의
view-up vector V yview axis 에 이용
N, V 를 이용하여 xview axis 방향을 결정
n = = (nx, ny, nz)N
| N |
u = = (ux, uy, uz)V x n
| V |
v = n x u = (vx, vy, vz)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 21
A right-handed viewing system defined with unit vectors u, v, and n.A right-handed viewing system defined with unit vectors u, v, and n.
uv
nxv
yv
zv
2010-1 학기 Chapter 7. Three-Dimensional Viewing 22
한 scene 에 대해 여러 view 를 얻기 위해서는 view reference point 를 고정시키고 N 방향을 변화시킴 ( 그림 7-19)( 그림 7-20) => 책 그림 참고 normal vector N 만을 변화시키면 V 방향을 제외한 어떤 방향에서도 Scene
을 볼 수가 있다 .
2010-1 학기 Chapter 7. Three-Dimensional Viewing 23
Transformation from world to viewing coordinatesTransformation from world to viewing coordinates
1) view reference point 를 world-coordinate system 의 원점으로 translate view reference point 가 world position (x0, y0, z0) 이면
1 0 0 -x0
T = 0 1 0 -y0
0 0 1 -z0
0 0 0 1
에 의해 view reference point 를 이동시킴
2010-1 학기 Chapter 7. Three-Dimensional Viewing 24
2) xv, yv, zv axes 를 xw, yw, zw axes 로 각각 맞추어지도록 rotate three coordinate axis rotations 가 필요함 N 이 하나의 world-coordinate axis 에 일치하지 않은 경우에
Rz Ry Rx 변환으로 Viewing and world systems 를 일치시킨다 . zv 를 xw zw 평면으로 떨어뜨리도록 xw 축을 중심으로 rotate zw 와 zv 를 일치시키도록 yw 축을 중심으로 rotate
2010-1 학기 Chapter 7. Three-Dimensional Viewing 25
xw
yw
zw
yv xv
zv
xw
yw
zw
yv xv
zvxw
yw
zw
yv
xvzv
2010-1 학기 Chapter 7. Three-Dimensional Viewing 26
다른 방법으로 unit uvn vector 를 계산하여 composite rotation matrix 를 직접 구함
N
n = = (n1, n2, n3)
|N|
V X N
u = = (u1, u2, u3)
|V X N |
v = n X u = (v1, v2, v3)
u1 u2 u3 0
R = v1 v2 v3 0
n1 n2 n3 0
0 0 0 1
2010-1 학기 Chapter 7. Three-Dimensional Viewing 27
u 는 xw axis, v 는 yw axis, n 은 zw axis 로 변환됨
complete world-to-viewing coordinate transformation matrix Mwc,vc = R T
2010-1 학기 Chapter 7. Three-Dimensional Viewing 28
Projection TransformationsProjection Transformations
scene 내 물체의 world-coordinates 를 viewing coordinates 로 바꾼 뒤에는 3D 물체를 2D view plane 에 투영시켜야 한다 .
two basic projection methods parallel projection, perspective projection
2010-1 학기 Chapter 7. Three-Dimensional Viewing 29
Parallel Projection object surface 의 점들을 평행선을 따라 display plane 에 투영시키는 것 different viewing position 에 따라 한 물체에 대해 different two-dimensional
views 를 형성 Perspective Projection
물체의 점들을 converging path 를 따라 display plane 에 투영시키는 방법 viewing position 에서 멀리 있는 물체를 가까이 있는 같은 크기의 물체보다
작게 표현함 more realistic
2010-1 학기 Chapter 7. Three-Dimensional Viewing 30
parallel projectionparallel projection
coordinate position 이 평행선을 따라 view plane 으로 변환됨 ( 그림 7-22) projection lines 의 방향을 정의하는 projection vector 로 지정 orthographic parallel projection 과 oblique parallel projection 이 있음
2010-1 학기 Chapter 7. Three-Dimensional Viewing 31
Window specification on the view planeWindow specification on the view plane
Viewplane Projection
window
(xwmin, ywmin)
(xwmax, ywmax)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 32
Figure 7-22 Parallel projection of an object to the view planeFigure 7-22 Parallel projection of an object to the view plane
p1
p2
p1’
p2’
2010-1 학기 Chapter 7. Three-Dimensional Viewing 33
Figure 7-23 Perspective projection of an object to the view planeFigure 7-23 Perspective projection of an object to the view plane
p1
p2
p1’
p2’
Projection reference point
2010-1 학기 Chapter 7. Three-Dimensional Viewing 34
orthographic parallel projectionorthographic parallel projection
view plane 이 zv axis 를 따라 zvp 위치에 있다고 하면 viewing coordinates (x, y, z) 는
xp = x, yp = y 의 projection coordinates 로 바뀜 ( 그림 7-26)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 35
Figure 7-26 Orthogonal projection of a spatial position onto a view plane
Figure 7-26 Orthogonal projection of a spatial position onto a view plane
zv
xv
yv
(x, y, z)
(x, y)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 36
oblique parallel projection ( 그림 7-32)oblique parallel projection ( 그림 7-32)
( 그림 7-33) transformation matrix
1 0 L1cosφ 0
Mparallel = 0 1 L1sinφ 0
0 0 0 0
0 0 0 1
2010-1 학기 Chapter 7. Three-Dimensional Viewing 37
Oblique Parallel ProjectionOblique Parallel Projection
window
(a) orthographic- projection view volume (side view)
window
xv yv plane
zv
(b) orthographic-projection view volume (top view)
window
(c) oblique-projection view volume (side view)
window
xv yv plane
zv
(d) oblique-projection view volume (top view)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 38
Oblique Parallel ProjectionOblique Parallel Projection
xp = x + L cos yp = y + L sin ztan = L
zv
xv
yv
(x, y, z)
(x, y)
(xp, yp)
View plane
LL =
z
tan
= z L1
xp = x + z (L1 cos )yp = y + z (L1 sin )
2010-1 학기 Chapter 7. Three-Dimensional Viewing 39
Perspective projection Perspective projection
projection reference point 에서 만나는 projection lines 을 따라 점들을 변환시킴 ( 그림 7-40) ( 그림 7-41)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 40
Figure 7-40 Perspective projection of two equal-length line segments at different distances from the view plane
Figure 7-40 Perspective projection of two equal-length line segments at different distances from the view plane
p1
p2
p1’
p2’
Projection reference point
p1
p2
2010-1 학기 Chapter 7. Three-Dimensional Viewing 41
P = (x, y, z)
zprp
(xp, yp, zp)
zvp
x’ = x – (x - xprp)uy’ = y – (y - yprp)uz’ = z - (z - zprp) u
Projection line 위에 있는 모든 점 (x’, y’, z’)
u = zprp - z
zvp - z
xp = x zprp - zvp
zprp - z= x
dp
zprp - z
yp = y zprp - zvp
zprp - z= y
dp
zprp - z
Perspective projection of a point PPerspective projection of a point P
2010-1 학기 Chapter 7. Three-Dimensional Viewing 42
Vanishing point Vanishing point
그림 7-44 3 차원 객체가 perspective transformation 을 이용하여 view plane 에 투영될 때
plane 과 평행하지 않는 평행선들은 converging lines 으로 투영될 것이다 . View plane 에 평행하는 평행선들은 평행선들로 투영될 것이다 . 투영된 평행선들이 수렴하는 한 점을 vanishing point ( 소멸점 ) 이라고 한다 . Principal vanishing point:
Vanishing point 를 구성하는 선들이 물체의 좌표축에 평행하는 경우를 말함 .
Principal vanishing point 의 수는 view plane 과 교차하는 좌표축의 수에 의해 결정된다 .
2010-1 학기 Chapter 7. Three-Dimensional Viewing 43
x
y
z
Vanishing pointPrincipal vanishing pointsPrincipal vanishing points
One point perspective projection(view plane 이 z-axis 만을 교차할 경우 )
Two point perspective projection(view plane 이 z-axis 와 x-axis 를 동시에 교차할 경우 )
2010-1 학기 Chapter 7. Three-Dimensional Viewing 44
View Volumes and General Projection Transformations View Volumes and General Projection Transformations
view volume ( 그림 7-46) view window 가 주어지면 window boundary 를 이용하여 구해짐 view volume 내에 있는 물체만 디스플레이에 나타나고 나머지는 clip 됨 view volume 의 크기는 window size 에 따라 다르고 view volume 의 모양은
projection 타입에 따라 다르다 parallel projection 의 경우에는 view volume 의 네 변이 무한의 평행사변형을
형성 perspective projection 의 경우에는 projection reference point 를 정점으로 하는
피라미드를 형성 ( 그림 7-46)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 45
Figure 7-46 A perspective projection view volumeFigure 7-46 A perspective projection view volume
clippingwindow
ProjectionReferencepoint
RectangularFrustumView volume
Far clipping plane
Near clipping plane
2010-1 학기 Chapter 7. Three-Dimensional Viewing 46
Figure 7-29 A finite orthogonal view volume Figure 7-29 A finite orthogonal view volume
Clipping window
Orthogonal projection view volume
Near planeFar plane
2010-1 학기 Chapter 7. Three-Dimensional Viewing 47
Examples of a perspective-projection view volumeExamples of a perspective-projection view volume
window
Projectionreferencepoint
window
Projectionreferencepoint
window
xv yv plane
zv
xv yv plane
zv
2010-1 학기 Chapter 7. Three-Dimensional Viewing 48
General Parallel-Projection TransformationsGeneral Parallel-Projection Transformations
parallel projection 의 방향은 projection reference point 에서 view window 의 중간으로 향하는 projection vector 로 지정
oblique projection transformation 을 regular parallel projection 으로 하기 위해선 shear transformation 필요
projection vector 를 viewing coordinates 로 표시하면 vp = (px, py, pz) 일때 vp 를 view plane normal vector N 과 일치시키는 shear
matrix 가 필요 v’p = Mparallel · vp = 0
0
pz
0
2010-1 학기 Chapter 7. Three-Dimensional Viewing 49
window
N
vp
zv
window
N
vp’
zv
oblique projection vector and associated view volume
regular parallelpiped view volume
obtained by shearing the view
volume
2010-1 학기 Chapter 7. Three-Dimensional Viewing 50
1 0 a 0
Mparallel= 0 1 b 0
0 0 1 0
0 0 0 1
=> z axis shear
0 = px + a · pz
0 = py + b · pz
=> a = - px / pz b = - py / pz
1 0 -px/pz 0
Mparallel= 0 1 -py/pz 0
0 0 1 0
0 0 0 1
2010-1 학기 Chapter 7. Three-Dimensional Viewing 51
Relationships between the parallel-projection vector vp and parameters L, , ø
Relationships between the parallel-projection vector vp and parameters L, , ø
yv
xv
zv
vp
(xp’, yp’, 0)
pz(x, y, 0)
L
px
py
ø
2010-1 학기 Chapter 7. Three-Dimensional Viewing 52
General shape for the perspective view volume with a projection reference point that is not on the zv axis
General shape for the perspective view volume with a projection reference point that is not on the zv axis
View volume
zv
View plane
Center of window
(xprp’, yprp’, zprp)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 53
Shearing a general perspective view volume to center it on the projection window
Shearing a general perspective view volume to center it on the projection window
(x’, y’, z)
(x”, y”, z)
Center of window
View plane(z = zvp)
(xprp’, yprp’, zprp)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 54
General Perspective Projection Transformations 책참고
2010-1 학기 Chapter 7. Three-Dimensional Viewing 55
OpenGL Three-Dimensional Viewing FunctionsOpenGL Three-Dimensional Viewing Functions
OpenGL 의 기본 라이브러리와 GLU(OpenGL Utility Library) 에 viewing 함수 포함
OpenGL Viewing-Tranformation Function glMatrixMode (GL_MODELVIEW);
world coordinates 를 viewing coordinates 로 변환하기 위한 matrix 설정
gluLookAt(x0, y0, z0, xref, yref, zref, Vx, Vy, Vz); viewing parameter 설정 viewing reference origin 을 world coordinate position 인 p0 = (x0,
y0, z0) 로 지정하고 , reference position 을 Pref = (xref, yref, zref) 로 지정하고 , view-up vector 를 V = (Vx, Vy, Vz) 로 나타내고 , viewing frame 의 zview-axis 를 N = P0 – Pref 가 되도록 함
gluLookAt function 을 부르지 않으면 default viewing parameter 는 다음과 같다 :
P0 = (0, 0, 0), Pref = (0, 0, -1), V = (0, 1, 0)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 56
OpenGL Orhtogonal-Projection Function glMaxtrixMode (GL_Projections); Projection matrix 설정 glOrtho (xwmin, xwmax, ywmin, ywmax, dnear, dfar); orthogonal projection
parameter 설정 , clipping window 선택 , default clipping window 는 (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0) 으로 symmetric normalized square
OpenGL Symmetric Perspective-projection Function gluPerspective (theta, aspect, dnear, dfar); theta, aspect: near plane 의 size, position 을 나타냄 , aspect 는 clipping
window 의 aspect ratio 의미 dnear, dfar: view point 로부터 두 clipping plane 까지의 거리
2010-1 학기 Chapter 7. Three-Dimensional Viewing 57
OpenGL General Perspective-Projection Function glFrustrum (xwmin, xwmax, ywmin, ywmax, dnear, dfar); symmetric frustum view
volume 혹은 oblique frustum view volume 의 perspective projection 설정
OpenGL Viewports and Display Windows glViewport (xvmin, yvmin, vpWidth, vpHeight); normalized coordinates 에
clipping routines 을 적용한 후에 screen coordinates 로 변환
2010-1 학기 Chapter 7. Three-Dimensional Viewing 58
Three-Dimensional Clipping AlgorithmsThree-Dimensional Clipping Algorithms
view-volume clipping boundary: projection 타입에 따라 방향이 다른 평면들로 구성됨 front and back clipping planes 는 view plane 과 평행하며 constant z-
coordinate value 를 갖는다 . 그 외 다른 네 평면은 임의의 방향을 가짐 view volume 의 coordinate values 를 orthographic parallel coordinates
로 변환하는 projection transformation 후에 clipping calculations 가 필요
Normalized View Volume normalized projection coordinates: 사각형 내 점들을 지정된 3D
viewport 내 한 위치로 변환시킨 후에 device coordinates 로 변환시킴
normalized view volume 은 xwmin = -1 xwmax = 1 ywmin = -1 ywmax = 1 zwmin = -1 zwmax = 1
2010-1 학기 Chapter 7. Three-Dimensional Viewing 59
Dimensions of the view volume and three-dimensional viewportDimensions of the view volume and three-dimensional viewporty
x
z
(xwmax, ywmax, zback)
(xwmin’, ywmin’, zfront)
(a) Parallelpiped view volumeUnit cube
3D viewport
(xvmin, yvmin, zvmin)
(xvmax, yvmax, zvmax)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 60
viewport clippingviewport clipping
2 차원에서와 비슷하게 처리되며 2 차원에서 clipping edges 에 대한 처리가 clipping planes 에 대해 처리된다는 것이 다르다 .
6 bits 로 구성된 region code 이용 한 선분의 끝점 (x, y, z) 에 대해 6 비트중 오른쪽비트부터
bit 1 = 1 if x < xvmin (left) bit 2 = 1 if x > xvmax (right) bit 3 = 1 if y < yvmin (below) bit 4 = 1 if y > yvmax (above) bit 5 = 1 if z < zvmin (front) bit 6 = 1 if z > zvmax (back)
2010-1 학기 Chapter 7. Three-Dimensional Viewing 61
1) 양 끝점의 region code 가 000000 이면 completely inside
2) 두 점이 다 000000 이 아니면 두 점에 대한 logical and operation 값이 nonzero 이면 두 점은 six outside region 에 있다 .
3) 1), 2) 의 경우가 아닌 경우 bounding plane 과의 intersection test 를 한다 .
2010-1 학기 Chapter 7. Three-Dimensional Viewing 62
bit 1 = 1 if x < xvmin (left)bit 2 = 1 if x > xvmax (right)bit 3 = 1 if y < yvmin (below)bit 4 = 1 if y > yvmax (above)bit 5 = 1 if z < zvmin (front)bit 6 = 1 if z > zvmax (back)
100001
000001000000
00001
011001 011000011010