Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Archives
Today
Total
관리 메뉴

codingfarm

3. 변환 - DirectXMath 라이브러리의 변환 함수들 본문

computer graphics/DX12 book

3. 변환 - DirectXMath 라이브러리의 변환 함수들

scarecrow1992 2020. 11. 22. 21:08

비례 행렬 생성

XMMATRIX XM_CALLCONV XMMatrixScaling(
    float ScaleX,
    float ScaleY,
    float ScaleZ
);

 

벡터의 성분들로 비례 행렬 성생

XMMATRIX XM_CALLCONV XMMatrixScalingFromVector(
  FXMVECTOR Scale );

 

$x,y,z$ 축에 대한 회전행렬 $R_x,R_y,R_z$ 생성

XMMATRIX XM_CALLCONV XMMatrixRotationX( float Angle );

XMMATRIX XM_CALLCONV XMMatrixRotationY( float Angle );

XMMATRIX XM_CALLCONV XMMatrixRotationZ( float Angle );

 

임의의 축에 대한 회전행렬 $R_n$

XMMATRIX XM_CALLCONV XMMatrixRotationAxis(
    FXMVECTOR Axis,
    float     Angle
);

 

이동 행렬 생성

XMMATRIX XM_CALLCONV XMMatrixTranslation(
    float OffsetX,
    float OffsetY,
    float OffsetZ
);

 

벡터의 성분들로 이동행렬 생성

XMMATRIX XM_CALLCONV XMMatrixTranslationFromVector(
    FXMVECTOR Offset
);

 

벡터 대 행렬 곱 $vM$. 점 변환을 위해 $v_w=1$로 둔다.

XMVECTOR XM_CALLCONV XMVector3TransformCoord(
    FXMVECTOR V,
    FXMMATRIX M
);

 

벡터 대 행렬 곱 $vM$. 벡터 변환을 위해 $v_w=0$ 으로 둔다.

XMVECTOR XM_CALLCONV XMVector3TransformNormal(
    FXMVECTOR V,
    FXMMATRIX M
);

 

마지막 두 함수 XMVector3TransfromCoord와 XMVector3TransformNormal 에서 프로그래머가 $w$성분을 직접 설정할 필요는 없다.

XMVector3TransformCoord는 항상 $v_w=1$을 사용하고

XMVector3TransformNormal은 항상 $v_w=0$을 사용한다.

 

 

Comments