보호되어 있는 글입니다.
전체 글
* 깃허브: https://github.com/Ellie010707간단한 연결리스트를 구현했습니다. 단방향이라 중간 노드를 삭제할 때 앞 노드의 정보를 따로 찾아줬습니다. #include #include #include typedef struct Data{ int index; char name[20]; char phone[20]; }Data; typedef struct Node{ Data data; struct Node* Next; }Node; Node* create(Data data, int cnt) { Node* newnode = (Node*)malloc(sizeof(Node)*sizeof(Data)); newnode->data.index = cnt; strcpy(newnode->data.name, data.name); strcpy(newnode->data.phon..
def hanoi(n, from_pos, to_pos, aux_pos): if n == 1: print(from_pos,'->',to_pos) return hanoi(n-1, from_pos, aux_pos, to_pos) print(from_pos, '->', to_pos) #출력; 원반을 옮기는 순서 hanoi(n-1, aux_pos, to_pos, from_pos) hanoi(3,1,3,2)
directX를 이용해 라이브러리를 개발하던 중 z 축을 기준으로 회전하는 공식을 유도한 과정이다. 이 평면좌표 위의 두 선을 이 위치로 옮겼다 생각하자 좌표 두 개를 각각 (x, y), (x', y')라고 정해주면 알 수 있는 사실은 다음과 같다. 먼저 x'를 구해보자. x' = xcosθ - ysinθ y'를 구해보자 y' = xsinθ + ycosθ 구한 식은 행렬로 나타낼 수 있다. (수학에서의 행렬은 연립방정식을 풀기 위해 사용되지만 cpu graphics에서의 행렬은 변환의 목적으로 쓰인다.) 행렬은 인풋값과 아웃풋 값이 같아야 계산 가능하다. 그렇기에 나는 저 행렬을 3by 3 행렬로 인풋 값에 z값까지 받아오게끔 변형시켰다. (당연히 아웃풋도 z'까지 나온다.) [ X' ] [ cosθ -..