Range tree 구현
본 자료는 미리보기를 지원하지 않습니다.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
해당 자료는 1페이지 까지만 미리보기를 제공합니다.
1페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

Range tree 구현에 대한 보고서 자료입니다.

목차

없음

본문내용

#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
#define AXIS_X 0
#define AXIS_Y 1
#define AXIS_Z 2
typedef struct POINT {
float x;
float y;
float z;
} POINT;
// tree node
typedef struct NODE {
struct POINT* pPivot;
struct NODE* pLeft;
struct NODE* pRight;
int axis;
} NODE;
void ClearNode(NODE* pNode) {
pNode->axis = AXIS_X;
pNode->pPivot = NULL;
pNode->pLeft = pNode->pRight = NULL;
}
void InsertToTree(NODE* pNode, POINT* pPoint) {
int bLeft = FALSE;
if(!pNode->pPivot) {
pNode->pPivot = pPoint;
return;
}
// decide where to move next
if(pNode->axis == AXIS_X) {
if(pPoint->x < pNode->pPivot->x) bLeft = TRUE;
else bLeft = FALSE;
}
else if(pNode->axis == AXIS_Y) {
if(pPoint->y < pNode->pPivot->y) bLeft = TRUE;
else bLeft = FALSE;
}
else if(pNode->axis == AXIS_Z) {
if(pPoint->z < pNode->pPivot->z) bLeft = TRUE;
else bLeft = FALSE;
}
if(bLeft == TRUE) {
if(pNode->pLeft) InsertToTree(pN

키워드

  • 가격3,000
  • 페이지수5페이지
  • 등록일2009.09.08
  • 저작시기2005.10
  • 파일형식기타(cpp)
  • 자료번호#551663
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니