Set a goal for the new year

1월 7, 2012 댓글 남기기

Goal #1 Hard Study!
- Programming
- Language study abroad
Goal #2. make 10 friends. (face to face)
- guru?? academy?? club?? meeting(like it :)??
Goal #3. Hibernation

카테고리:Programming

Google Code Hosting, Subversion, and TortoiseSVN

10월 29, 2011 댓글 남기기
카테고리:ETC.

유용한 사이트

8월 4, 2011 댓글 남기기
카테고리:Programming

Mathematics v Direct3DX

7월 27, 2011 댓글 남기기

http://mormegil.wz.cz/prog/3dref/D3DXmath.htm

  • Vector
    • D3DXVecNAdd(Out, V1, V2)
    • D3DXVecNBaryCentric(Out, V1, V2, V3, f, g)
    • D3DXVecNCatmullRom(Out, V1, V2, V3, V4, s)
    • D3DXVecNDot(U, V)
    • D3DXVecNHermite(Out, V1, T1, V2, T2, s)
    • D3DXVecNLength(V)
    • D3DXVecNLengthSq(V)
    • D3DXVecNLerp(Out, V1, V2, s)
    • D3DXVecNMaximize(Out, U, V)
    • D3DXVecNMinimize(Out, U, V)
    • D3DXVecNNormalize(Out, V)
    • D3DXVecNScale(Out, V, s)
    • D3DXVecNSubtract(Out, V1, V2)
  • 2D Vector
    • D3DXVec2CCW(U, V)
    • D3DXVec2Transform(Out, V, M)
    • D3DXVec2TransformCoord(Out, V, M)
    • D3DXVec2TransformNormal(Out, V, M)
  • 3D Vector
    • D3DXVec3Cross(Out, V1, V2)
    • D3DXVec3Project(Out, V, Viewport, Proj, View, World)
    • D3DXVec3Transform(Out, V, M)
    • D3DXVec3TransformCoord(Out, V, M)
    • D3DXVec3TransformNormal(Out, V, M)
    • D3DXVec3Unproject(Out, V, Viewport, Proj, View, World)
  • 4D Vector
    • D3DXVec4Cross(Out, U, V, W)
    • D3DXVec4Transform(Out, V, M)
  • Matice (4×4)
    • D3DXMatrixAffineTransformation(Out, s, c, r, t)
    • D3DXMatrixfDeterminant(M)
    • D3DXMatrixIdentity(Out)
    • D3DXMatrixInverse(Out, D, M)
    • D3DXMatrixIsIdentity(M)
    • D3DXMatrixLookAtRH(Out, Eye, At, Up)
    • D3DXMatrixLookAtLH(Out, Eye, At, Up)
    • D3DXMatrixMultiply(Out, M1, M2)
    • D3DXMatrixOrthoRH(Out, w, h, n, f)
    • D3DXMatrixOrthoLH(Out, w, h, n, f)
    • D3DXMatrixOrthoOffCenterRH(Out, l, r, t, b, n, f)
    • D3DXMatrixOrthoOffCenterLH(Out, l, r, t, b, n, f)
    • D3DXMatrixPerspectiveRH(Out, w, h, n, f)
    • D3DXMatrixPerspectiveLH(Out, w, h, n, f)
    • D3DXMatrixPerspectiveFovRH(Out, Fovy, Aspect, n, f)
    • D3DXMatrixPerspectiveFovLH(Out, Fovy, Aspect, n, f)
    • D3DXMatrixPerspectiveOffCenterRH(Out, l, r, t, b, n, f)
    • D3DXMatrixPerspectiveOffCenterLH(Out, l, r, t, b, n, f)
    • D3DXMatrixReflect(Out, Plane)
    • D3DXMatrixRotationAxis(Out, V, Angle)
    • D3DXMatrixRotationQuaternion(Out, Q)
    • D3DXMatrixRotationX(Out, Angle)
    • D3DXMatrixRotationY(Out, Angle)
    • D3DXMatrixRotationYawPitchRoll(Out, Yaw, Pitch, Roll)
    • D3DXMatrixRotationZ(Out, Angle)
    • D3DXMatrixScaling(Out, x, y, z)
    • D3DXMatrixShadow(Out, Light, Plane)
    • D3DXMatrixTransformation(Out, Scenter, Srot, Scaling, Rotcenter, Rot, Trans)
    • D3DXMatrixTranslation(A, -Scenterx, -Scentery, -Scenterz)
    • D3DXMatrixScaling(B, Scalingx, Scalingy, Scalingz)
    • D3DXMatrixRotationQuaternion(C, Srot)
    • D3DXMatrixTranslation(D, ux, uy, uz)
    • D3DXMatrixRotationQuaternion(E, Rot)
    • D3DXMatrixTranslation(F, vx, vy, vz)
    • D3DXMatrixTranslation(Out, x, y, z)
    • D3DXMatrixTranspose(Out, M)
  • Planes
    • D3DXPlaneDot(P, V)
    • D3DXPlaneDotCoord(P, V)
    • D3DXPlaneDotNormal(P, V)
    • D3DXPlaneIntersectLine(Out, P, U, V)
    • D3DXPlaneFromPointNormal(Out, P, N)
    • D3DXPlaneNormalize(Out, P)
    • D3DXPlaneFromPoints(Out, A, B, C)
    • D3DXPlaneTransform(Out, P, M)
카테고리:3D, BiTec, Programming

Quatemion

7월 13, 2011 댓글 남기기

Quatemion
– 4차원 벡터
q = w + xi + yj + zk
= (w, x, y, z) = (w, v) = (s, v)

– 벡터 v가 회전축을 표현하지만 정규화 되면서 sin(theta/2)로 비례 축소
– 정규화된 쿼터니언에서 w가 회전각 theta를 표현
w = cos(theta / 2)
x = Axis.x * sin(theta / 2)
y = Axis.y * sin(theta / 2)
z = Axis.z * sin(theta / 2)

ex)
(0, 0, 1) PI / 4

w = cos(PI / 4) = sqrt2 / 2
x = 0sin(PI / 4) = 0
y = 0sin(PI / 4) = 0
z = 1sin(PI / 4) = sqrt2 / 2

특징
i^2 = j^2 = k^2 = -1
ij = -ji = k
jk – -kj = i
ki = -ik = j
ij – k
ji = -k

1) Q1 + Q2
= (w1, v1) + (w2, v2)
= (w1+w2, v1+v2)
2) Q1 * Q2
= (w1, v1) * (w2, v2)
= (w1, x1i, y1j, z1k) * (w2, x2i, y2j, z2k)
= (w1*w2 – w1*x2 – y1*y2 – z1*z2) +
(x1*w2 – w1*x2 – z1*y2 – y1*z2)i +
(y1*w2 – w1*y2 – z1*x2 – x1*z2)j +
(z1*w2 – w1*z2 – y1*x2 – x1*y2)k

= (w1*w2 – v1(내적)v2 + v1(외적)v2 + w1*v2 + w2*v1)

3)단위 사원수
q =
= 0i + 0j + 0k + 1

4)켤레사원수(Conjugate)
q = s+v, var q = s-v
q*var q = var q*q = q(내적)q = ||q||^2 = q^2

5)역수
0!=q, q^-1 = var q / q^2

6)변환
– Axis Angle to Quatemion
Q = (cos(theta/2), v*sin(theta/2))
– Quatemion to Axis Angle
Theta = 2 * acos(w)
회전축 = v / sin(theta/2)
– Quatemion to Matrix
F(p) = Q * P * Q^-1
= M * P
M = 1 – 2y^2 – 2z^2, 2xy-2zw, 2xz+2yw
2xy+2zw, 1-2x^2, 2yz-2xw
2xz-2yw, 2yz+2xw, 1-2x^2-2y^2
– 회전행렬 -> 사원수
R = (r00, r01…)
w = 1/2sqrt(R00+R11+R22+1)
x = 1/4w(R32-R12)
y = 1/4w(R02-R20)
z = 1/4w(R10-R01)

회전
F(p) = Q * P * Q^-1
여러회전(F1->F2)
F(p) = Q * P * Q^-1
F1(p) = Q1 * P * Q1^-1
F2(p) = Q2 * P * Q2^-1
= Q2 * (Q1*P*Q1^-1)*Q2-1
= (Q2Q1)P(Q2Q1)^-1
보간법
– 기본선형보간
Lerp(t) = (1-t)Q1 + tQ2
장점 : 간단, 매끄럽게 보간
단점 : t가 일정비율이 아님
3차원공간에서 x^2+y^2+z^2=1인 점이 모이면 원구면형성
4차원은 w^2+x^2+y^2+z^2=1
– 구형보간
theta = cos^-1(q1dotq2)
q(t) = (sin(theta)(1-t) / sin(theta)) * q1 + (sin(theta)(t) / sin(theta)) * q2
장점 : 일정비율
단점 : 복잡

카테고리:Programming
팔로우

Get every new post delivered to your Inbox.