bool init_processing(cv::Mat* mat)
 {
     auto found_pespective = find_perspective(mat);
     if (found_pespective)
     {
         perspective = *found_pespective;
         birds_eye_transform(mat, perspective);
         if (Settings::normalizeLightning)
             normalizeLightning(mat, blur_i, intensity / 100.f);
         cv::Mat cannied_mat;
         cv::Canny(*mat, cannied_mat, thresh1, thresh2, 3);
         roadFollower = make_unique<roadfollower>(cannied_mat, mat->size().width / 2.f + centerDiff);
         return true;
     } else{
         cv::putText(*mat, "SEARCHING FOR STRAIGHT LANES...", POINT(50.f, mat->size().height / 3.f), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(0, 255, 0), 2);
         return false;
     }
 }
    static
    POINT closest_point_in_aff_subspace (const POINT &a, const POINT *b)
    {
        GaussSolver <NUM+1> gs;

        for (int i = 0; i != NUM; ++i) {
            for (int j = 0; j <= i; ++j) {
                double ip = inner (b[i], b[j]);
                gs.set_coeff (i, j, ip);
                gs.set_coeff (j, i, ip);
            }

            gs.set_coeff (i, NUM, 1.);
            gs.set_coeff (NUM, i, 1.);
            gs.set_right (i, inner (b[i], a));
        }

        gs.set_right (NUM, 1.);
        gs.set_coeff (NUM, NUM, 0.);
        gs.solve ();

        double x = 0., y = 0., z = 0.;

        for (int i = 0; i != NUM; ++i) {
            double co = gs.get_solution (i);
            int is_in_interior = (co >= 0. && co <= 1.);
            co *= is_in_interior;
            co /= is_in_interior;
            //std::cerr << co << std::endl;
            x += CGAL::to_double (b[i].x()) * co;
            y += CGAL::to_double (b[i].y()) * co;
            z += CGAL::to_double (b[i].z()) * co;
        }

        return POINT (x, y, z);
    }
예제 #3
0
quint32 getVertexIndex(Vertex v, quint32 size) {
	return POINT(v.layer, v.sector, v.index);
}
예제 #4
0
파일: Polygon.cpp 프로젝트: LANLhakel/FESTR
double Polygon::distance(const Grid &g, const Vector3d &w) const
{   // pmh_2014_1125
    const Vector3d d = w - POINT(0);
    const Vector3d n = normal(g);
    return d * n;
}
예제 #5
0
#include "m3_Input.h"

int		 m3_Input::mWheel		     = -7;
float    m3_Input::mUpPosition       = -0.5f;
POINT    m3_Input::mLastPosition     = POINT();
POINT    m3_Input::mCurrentPosition  = POINT();
POINT    m3_Input::mDeltaPosition    = POINT();
bool	 m3_Input::mRightClick   = false;
bool	 m3_Input::mRightDown	 = false;
bool	 m3_Input::mLeftClick	 = false;
bool	 m3_Input::mLeftDown	 = false;

bool	 m3_Input::enableLight	 = false;
bool	 m3_Input::enableNormal	 = false;
bool	 m3_Input::saveToObj	 = false;
int		 m3_Input::meshIndex = 0;
SDL_Event    m3_Input::event     = SDL_Event(); 

bool     m3_Input::ePressForward  = false;
bool     m3_Input::ePressBackward = false;
bool     m3_Input::ePressLeft     = false;
bool     m3_Input::ePressRight    = false;
bool     m3_Input::ePressRotateLeft  = false;
bool     m3_Input::ePressRotateRight = false;

bool	 m3_Input::exitEvent    	 = false;

void m3_Input::Update()
{
	while ( SDL_PollEvent(&event) )
	{ 
예제 #6
0
void GammaNemaCalc::convolutionFilter(GammaMatrix* pDataOut)
{
	static wxUint32 filter[] = {
		1, 2, 1,
		2, 4, 2,
		1, 2, 1 };

	//wxUint32* dataFiltered = new wxUint32[256*256]();

	for(wxUint32 y = 1; y <= 254; y++)
	{
		for(wxUint32 x = 1; x <= 254; x++)
		{
			if(m_pDataIn->matrix[POINT(x,y)])
			{
				pDataOut->matrix[POINT(x,y)] =  
					( filter[0] * m_pDataIn->matrix[POINT(x-1,y-1)]
					+ filter[1] * m_pDataIn->matrix[POINT(x  ,y-1)]
					+ filter[2] * m_pDataIn->matrix[POINT(x+1,y-1)]
					+ filter[3] * m_pDataIn->matrix[POINT(x-1,y  )]
					+ filter[4] * m_pDataIn->matrix[POINT(x  ,y  )]
					+ filter[5] * m_pDataIn->matrix[POINT(x+1,y  )]
					+ filter[6] * m_pDataIn->matrix[POINT(x-1,y+1)]
					+ filter[7] * m_pDataIn->matrix[POINT(x  ,y+1)]
					+ filter[8] * m_pDataIn->matrix[POINT(x+1,y+1)] )
					/
					( filter[0] * (0 != m_pDataIn->matrix[POINT(x-1,y-1)])
					+ filter[1] * (0 != m_pDataIn->matrix[POINT(x  ,y-1)])
					+ filter[2] * (0 != m_pDataIn->matrix[POINT(x+1,y-1)])
					+ filter[3] * (0 != m_pDataIn->matrix[POINT(x-1,y  )])
					+ filter[4] * (0 != m_pDataIn->matrix[POINT(x  ,y  )])
					+ filter[5] * (0 != m_pDataIn->matrix[POINT(x+1,y  )])
					+ filter[6] * (0 != m_pDataIn->matrix[POINT(x-1,y+1)])
					+ filter[7] * (0 != m_pDataIn->matrix[POINT(x  ,y+1)])
					+ filter[8] * (0 != m_pDataIn->matrix[POINT(x+1,y+1)]) );
			}
			else
			{
				pDataOut->matrix[POINT(x,y)] = 0;
			}
		}
	}
}
예제 #7
0
/*
 * Computes clusters' centroids.
 */
static void compute_centroids(void)
{
	int i, j;       /* Loop indexes.        */
	int population; /* Centroid population. */

	start = timer_get();
	
	memcpy(lcentroids, CENTROID(rank*(ncentroids/nprocs)), lncentroids[rank]*dimension*sizeof(float));
	memset(&has_changed[rank*NUM_THREADS], 0, NUM_THREADS*sizeof(int));
	memset(centroids, 0, (ncentroids + DELTA*nprocs)*dimension*sizeof(float));
	memset(ppopulation, 0, (ncentroids + nprocs*DELTA)*sizeof(int));

	/* Compute partial centroids. */
	#pragma omp parallel for schedule(static) default(shared) private(i, j)
	for (i = 0; i < lnpoints; i++)
	{
		j = map[i]%NUM_THREADS;
		
		omp_set_lock(&lock[j]);
		
		vector_add(CENTROID(map[i]), POINT(i));
			
		ppopulation[map[i]]++;
		
		omp_unset_lock(&lock[j]);
	}
	
	end = timer_get();
	total += timer_diff(start, end);
	
	sync_pcentroids();

	sync_ppopulation();
	
	start = timer_get();

	/* Compute centroids. */
	#pragma omp parallel for schedule(static) default(shared) private(i, j, population)
	for (j = 0; j < lncentroids[rank]; j++)
	{
		population = 0;
		
		for (i = 0; i < nprocs; i++)
		{
			if (*POPULATION(i, j) == 0)
				continue;
			
			population += *POPULATION(i, j);
			
			if (i == rank)
				continue;
			
			vector_add(PCENTROID(rank, j), PCENTROID(i, j));
		}
		
		if (population > 1)
			vector_mult(PCENTROID(rank, j), 1.0/population);
		
		/* Cluster mean has changed. */
		if (!vector_equal(PCENTROID(rank, j), LCENTROID(j)))
		{
			has_changed[rank*NUM_THREADS + omp_get_thread_num()] = 1;
			vector_assign(LCENTROID(j), PCENTROID(rank, j));
		}
	}
	
	end = timer_get();
	total += timer_diff(start, end);
		
	sync_centroids();
		
	sync_status();
}
예제 #8
0
IWindow::IWindow(HWND hWnd)
{
	DWORD dwError = 0;
	this->hWnd = hWnd;

	if(hWnd == 0)
	{
		hWndRoot = 0;
		hWndParent = 0;

		wndText = new TCHAR[1]; 
		wndText[0] = _T('\0');

		wndInfo = WINDOWINFO();
		// _tprintf(_T("wndInfo.cbSize = %i\n"), wndInfo.cbSize);
		// _tprintf(_T("wndInfo.dwStyle = %i\n"), wndInfo.dwStyle);

		wndWidth = 0;
		wndHeight = 0;
		wndPos = POINT();
		wndID = 0;

		className = new TCHAR[1];
		className[0] = _T('\0');
		realClassName = new TCHAR[1];
		realClassName[0] = _T('\0');

		dwThreadID = 0;
		dwProcessID = 0;
		hWndDC = NULL;
	    hBufferDC = NULL;
	    hWndBitmap = NULL;
	    hWndBitmap = NULL;
		return;
	}

	hWndRoot   = GetAncestor(hWnd, GA_ROOT);
	hWndParent = GetAncestor(hWnd, GA_PARENT);
	
	// _tprintf(_T("hWndRoot = 0x%08X\n"), hWndRoot);
	// _tprintf(_T("hWndParent = 0x%X\n"), hWndParent);

	int strLen = (int)SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0) + 1;
    // _tprintf(_T("dwBuffSize = %i\n"), dwBuffSize);

	wndText = new TCHAR[strLen]; 
	SendMessage(hWnd, WM_GETTEXT, strLen, (LPARAM)wndText);

	wndInfo.cbSize = sizeof(WINDOWINFO);
	GetWindowInfo(hWnd, &wndInfo);

	GetWindowRect(hWnd, &wndRect);
	wndWidth  = wndRect.right - wndRect.left;
	wndHeight = wndRect.bottom - wndRect.top;

    if(hWndRoot == hWnd)
    {
	    wndPos.x  = wndRect.left;
	    wndPos.y  = wndRect.top;
    }
    else
    {
        WINDOWINFO rootWndInfo = {sizeof(WINDOWINFO)};
        GetWindowInfo(hWndRoot, &rootWndInfo);
        wndPos.x  = wndRect.left - rootWndInfo.rcClient.left;
        wndPos.y  = wndRect.top - rootWndInfo.rcClient.top;
    }

	wndID  = GetWindowLong(hWnd, GWL_ID);
	
	className = new TCHAR[MAX_WND_CLASSNAME + 1];
	if(!GetClassName(hWnd, className, MAX_WND_CLASSNAME + 1))
	{
		dwError = GetLastError();
		_tprintf(_T("GetClassName: dwError = %i \n"), dwError);

	    className[0] = _T('\0');
	}

	realClassName = new TCHAR[MAX_WND_CLASSNAME + 1];
	if(!RealGetWindowClass(hWnd, realClassName, MAX_WND_CLASSNAME + 1))
	{
		dwError = GetLastError();
		_tprintf(_T("RealGetWindowClass: dwError = %i \n"), dwError);

	    realClassName[0] = _T('\0');
	}

	// _tprintf(_T("realClassNameLen = %i\n"), realClassNameLen);
	// _tprintf(_T("RealGetWindowClass: realClassName = 0x%X\n"), realClassName);

	dwThreadID = GetWindowThreadProcessId(hWnd, &dwProcessID);

}
//Main Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
	switch (message)
	{
	case WM_SYSKEYDOWN:
		{
			if (lParam & 1<<29)
			{
				WWDPhysics->m_modifierKeys = VK_LMENU;
			}
			break;
		}
	case WM_SYSKEYUP:
		{
			if (lParam & 1<<29)
			{
				WWDPhysics->m_modifierKeys = VK_LMENU;
			} else
			{
				WWDPhysics->m_modifierKeys = 0;
			}

			break;
		}

	case WM_SIZE:													// Size Action Has Taken Place

		switch (wParam)											// Evaluate Size Action
		{
		case SIZE_MINIMIZED:									// Was Window Minimized?
			return 0;												// Return

		case SIZE_MAXIMIZED:
			{									// Was Window Maximized?
				int Width = LOWORD (lParam);
				int Height = HIWORD (lParam);
				calcSizes(HIWORD (lParam),LOWORD (lParam));

				MoveWindow(hWndList,0,0,listWidth,listHeight,true);
				MoveWindow(blank,listWidth,bAreaHeight,simWidth,simHeight,true);

				if (sOpenGLInitialized)
				{
					WWDPhysics->reshape(simWidth,simHeight);
				}
			}
			return 0;												// Return

			//resize
		case SIZE_RESTORED:// Was Window Restored?
			if(hwnd == hWnd)
			{
				int Width = LOWORD (lParam);
				int Height = HIWORD (lParam);
				calcSizes(HIWORD (lParam),LOWORD (lParam));

				MoveWindow(hWndList,0,0,listWidth,listHeight,true);
				MoveWindow(blank,listWidth,bAreaHeight,simWidth,simHeight,true);

				if (sOpenGLInitialized){
					WWDPhysics->reshape(simWidth,simHeight);
				}
			}
			return 0;												// Return
		}
		break;

	case WM_CREATE:
		{
		}

		return 0;

	case WM_MBUTTONUP:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseFunc(1,1,xPos,yPos);
			POINT p = POINT();
			p.x=xPos; p.y=yPos;
			SetFocus(ChildWindowFromPoint(hwnd,p));
			break;
		}
	case WM_MBUTTONDOWN:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseFunc(1,0,xPos,yPos);
			POINT p = POINT();
			p.x=xPos; p.y=yPos;
			SetFocus(ChildWindowFromPoint(hwnd,p));
			break;
		}

	case WM_LBUTTONUP:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseFunc(0,1,xPos,yPos);
			POINT p = POINT();
			p.x=xPos; p.y=yPos;
			SetFocus(ChildWindowFromPoint(hwnd,p));
			break;
		}
	case 0x020A://WM_MOUSEWHEEL:
		{
			int zDelta = (short)HIWORD(wParam);
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			if (zDelta>0)
				WWDPhysics->zoomIn();
			else
				WWDPhysics->zoomOut();
			break;
		}

	case WM_MOUSEMOVE:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseMotionFunc(xPos,yPos);
			break;
		}
	case WM_RBUTTONUP:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseFunc(2,1,xPos,yPos);
			POINT p = POINT();
			p.x=xPos; p.y=yPos;
			SetFocus(ChildWindowFromPoint(hwnd,p));
			break;
		}
	case WM_RBUTTONDOWN:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseFunc(2,0,xPos,yPos);
			POINT p = POINT();
			p.x=xPos; p.y=yPos;
			SetFocus(ChildWindowFromPoint(hwnd,p));
			break;
		}
	case WM_LBUTTONDOWN:
		{
			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			WWDPhysics->mouseFunc(0,0,xPos,yPos);
			POINT p = POINT();
			p.x=xPos; p.y=yPos;
			SetFocus(ChildWindowFromPoint(hwnd,p));
			break;
		}

	case WM_CONTEXTMENU:
		{
			POINT p;
			GetCursorPos(&p);
			ScreenToClient(hWndList,&p);
			int index = SendMessage(hWndList,LB_ITEMFROMPOINT,0, MAKELPARAM(p.x,p.y));

			int noElements = SendMessage(hWndList,LB_GETCOUNT,0,0);
			if(0<=index && index <noElements){
				popupMenuSel=index;

				HMENU popupMenu = CreatePopupMenu();
				InsertMenu(popupMenu,0,MF_BYPOSITION|MF_STRING,IDC_RUN_MBUTTON,"Run");
				InsertMenu(popupMenu,0,MF_BYPOSITION|MF_STRING,IDC_RENAME_MBUTTON,"Rename");
				InsertMenu(popupMenu,0,MF_BYPOSITION|MF_STRING,IDC_DELETE_MBUTTON,"Delete");
#ifdef _DEBUG
				InsertMenu(popupMenu,0,MF_BYPOSITION|MF_STRING,IDC_SHOWDNA_MBUTTON,"Show DNA");
#endif
				GetCursorPos(&p);
				TrackPopupMenu(popupMenu,TPM_TOPALIGN|TPM_LEFTALIGN,p.x,p.y,0,hwnd,NULL);
			}

			break;}

	case WM_CLOSE:
		PostQuitMessage( 0 );
		return 0;

	case WM_DESTROY:
		return 0;

	case WM_KEYUP:
		switch ( wParam )
		{
		case VK_PRIOR:
		case VK_NEXT:
		case VK_END:
		case VK_HOME:
		case VK_LEFT:
		case VK_UP:
		case VK_RIGHT:
		case VK_DOWN:
			{
				if (WWDPhysics)
					WWDPhysics->specialKeyboardUp(wParam,0,0);
				return 0;
			}
		default:
			{
				WWDPhysics->keyboardUpCallback(tolower(wParam),0,0);
			}
			return DefWindowProc( hwnd, message, wParam, lParam );
		}

	case WM_KEYDOWN:
		switch ( wParam )
		{
		case VK_CONTROL:
		case VK_PRIOR:
		case VK_NEXT:
		case VK_END:
		case VK_HOME:
		case VK_LEFT:
		case VK_UP:
		case VK_RIGHT:
		case VK_DOWN:
			{
				if (WWDPhysics)
					WWDPhysics->specialKeyboard(wParam,0,0);
				break;
			}

		case ' ':
			{
				if (WWDPhysics)
					//WWDPhysics->clientResetScene();
						if(saves.size()>0){
							SendMessage(hWnd,WM_COMMAND,MAKEWPARAM(IDC_LISTBOX,LBN_SELCHANGE),0);
						}
						break;
			}
		case 'Q':
		case VK_ESCAPE:
			{
				quitRequest = 1;
				PostQuitMessage(0);
			}
			return 0;
		}
		return 0;

	case WM_CHAR:
		if (!quitRequest)
			WWDPhysics->keyboardCallback(wParam,0,0);
		break;

	case WM_COMMAND:
		switch(LOWORD(wParam)){
		case IDC_VIEW_CHECKBOX:
			{
				HWND check = GetDlgItem(hwnd, IDC_VIEW_CHECKBOX);
				switch (SendMessage(check, BM_GETCHECK, 0,0))
				{
				case BST_CHECKED:
					SendMessage(check, BM_SETCHECK, BST_UNCHECKED,0);
					fixedSteps=false;
#ifdef _DEBUG
					printf("off\n");
#endif
					break;

				case BST_UNCHECKED:
					SendMessage(check, BM_SETCHECK, BST_CHECKED,0);
					fixedSteps=true;
#ifdef _DEBUG
					printf("on\n");
#endif
					break;
				}
			}
			break;

		case IDC_FITNESSTYPE_COMBOBOX:
			switch (HIWORD(wParam)){
			case CBN_SELCHANGE:
				HWND hwndfit = GetDlgItem(hwnd, IDC_FITNESSTYPE_COMBOBOX);
				int index = SendMessage(hwndfit, CB_GETCURSEL,0,0);
				fitnessTest tmptest=(fitnessTest) SendMessage(hwndfit,CB_GETITEMDATA, index,0);
				WWDPhysics->clearFitnessFunctions();
				WWDPhysics->addFitnessFunction(tmptest,1);
				break;
			}

			break;

		case IDC_LISTBOX:
			{
				switch (HIWORD(wParam)){
				case LBN_SELCHANGE:
					{
						HWND hwndList = GetDlgItem(hwnd, IDC_LISTBOX);

						// Get selected index.
						int index = (int)SendMessage(hwndList, LB_GETCURSEL, 0, 0);

						delete WWDPhysics;

						WWDPhysics = new Physics();
						SendMessage(hWnd,WM_COMMAND,MAKEWPARAM(IDC_FITNESSTYPE_COMBOBOX,LBN_SELCHANGE),0);
						readDNA(&saves.at(index)->dna,WWDPhysics);
						WWDPhysics->runSimStartUp();
						WWDPhysics->reshape(simWidth,simHeight);
					}
				}
			}
			break;
		case IDC_RESET_BUTTON:
			{
				if(saves.size()>0){
					SendMessage(hWnd,WM_COMMAND,MAKEWPARAM(IDC_LISTBOX,LBN_SELCHANGE),0);
				}
			}
			break;
		case IDC_RUN_BUTTON:
			{
				HWND hwndList = GetDlgItem(hwnd, IDC_LISTBOX);

				_ASSERTE(hwndList != NULL);

				// Get current selection index in listbox
				int itemIndex = (int) SendMessage(hwndList, LB_GETCURSEL, (WPARAM)0, (LPARAM) 0);
				if (itemIndex == LB_ERR)
				{
					// No selection
					return 0;
				}

				//threads
				SYSTEM_INFO sysinfo;
				GetSystemInfo( &sysinfo );

				int numCores= sysinfo.dwNumberOfProcessors;

				int pop =0;
				HWND hwndPop = GetDlgItem(hwnd, IDC_POP_EDIT);

				_ASSERTE(hwndPop != NULL);

				int length=0;

				length = GetWindowTextLength(hwndPop);

				if(length > 0){
					TCHAR * text = new TCHAR[length + 1];
					GetWindowText(hwndPop,text,length+1);
					for(int i =0; i<length;i++){
						int value = ((int)text[i])-48;
						int res =  (value* pow(10.,length-1-i)+0.5);
						pop+=res;
					}
					delete text;
				}else{
					MessageBox(NULL, "No populastion size selected", TEXT("ERROR"), MB_OK | MB_ICONERROR);
					return 0;
				}
				if(pop<10){
					MessageBox(NULL, "the Populasion size is to small", TEXT("ERROR"), MB_OK | MB_ICONERROR);
					return 0;
				}

				int noG = 0;
				HWND hwndNoG = GetDlgItem(hwnd, IDC_NOG_EDIT);

				_ASSERTE(hwndNoG != NULL);

				length=0;

				length = GetWindowTextLength(hwndNoG);
				if(length > 0){
					TCHAR * text = new TCHAR[length + 1];
					GetWindowText(hwndNoG,text,length+1);
					for(int i =0; i<length;i++){
						int value = ((int)text[i])-48;
						int res =  (value* pow(10.,length-1-i)+0.5);
						noG+=res;
					}
					delete text;
				}else{
					MessageBox(NULL, "No number of generations selected", TEXT("ERROR"), MB_OK | MB_ICONERROR);
					return 0;
				}

				HWND hwndfit = GetDlgItem(hwnd, IDC_FITNESSTYPE_COMBOBOX);
				int index = SendMessage(hwndfit, CB_GETCURSEL,0,0);
				fitnessTest tmptest=(fitnessTest) SendMessage(hwndfit,CB_GETITEMDATA, index,0);

				noGenerations=noG;
				argumentList* aList = new argumentList();
				aList->nC=numCores;
				aList->p=pop;
				aList->nG=noG;
				aList->iI=itemIndex;
				aList->stopSim=&stopSim;
				aList->type=tmptest;
				aList->theResult = new creature();

				proInfo = new progressInfo();

				HANDLE threadHandle = (HANDLE) _beginthreadex(0,0,&runServer,(void*)aList,0,0);

				UINT_PTR time = SetTimer(0,0,10,(TIMERPROC)&update);
				DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PROGRESS), hwnd, progressControll,(LPARAM)&noG);
				KillTimer(0,time);

				save* tmpCreature =new save();
				tmpCreature->dna= aList->theResult->dna;
				tmpCreature->fitness=aList->theResult->fitness;

				delete proInfo;
				delete aList->theResult;
				delete aList;

				DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_NAMING), hwnd, namingControl,(LPARAM)&tmpCreature->name);

				saves.push_back(tmpCreature);
				SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)saves.at(saves.size()-1)->name.c_str());
				SendMessage(hWndList,LB_SETCURSEL,saves.size()-1,0);
				delete WWDPhysics;

				WWDPhysics = new Physics();
				WWDPhysics->addFitnessFunction(tmptest,1);
				readDNA(&saves.at(saves.size()-1)->dna,WWDPhysics);
				WWDPhysics->runSimStartUp();
				WWDPhysics->reshape(simWidth,simHeight);
			}
			break;

		case IDC_RUN_MBUTTON:
			{
				HWND hwndList = GetDlgItem(hwnd, IDC_LISTBOX);
				SendMessage(hwndList,LB_SETCURSEL,popupMenuSel,0);

				SendMessage(hWnd,WM_COMMAND, MAKEWPARAM(IDC_RUN_BUTTON,0),0);
			}

			break;
		case IDC_RENAME_MBUTTON:
			{
				DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_NAMING), hwnd, namingControl,(LPARAM)&saves.at(popupMenuSel)->name);
				HWND hwndList = GetDlgItem(hwnd, IDC_LISTBOX);
				int itemIndex = (int) SendMessage(hwndList, LB_GETCURSEL, (WPARAM)0, (LPARAM) 0);
				for(int i =0; i<saves.size();i++){
					SendMessage(hwndList,LB_DELETESTRING,0,0);
				}
				for(int i =0; i<saves.size();i++){
					SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)saves.at(i)->name.c_str());
				}

				SendMessage(hwndList,LB_SETCURSEL,itemIndex,0);
			}
			break;
		case IDC_DELETE_MBUTTON:
			{
				HWND hwndList = GetDlgItem(hwnd, IDC_LISTBOX);
				int itemIndex = (int) SendMessage(hwndList, LB_GETCURSEL, (WPARAM)0, (LPARAM) 0);

				SendMessage(hwndList,LB_DELETESTRING,popupMenuSel,0);
				delete saves.at(popupMenuSel);
				saves.erase(saves.begin()+popupMenuSel,saves.begin()+popupMenuSel+1);

				if(itemIndex==popupMenuSel){
					if(saves.size() > 0){
						if(itemIndex==saves.size()){
							itemIndex--;
						}
						SendMessage(hwndList,LB_SETCURSEL,itemIndex,0);
						SendMessage(hWnd,WM_COMMAND,MAKEWPARAM(IDC_LISTBOX,LBN_SELCHANGE),0);
					}else{
						delete WWDPhysics;
						WWDPhysics=new Physics();
						WWDPhysics->reshape(simWidth,simHeight);
					}
				}
			}
			break;
		case IDC_SHOWDNA_MBUTTON:
			{
#ifdef _DEBUG
				HWND hwndList = GetDlgItem(hwnd, IDC_LISTBOX);

				printf("DNA of %s\n",saves.at(popupMenuSel)->name.c_str());
				for(int i=0; i<saves.at(popupMenuSel)->dna.size();i++){
					printf("%d, ", saves.at(popupMenuSel)->dna.at(i));
				}
				printf("\n");
#endif
			}
			break;
		case ID_FILE_NEW40002:

			randomCreature();
			while( (WWDPhysics->noBoxes<2) || (!WWDPhysics->runSimStartUp())  ){
				{//deleting
					int itemIndex = (int) SendMessage(hWndList, LB_GETCURSEL, (WPARAM)0, (LPARAM) 0);
					SendMessage(hWndList,LB_DELETESTRING,itemIndex,0);
					delete saves.at(itemIndex);
					saves.erase(saves.begin()+itemIndex,saves.begin()+itemIndex+1);
				}
				randomCreature();
			}
			break;

		case ID_FILE_SAVE40003:

			saveSaves(saves);
			break;

		case ID_FILE_EXIT:
			PostQuitMessage( 0 );

			break;
		case ID_VIDEO_CAPTURE:
			if(VFWInit()){
				captureVideo(hDC);
				MessageBox(hwnd, "Video Captured", TEXT("DONE"), MB_OK | MB_ICONINFORMATION);
			}else{
				MessageBox(hwnd, "Video Capture failed to start\n Try another codec", TEXT("ERROR"), MB_OK | MB_ICONERROR);
			}
			SendMessage(hWnd,WM_COMMAND,MAKEWPARAM(IDC_LISTBOX,LBN_SELCHANGE),0);
			break;
#ifdef _DEBUG
		default:

			printf("");
#endif
		}
		break;

	default:
		return DefWindowProc( hwnd, message, wParam, lParam );
	}
	return 0;
}
예제 #10
0
파일: polyfill.c 프로젝트: johan/pike
static INLINE struct vertex *polyfill_add(struct vertex **top,
        struct array *a,
        int arg,
        char* what)
{
    struct vertex *first,*last,*cur = NULL;
    int n;

    if( (a->type_field & ~(BIT_INT|BIT_FLOAT)) &&
            (array_fix_type_field(a) & ~(BIT_INT|BIT_FLOAT)) ) {
        polyfill_free(*top);
        Pike_error("Illegal argument %d to %s. %d Expected array(float|int).\n",arg,what, a->type_field);
        return NULL;
    }

    if (a->size<6)
    {
        return *top;
#if 0
        polyfill_free(*top);
        Pike_error("Illegal argument %d to %s, too few vertices (min 3)\n", arg, what);
        return NULL; /* no polygon with less then tree corners */
#endif
    }

#define POINT(A,N) (((A)->item[N].type==T_FLOAT)?((A)->item[N].u.float_number):((FLOAT_TYPE)((A)->item[N].u.integer)))

    last = first = vertex_new(DO_NOT_WARN(POINT(a,0)),
                              DO_NOT_WARN(POINT(a,1)),
                              top);

    if (!last) {
        return NULL;
    }

    for (n=2; n+1<a->size; n+=2)
    {
        cur = vertex_new(DO_NOT_WARN(POINT(a,n)),
                         DO_NOT_WARN(POINT(a,n+1)),
                         top);
        if (!cur) {
            return NULL;
        }
        if (cur->y<last->y)
            vertex_connect(cur,last);
        else if (cur->y>last->y)
            vertex_connect(last,cur);
        else if (cur->x<last->x)
            vertex_connect(cur,last);
        else
            vertex_connect(last,cur);

        last=cur;
    }

    if (cur->y<first->y)
        vertex_connect(cur,first);
    else if (cur->y>first->y)
        vertex_connect(first,cur);
    else if (cur->x<first->x)
        vertex_connect(cur,first);
    else
        vertex_connect(first,cur);

    return *top;
}
예제 #11
0
CAMERA::CAMERA()  : center(POINT(0.0f)), lookat(VECTOR3(0.0f)), fov(45.0f)
{
}
예제 #12
0
POINT SPIN::Bounce( POINT &pt )
{
    return POINT( pt.y, -pt.x );
}
예제 #13
0
POINT HARD::Bounce( POINT &pt )
{
    return POINT( -pt.x, -pt.y );
}
예제 #14
0
static void
make_gasket (logo_configuration *dc, int wire)
{
  int i;
  int points_size;
  int npoints = 0;
  int nctrls = 0;
  int res = 360/8;
  GLfloat d2r = M_PI / 180;

  GLfloat thick2 = (dc->gasket_thickness / dc->gasket_size) / 2;

  GLfloat *pointsx0, *pointsy0, *pointsx1, *pointsy1, *normals;

  GLfloat r0  = 0.780;  /* 395 */
  GLfloat r1a = 0.855;                /* top of wall below upper left hole */
  GLfloat r1b = 0.890;                /* center of upper left hole */
  GLfloat r1c = 0.922;                /* bottom of wall above hole */
  GLfloat r1  = 0.928;  /* 471 */
  GLfloat r2  = 0.966;  /* 490 */
  GLfloat r3  = 0.984;  /* 499 */
  GLfloat r4  = 1.000;  /* 507 */
  GLfloat r5  = 1.090;  /* 553 */

  GLfloat ctrl_r[100], ctrl_th[100];

  glPushMatrix();

# define POINT(r,th) \
    ctrl_r [nctrls] = r, \
    ctrl_th[nctrls] = (th * d2r), \
    nctrls++

  POINT (0.829, 0);      /* top indentation, right half */
  POINT (0.831, 0.85);
  POINT (0.835, 1.81);
  POINT (0.841, 2.65);
  POINT (0.851, 3.30);
  POINT (0.862, 3.81);
  POINT (0.872, 3.95);

  POINT (r4,    4.0);   /* moving clockwise... */
  POINT (r4,   48.2);
  POINT (r1,   48.2);
  POINT (r1,   54.2);
  POINT (r2,   55.8);
  POINT (r2,   73.2);
  POINT (r1,   74.8);
  POINT (r1,  101.2);
  POINT (r3,  103.4);
  POINT (r3,  132.0);
  POINT (r1,  133.4);

  POINT (r1,  180.7);
  POINT (r2,  183.6);
  POINT (r2,  209.8);
  POINT (r1,  211.0);
  POINT (r1,  221.8);
  POINT (r5,  221.8);
  POINT (r5,  223.2);
  POINT (r4,  223.2);

  POINT (r4,  316.8);      /* upper left indentation */
  POINT (0.990, 326.87);
  POINT (0.880, 327.21);
  POINT (0.872, 327.45);
  POINT (0.869, 327.80);
  POINT (0.867, 328.10);

  POINT (0.867, 328.85);
  POINT (0.869, 329.15);
  POINT (0.872, 329.50);
  POINT (0.880, 329.74);
  POINT (0.990, 330.08);

  POINT (r4,  339.0);
  if (! wire)
    {
      POINT (r1a, 339.0);      /* cut-out disc */
      POINT (r1a, 343.0);
    }
  POINT (r4,  343.0);
  POINT (r4,  356.0);

  POINT (0.872, 356.05);   /* top indentation, left half */
  POINT (0.862, 356.19);
  POINT (0.851, 356.70);
  POINT (0.841, 357.35);
  POINT (0.835, 358.19);
  POINT (0.831, 359.15);
  POINT (0.829, 360);
# undef POINT

  points_size = res + (nctrls * 2);
  pointsx0 = (GLfloat *) malloc (points_size * sizeof(GLfloat));
  pointsy0 = (GLfloat *) malloc (points_size * sizeof(GLfloat));
  pointsx1 = (GLfloat *) malloc (points_size * sizeof(GLfloat));
  pointsy1 = (GLfloat *) malloc (points_size * sizeof(GLfloat));
  normals  = (GLfloat *) malloc (points_size * sizeof(GLfloat) * 2);

  npoints = 0;
  for (i = 1; i < nctrls; i++)
    {
      GLfloat from_r  = ctrl_r [i-1];
      GLfloat from_th = ctrl_th[i-1];
      GLfloat to_r    = ctrl_r [i];
      GLfloat to_th   = ctrl_th[i];

      GLfloat step = 2*M_PI / res;
      int nsteps = 1 + ((to_th - from_th) / step);
      int j;

      for (j = 0; j < nsteps + (i == nctrls-1); j++)
        {
          GLfloat r  = from_r  + (j * (to_r  - from_r)  / nsteps);
          GLfloat th = from_th + (j * (to_th - from_th) / nsteps);

          GLfloat cth = cos(th) * dc->gasket_size;
          GLfloat sth = sin(th) * dc->gasket_size;

          pointsx0[npoints] = r0 * cth;  /* inner ring */
          pointsy0[npoints] = r0 * sth;
          pointsx1[npoints] = r  * cth;  /* outer ring */
          pointsy1[npoints] = r  * sth;
          npoints++;

          if (npoints >= points_size) abort();
        }
    }

  /* normals for the outer ring */
  for (i = 1; i < npoints; i++)
    {
      XYZ a, b, c, n;
      a.x = pointsx1[i-1];
      a.y = pointsy1[i-1];
      a.z = 0;
      b.x = pointsx1[i];
      b.y = pointsy1[i];
      b.z = 0;
      c = b;
      c.z = 1;
      n = calc_normal (a, b, c);
      normals[(i-1)*2  ] = n.x;
      normals[(i-1)*2+1] = n.y;
    }

  glRotatef(-90, 0, 1, 0);
  glRotatef(180, 0, 0, 1);

  if (wire)
    {
      GLfloat z;
      for (z = -thick2; z <= thick2; z += thick2*2)
        {
# if 1
          /* inside edge */
          glBegin (GL_LINE_LOOP);
          for (i = 0; i < npoints; i++)
            glVertex3f (pointsx0[i], pointsy0[i], z);
          glEnd();

          /* outside edge */
          glBegin (GL_LINE_LOOP);
          for (i = 0; i < npoints; i++)
            glVertex3f (pointsx1[i], pointsy1[i], z);
          glEnd();
# else
          for (i = 1; i < npoints; i++)
            {
              glBegin (GL_LINE_STRIP);
              glVertex3f (pointsx0[i-1], pointsy0[i-1], z);
              glVertex3f (pointsx0[i  ], pointsy0[i  ], z);
              glVertex3f (pointsx1[i  ], pointsy1[i  ], z);
              glVertex3f (pointsx1[i-1], pointsy1[i-1], z);
              glEnd();
            }
# endif
        }
#if 1
      glBegin (GL_LINES);
      for (i = 0; i < npoints; i++)
        {
          /* inside rim */
          glVertex3f (pointsx0[i], pointsy0[i], -thick2);
          glVertex3f (pointsx0[i], pointsy0[i],  thick2);
          /* outside rim */
          glVertex3f (pointsx1[i], pointsy1[i], -thick2);
          glVertex3f (pointsx1[i], pointsy1[i],  thick2);
        }
      glEnd();
#endif
    }
  else
    {
      /* top */
      glFrontFace(GL_CW);
      glNormal3f(0, 0, -1);
      glBegin (GL_QUAD_STRIP);
      for (i = 0; i < npoints; i++)
        {
          glVertex3f (pointsx0[i], pointsy0[i], -thick2);
          glVertex3f (pointsx1[i], pointsy1[i], -thick2);
        }
      glEnd();

      /* bottom */
      glFrontFace(GL_CCW);
      glNormal3f(0, 0, 1);
      glBegin (GL_QUAD_STRIP);
      for (i = 0; i < npoints; i++)
        {
          glVertex3f (pointsx0[i], pointsy0[i], thick2);
          glVertex3f (pointsx1[i], pointsy1[i], thick2);
        }
      glEnd();

      /* inside edge */
      glFrontFace(GL_CW);
      glBegin (GL_QUAD_STRIP);
      for (i = 0; i < npoints; i++)
        {
          glNormal3f (-pointsx0[i], -pointsy0[i],  0);
          glVertex3f ( pointsx0[i],  pointsy0[i],  thick2);
          glVertex3f ( pointsx0[i],  pointsy0[i], -thick2);
        }
      glEnd();

      /* outside edge */
      glFrontFace(GL_CCW);
      glBegin (GL_QUADS);
      {
        for (i = 0; i < npoints-1; i++)
          {
            int ia = (i == 0 ? npoints-2 : i-1);
            int iz = (i == npoints-2 ? 0 : i+1);
            GLfloat  x = pointsx1[i];
            GLfloat  y = pointsy1[i];
            GLfloat xz = pointsx1[iz];
            GLfloat yz = pointsy1[iz];

            GLfloat nxa = normals[ia*2];   /* normal of [i-1 - i] face */
            GLfloat nya = normals[ia*2+1];
            GLfloat nx  = normals[i*2];    /* normal of [i - i+1] face */
            GLfloat ny  = normals[i*2+1];
            GLfloat nxz = normals[iz*2];    /* normal of [i+1 - i+2] face */
            GLfloat nyz = normals[iz*2+1];

            GLfloat anglea = vector_angle (nx, ny, 0, nxa, nya, 0);
            GLfloat anglez = vector_angle (nx, ny, 0, nxz, nyz, 0);
            GLfloat pointy = 0.005;

            if (anglea > pointy)
              {
                glNormal3f (nx, ny, 0);
                glVertex3f (x,  y,   thick2);
                glVertex3f (x,  y,  -thick2);
              }
            else
              {
                glNormal3f ((nxa + nx) / 2, (nya + ny) / 2, 0);
                glVertex3f (x,  y,   thick2);
                glVertex3f (x,  y,  -thick2);
              }

            if (anglez > pointy)
              {
                glNormal3f (nx, ny, 0);
                glVertex3f (xz, yz, -thick2);
                glVertex3f (xz, yz,  thick2);
              }
            else
              {
                glNormal3f ((nx + nxz) / 2, (ny + nyz) / 2, 0);
                glVertex3f (xz, yz, -thick2);
                glVertex3f (xz, yz,  thick2);
              }
          }
      }
      glEnd();
    }

  /* Fill in the upper left hole...
   */
  {
    GLfloat th;
    npoints = 0;

    th = 339.0 * d2r;
    pointsx0[npoints] = r1c * cos(th) * dc->gasket_size;
    pointsy0[npoints] = r1c * sin(th) * dc->gasket_size;
    npoints++;
    pointsx0[npoints] = r4 * cos(th) * dc->gasket_size;
    pointsy0[npoints] = r4 * sin(th) * dc->gasket_size;
    npoints++;

    th = 343.0 * d2r;
    pointsx0[npoints] = r1c * cos(th) * dc->gasket_size;
    pointsy0[npoints] = r1c * sin(th) * dc->gasket_size;
    npoints++;
    pointsx0[npoints] = r4 * cos(th) * dc->gasket_size;
    pointsy0[npoints] = r4 * sin(th) * dc->gasket_size;
    npoints++;

    if (! wire)
      {
        /* front wall */
        glNormal3f (0, 0, -1);
        glFrontFace(GL_CW);
        glBegin (wire ? GL_LINE_LOOP : GL_QUADS);
        glVertex3f (pointsx0[0], pointsy0[0], -thick2);
        glVertex3f (pointsx0[1], pointsy0[1], -thick2);
        glVertex3f (pointsx0[3], pointsy0[3], -thick2);
        glVertex3f (pointsx0[2], pointsy0[2], -thick2);
        glEnd();

        /* back wall */
        glNormal3f (0, 0, 1);
        glFrontFace(GL_CCW);
        glBegin (wire ? GL_LINE_LOOP : GL_QUADS);
        glVertex3f (pointsx0[0], pointsy0[0],  thick2);
        glVertex3f (pointsx0[1], pointsy0[1],  thick2);
        glVertex3f (pointsx0[3], pointsy0[3],  thick2);
        glVertex3f (pointsx0[2], pointsy0[2],  thick2);
        glEnd();
      }

    /* top wall */
    glFrontFace(GL_CW);
    glBegin (wire ? GL_LINE_LOOP : GL_QUADS);
    glNormal3f (pointsx0[1], pointsy0[1], 0);
    glVertex3f (pointsx0[1], pointsy0[1],  thick2);
    glNormal3f (pointsx0[3], pointsy0[3], 0);
    glVertex3f (pointsx0[3], pointsy0[3],  thick2);
    glVertex3f (pointsx0[3], pointsy0[3], -thick2);
    glNormal3f (pointsx0[1], pointsy0[1], 0);
    glVertex3f (pointsx0[1], pointsy0[1], -thick2);
    glEnd();


    /* Now make a donut.
     */
    {
      int nsteps = 12;
      GLfloat r0 = 0.026;
      GLfloat r1 = 0.060;
      GLfloat th, cth, sth;

      glPushMatrix ();

      th = ((339.0 + 343.0) / 2) * d2r;
      
      glTranslatef (r1b * cos(th) * dc->gasket_size,
                    r1b * sin(th) * dc->gasket_size,
                    0);

      npoints = 0;
      for (i = 0; i < nsteps; i++)
        {
          th = 2 * M_PI * i / nsteps;
          cth = cos (th) * dc->gasket_size;
          sth = sin (th) * dc->gasket_size;
          pointsx0[npoints] = r0 * cth;
          pointsy0[npoints] = r0 * sth;
          pointsx1[npoints] = r1 * cth;
          pointsy1[npoints] = r1 * sth;
          npoints++;
        }

      pointsx0[npoints] = pointsx0[0];
      pointsy0[npoints] = pointsy0[0];
      pointsx1[npoints] = pointsx1[0];
      pointsy1[npoints] = pointsy1[0];
      npoints++;

      if (wire)
        {
          glBegin (GL_LINE_LOOP);
          for (i = 0; i < npoints; i++)
            glVertex3f (pointsx0[i], pointsy0[i], -thick2);
          glEnd();
          glBegin (GL_LINE_LOOP);
          for (i = 0; i < npoints; i++)
            glVertex3f (pointsx0[i], pointsy0[i],  thick2);
          glEnd();
# if 0
          glBegin (GL_LINE_LOOP);
          for (i = 0; i < npoints; i++)
            glVertex3f (pointsx1[i], pointsy1[i], -thick2);
          glEnd();
          glBegin (GL_LINE_LOOP);
          for (i = 0; i < npoints; i++)
            glVertex3f (pointsx1[i], pointsy1[i],  thick2);
          glEnd();
# endif
        }
      else
        {
          /* top */
          glFrontFace(GL_CW);
          glNormal3f(0, 0, -1);
          glBegin (GL_QUAD_STRIP);
          for (i = 0; i < npoints; i++)
            {
              glVertex3f (pointsx0[i], pointsy0[i], -thick2);
              glVertex3f (pointsx1[i], pointsy1[i], -thick2);
            }
          glEnd();

          /* bottom */
          glFrontFace(GL_CCW);
          glNormal3f(0, 0, 1);
          glBegin (GL_QUAD_STRIP);
          for (i = 0; i < npoints; i++)
            {
              glVertex3f (pointsx0[i], pointsy0[i],  thick2);
              glVertex3f (pointsx1[i], pointsy1[i],  thick2);
            }
          glEnd();
        }

      /* inside edge */
      glFrontFace(GL_CW);
      glBegin (wire ? GL_LINES : GL_QUAD_STRIP);
      for (i = 0; i < npoints; i++)
        {
          glNormal3f (-pointsx0[i], -pointsy0[i],  0);
          glVertex3f ( pointsx0[i],  pointsy0[i],  thick2);
          glVertex3f ( pointsx0[i],  pointsy0[i], -thick2);
        }
      glEnd();

      glPopMatrix();
    }
  }


  /* Attach the bottom-right dingus...
   */
  {
    GLfloat w = 0.04;
    GLfloat h = 0.17;
    GLfloat th;

    glRotatef (50, 0, 0, 1);
    glScalef (dc->gasket_size, dc->gasket_size, 1);
    glTranslatef (0, (r0+r1)/2, 0);

    /* buried box */
    if (! wire)
      {
        glFrontFace(GL_CCW);
        glBegin (wire ? GL_LINE_STRIP : GL_QUADS);
        glNormal3f (0, 0, -1);
        glVertex3f (-w/2, -h/2, -thick2); glVertex3f (-w/2,  h/2, -thick2);
        glVertex3f ( w/2,  h/2, -thick2); glVertex3f ( w/2, -h/2, -thick2);
        glNormal3f (1, 0, 0);
        glVertex3f ( w/2, -h/2, -thick2); glVertex3f ( w/2,  h/2, -thick2);
        glVertex3f ( w/2,  h/2,  thick2); glVertex3f ( w/2, -h/2,  thick2);
        glNormal3f (0, 0, 1);
        glVertex3f ( w/2, -h/2,  thick2); glVertex3f ( w/2,  h/2,  thick2);
        glVertex3f (-w/2,  h/2,  thick2); glVertex3f (-w/2, -h/2,  thick2);
        glNormal3f (-1, 0, 0);
        glVertex3f (-w/2, -h/2,  thick2); glVertex3f (-w/2,  h/2,  thick2);
        glVertex3f (-w/2,  h/2, -thick2); glVertex3f (-w/2, -h/2, -thick2);
        glEnd();
      }

    npoints = 0;
    for (th = 0; th < M_PI; th += (M_PI / 6))
      {
        pointsx0[npoints] = w/2 * cos(th);
        pointsy0[npoints] = w/2 * sin(th);
        npoints++;
      }

    /* front inside curve */
    glNormal3f (0, 0, -1);
    glFrontFace(GL_CW);
    glBegin (wire ? GL_LINE_STRIP : GL_TRIANGLE_FAN);
    if (! wire) glVertex3f (0, h/2, -thick2);
    for (i = 0; i < npoints; i++)
      glVertex3f (pointsx0[i], h/2 + pointsy0[i], -thick2);
    glEnd();

    /* front outside curve */
    glFrontFace(GL_CCW);
    glBegin (wire ? GL_LINE_STRIP : GL_TRIANGLE_FAN);
    if (! wire) glVertex3f (0, -h/2, -thick2);
    for (i = 0; i < npoints; i++)
      glVertex3f (pointsx0[i], -h/2 - pointsy0[i], -thick2);
    glEnd();

    /* back inside curve */
    glNormal3f (0, 0, 1);
    glFrontFace(GL_CCW);
    glBegin (wire ? GL_LINE_STRIP : GL_TRIANGLE_FAN);
    if (! wire) glVertex3f (0, h/2, thick2);
    for (i = 0; i < npoints; i++)
      glVertex3f (pointsx0[i], h/2 + pointsy0[i], thick2);
    glEnd();

    /* back outside curve */
    glFrontFace(GL_CW);
    glBegin (wire ? GL_LINE_STRIP : GL_TRIANGLE_FAN);
    if (! wire) glVertex3f (0, -h/2, thick2);
    for (i = 0; i < npoints; i++)
      glVertex3f (pointsx0[i], -h/2 - pointsy0[i], thick2);
    glEnd();

    /* inside curve */
    glFrontFace(GL_CCW);
    glBegin (wire ? GL_LINES : GL_QUAD_STRIP);
    for (i = 0; i < npoints; i++)
      {
        glNormal3f (pointsx0[i], pointsy0[i], 0);
        glVertex3f (pointsx0[i], h/2 + pointsy0[i],  thick2);
        glVertex3f (pointsx0[i], h/2 + pointsy0[i], -thick2);
      }
    glEnd();

    /* outside curve */
    glFrontFace(GL_CW);
    glBegin (wire ? GL_LINES : GL_QUAD_STRIP);
    for (i = 0; i < npoints; i++)
      {
        glNormal3f (pointsx0[i], -pointsy0[i], 0);
        glVertex3f (pointsx0[i], -h/2 - pointsy0[i],  thick2);
        glVertex3f (pointsx0[i], -h/2 - pointsy0[i], -thick2);
      }
    glEnd();
  }

  free (pointsx0);
  free (pointsy0);
  free (pointsx1);
  free (pointsy1);
  free (normals);

  glPopMatrix();
}
예제 #15
0
void calc_normals(const char *course)
{
    scalar_t *elevation;
    scalar_t courseWidth, courseLength;
    int nx, ny;
    int x,y;
    point_t p0, p1, p2;
    vector_t n, nml, v1, v2;
    char buff[BUFF_LEN];
	
    sprintf( buff, "%s/courses/%s/normal.data", getparam_data_dir(), course );
	
    get_course_dimensions( &courseWidth, &courseLength );
    get_course_divisions( &nx, &ny );
	
    if(nmls != (void*)-1 && nmls_fd != -1) 
    {
        munmap(nmls, nmls_len);
        close(nmls_fd);
    }
#if 0
    else {
        free(nmls);
    }
#endif
	
    struct stat buf;
    int exists = (stat(buff, &buf) == 0);
	
    if(exists) {
        nmls_fd = open(buff, O_RDONLY);
        if ( nmls_fd == -1) {
            handle_system_error( 1, "can't open file failed" );
        }
		
        TRDebugLog("mapping to memory normal.data\n");
        nmls_len = sizeof(vector_t)*nx*ny;
        nmls = mmap(NULL, nmls_len, PROT_READ, MAP_SHARED,nmls_fd, 0);
        if ( nmls == (void *)-1 ) {
            handle_system_error( 1, "read mmap failed" );
        }
    }
    else {
        nmls_len = sizeof(vector_t)*nx*ny;
		
#if TARGET_IPHONE_SIMULATOR
        nmls_fd = open(buff, O_RDWR | O_CREAT | O_TRUNC, 0644);
        if ( nmls_fd == -1) {
            handle_system_error( 1, "can't open file failed" );
        }
		
		
        int result = lseek(nmls_fd, nmls_len-1, SEEK_SET);
        if (result == -1) {
            handle_system_error( 1, "can't write file failed" );
        }
        
        result = write(nmls_fd, "", 1);
        if (result != 1) {
            handle_system_error( 1, "can't write file failed" );
        }
		
        nmls = mmap(NULL, nmls_len, PROT_READ | PROT_WRITE, MAP_SHARED, nmls_fd, 0);
        if ( nmls == (void *)-1 ) {
            handle_system_error( 1, "write mmap failed" );
        }
		
        TRDebugLog("Writing to normal.data\n");
#else
# ifdef TR_DEBUG_MODE
        abort(); // This shouldn't be reached on simulator. Crash to indicate.
# endif
        nmls = malloc(nmls_len);
#endif
        
        elevation = get_course_elev_data();
		
        for ( y=0; y<ny; y++) {
            for ( x=0; x<nx; x++) {
                nml = make_vector( 0., 0., 0. );
                
                p0 = make_point( XCD(x), ELEV(x,y), ZCD(y) );
                
                /* The terrain is meshed as follows:
                 ...
                 +-+-+-+-+            x<---+
                 |\|/|\|/|                 |
                 ...+-+-+-+-+...              V
                 |/|\|/|\|                 y
                 +-+-+-+-+
                 ...
                 
                 So there are two types of vertices: those surrounded by
                 four triangles (x+y is odd), and those surrounded by
                 eight (x+y is even).
                 */
                
#define POINT(x,y) make_point( XCD(x), ELEV(x,y), ZCD(y) )
                
                if ( (x + y) % 2 == 0 ) {
                    if ( x > 0 && y > 0 ) {
                        p1 = POINT(x,  y-1);
                        p2 = POINT(x-1,y-1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                        
                        p1 = POINT(x-1,y-1);
                        p2 = POINT(x-1,y  );
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                    if ( x > 0 && y < ny-1 ) {
                        p1 = POINT(x-1,y  );
                        p2 = POINT(x-1,y+1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                        
                        p1 = POINT(x-1,y+1);
                        p2 = POINT(x  ,y+1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                    if ( x < nx-1 && y > 0 ) {
                        p1 = POINT(x+1,y  );
                        p2 = POINT(x+1,y-1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                        
                        p1 = POINT(x+1,y-1);
                        p2 = POINT(x  ,y-1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                    if ( x < nx-1 && y < ny-1 ) {
                        p1 = POINT(x+1,y  );
                        p2 = POINT(x+1,y+1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v1, v2 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                        
                        p1 = POINT(x+1,y+1);
                        p2 = POINT(x  ,y+1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v1, v2 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                        
                    } 
                } else {
                    /* x + y is odd */
                    if ( x > 0 && y > 0 ) {
                        p1 = POINT(x,  y-1);
                        p2 = POINT(x-1,y  );
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                    if ( x > 0 && y < ny-1 ) {
                        p1 = POINT(x-1,y  );
                        p2 = POINT(x  ,y+1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                    if ( x < nx-1 && y > 0 ) {
                        p1 = POINT(x+1,y  );
                        p2 = POINT(x  ,y-1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v2, v1 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                    if ( x < nx-1 && y < ny-1 ) {
                        p1 = POINT(x+1,y  );
                        p2 = POINT(x  ,y+1);
                        v1 = subtract_points( p1, p0 );
                        v2 = subtract_points( p2, p0 );
                        n = cross_product( v1, v2 );
                        
                        check_assertion( n.y > 0, "course normal points down" );
                        
                        normalize_vector( &n );
                        nml = add_vectors( nml, n );
                    } 
                }
                
                normalize_vector( &nml );
                NORMAL(x,y) = nml;
                continue;
            } 
#undef POINT
        }
#if TARGET_IPHONE_SIMULATOR
        munmap(nmls, nmls_len);
        close(nmls_fd);
		
        nmls_fd = open(buff, O_RDONLY);
        if (nmls_fd == -1) {
            handle_system_error( 1, "can't remount normal.data" );
        }
		
        TRDebugLog("remounting to memory normal.data\n");
        nmls_len = sizeof(vector_t)*nx*ny;
        nmls = mmap(NULL, nmls_len, PROT_READ, MAP_SHARED, nmls_fd, 0);
        if ( nmls == (void *)-1 ) {
            handle_system_error( 1, "remount mmap failed" );
        }
#endif
    }
} 
void
data_near_geo_point(void)
{
#define ADD_DATA(label, expected, min_size, max, offset, limit, flags)  \
  gcut_add_datum(label,                                                 \
                 "expected", G_TYPE_POINTER,                            \
                 expected, gcut_list_string_free,                       \
                 "min-size", G_TYPE_INT, min_size,                      \
                 "max", G_TYPE_STRING, max,                             \
                 "offset", G_TYPE_INT, offset,                          \
                 "limit", G_TYPE_INT, limit,                            \
                 "flags", G_TYPE_INT, flags,                            \
                 NULL)

  ADD_DATA("no limit",
           gcut_list_string_new(POINT(1, 2, 3,
                                      4, 5, 6),
                                POINT(1, 2, 3,
                                      7, 8, 9),
                                POINT(7, 8, 9,
                                      4, 5, 6),
                                POINT(88, 58, 58,
                                      178, 58, 58),
                                POINT(89, 59, 59,
                                      179, -59, -59),
                                POINT(89, 59, 59,
                                      179, 59, 59),
                                POINT(-89, -59, -59,
                                      179, 59, 59),
                                POINT(-89, -59, -59,
                                      -179, -59, -59),
                                POINT(-88, -58, -58,
                                      -178, -58, -58),
                                NULL),
           0,
           TAKEN_POINT(0, 0, 0,
                       0, 0, 0),
           0, -1,
           0);
  ADD_DATA("min-size",
           gcut_list_string_new(POINT(1, 2, 3,
                                      4, 5, 6),
                                POINT(1, 2, 3,
                                      7, 8, 9),
                                POINT(7, 8, 9,
                                      4, 5, 6),
                                NULL),
           1,
           TAKEN_POINT(0, 0, 0,
                       0, 0, 0),
           0, -1,
           0);

#undef ADD_DATA
}
예제 #17
0
파일: user3.c 프로젝트: GRASS-GIS/grass-ci
int
COGRR1(double x_or, double y_or, double z_or, int n_rows, int n_cols,
       int n_levs, int n_points, struct quadruple *points,
       struct point_3d skip_point)

/*C
   C       INTERPOLATION BY FUNCTIONAL METHOD : TPS + complete regul.
   c
 */
{
    int secpar_loop();
    static double *w2 = NULL;
    static double *wz2 = NULL;
    static double *wz1 = NULL;
    double amaxa;
    double stepix, stepiy, stepiz, RO, xx, yy, zz, xg, yg, zg, xx2;
    double wm, dx, dy, dz, dxx, dyy, dxy, dxz, dyz, dzz, h, bmgd1,
	bmgd2, etar, zcon, r, ww, wz, r2, hcell, zzcell2,
	etarcell, rcell, wwcell, zzcell;
    double x_crs,x_crsd,x_crsdd,x_crsdr2;
    int n1, k1, k2, k, i1, l, l1, n4, n5, m, i;
    int NGST, LSIZE, ngstc, nszc, ngstr, nszr, ngstl, nszl;
    int POINT();
    int ind, ind1;
    static int first_time_z = 1;
    off_t offset, offset1, offset2;
    int bmask = 1;
    static FCELL *cell = NULL;

    int cond1 = (gradient != NULL) || (aspect1 != NULL) || (aspect2 != NULL);
    int cond2 = (ncurv != NULL) || (gcurv != NULL) || (mcurv != NULL);

#define CEULER .57721566
    /*
       C
       c        character*32 fncdsm
       c normalization
       c
     */
    offset1 = nsizr * nsizc;

    stepix = ew_res / dnorm;
    stepiy = ns_res / dnorm;
    stepiz = tb_res / dnorm;

    if (!w2) {
	if (!(w2 = (double *)G_malloc(sizeof(double) * (KMAX2 + 1)))) {
	    clean();
	    G_fatal_error(_("Not enough memory for %s"), "w2");
	}
    }
    if (!wz2) {
	if (!(wz2 = (double *)G_malloc(sizeof(double) * (KMAX2 + 1)))) {
	    clean();
	    G_fatal_error(_("Not enough memory for %s"), "wz2");
	}
    }
    if (!wz1) {
	if (!(wz1 = (double *)G_malloc(sizeof(double) * (KMAX2 + 1)))) {
	    clean();
	    G_fatal_error(_("Not enough memory for %s"), "wz1");
	}
    }

    if (cell == NULL)
	cell = Rast_allocate_f_buf();

    for (i = 1; i <= n_points; i++) {
	points[i - 1].x = (points[i - 1].x - x_or) / dnorm;
	points[i - 1].y = (points[i - 1].y - y_or) / dnorm;
	points[i - 1].z = (points[i - 1].z - z_or) / dnorm;
    }
    if (cv) {
	skip_point.x = (skip_point.x - x_or) / dnorm;
	skip_point.y = (skip_point.y - y_or) / dnorm;
	skip_point.z = (skip_point.z - z_or) / dnorm;
    }
    n1 = n_points + 1;
    /*
       C
       C      GENERATION OF MATRIX
       C
       C      FIRST COLUMN
       C
     */
    A[1] = 0.;
    for (k = 1; k <= n_points; k++) {
	i1 = k + 1;
	A[i1] = 1.;
    }
    /*
       C
       C      OTHER COLUMNS
       C
     */
    RO = rsm;
    for (k = 1; k <= n_points; k++) {
	k1 = k * n1 + 1;
	k2 = k + 1;
	i1 = k1 + k;
	if (rsm < 0.) {		/*indicates variable smoothing */
	    A[i1] = points[k - 1].sm;
	}
	else {
	    A[i1] = RO;		/* constant smoothing */
	}
	for (l = k2; l <= n_points; l++) {
	    xx = points[k - 1].x - points[l - 1].x;
	    yy = points[k - 1].y - points[l - 1].y;
	    zz = points[k - 1].z - points[l - 1].z;
	    r = sqrt(xx * xx + yy * yy + zz * zz);
	    etar = (fi * r) / 2.;
	    if (etar == 0.) {
		/*              printf ("ident. points in segm.  \n");
		   printf ("x[%d]=%lf,x[%d]=%lf,y[%d]=%lf,y[%d]=%lf\n",
		   k - 1, points[k - 1].x, l - 1, points[l - 1].x, k - 1, points[k - 1].y, l - 1, points[l - 1].y); */
	    }
	    i1 = k1 + l;
	    A[i1] = crs(etar);
	}
    }
    /*
       C
       C       SYMMETRISATION
       C
     */
    amaxa = 1.;
    for (k = 1; k <= n1; k++) {
	k1 = (k - 1) * n1;
	k2 = k + 1;
	for (l = k2; l <= n1; l++) {
	    m = (l - 1) * n1 + k;
	    A[m] = A[k1 + l];
	    amaxa = amax1(A[m], amaxa);
	}
    }

    /*
       C        RIGHT SIDE
       C
     */
    n4 = n1 * n1 + 1;
    A[n4] = 0.;
    for (l = 1; l <= n_points; l++) {
	l1 = n4 + l;
	A[l1] = points[l - 1].w;
    }
    n5 = n1 * (n1 + 1);
    for (i = 1; i <= n5; i++)
	A[i] = A[i] / amaxa;

    /*
       SOLVING OF SYSTEM
     */

    if (LINEQS(n1, n1, 1, &NERROR, &DETERM)) {

	for (k = 1; k <= n_points; k++) {
	    l = n4 + k;
	    b[k] = A[l];
	}
	b[n_points + 1] = A[n4];

	POINT(n_points, points, skip_point);
	if (cv)
	    return 1;
	if (devi != NULL && sig1 == 1)
	    return 1;
	/*
	   C
	   C         INTERPOLATION   *  MOST INNER LOOPS !
	   C
	 */
	NGST = 1;
	LSIZE = 0;

	ngstc = (int)(x_or / ew_res + 0.5) + 1;
	nszc = ngstc + n_cols - 1;
	ngstr = (int)(y_or / ns_res + 0.5) + 1;
	nszr = ngstr + n_rows - 1;
	ngstl = (int)(z_or / tb_res + 0.5) + 1;
	nszl = ngstl + n_levs - 1;

	/*        fprintf(stderr," Progress percentage for each segment ..." ); */
	/*fprintf(stderr,"Before loops,ngstl = %d,nszl =%d\n",ngstl,nszl); */
	for (i = ngstl; i <= nszl; i++) {
	    /*fprintf(stderr,"level=%d\n",i); */
	    /*      G_percent(i, nszl, 2); */
	    offset = offset1 * (i - 1);	/* levels offset */
	    zg = (i - ngstl) * stepiz;
	    for (m = 1; m <= n_points; m++) {
		wz = zg - points[m - 1].z;
		wz1[m] = wz;
		wz2[m] = wz * wz;
	    }
	    for (k = ngstr; k <= nszr; k++) {
		yg = (k - ngstr) * stepiy;
		for (m = 1; m <= n_points; m++) {
		    wm = yg - points[m - 1].y;
		    w[m] = wm;
		    w2[m] = wm * wm;
		}
		if ((cellinp != NULL) && (cellout != NULL) && (i == ngstl))
		    Rast_get_f_row(fdcell, cell, n_rows_in - k);

		for (l = ngstc; l <= nszc; l++) {
		    LSIZE = LSIZE + 1;
		    if (maskmap != NULL)
			bmask = BM_get(bitmask, l - 1, k - 1);	/*bug fix 02/03/00 jh */
		    xg = (l - ngstc) * stepix;
		    ww = 0.;
		    wwcell = 0.;
		    dx = 0.;
		    dy = 0.;
		    dz = 0.;
		    dxx = 0.;
		    dxy = 0.;
		    dxz = 0.;
		    dyy = 0.;
		    dyz = 0.;
		    dzz = 0.;
		    /* compute everything for area which is not masked out
		       and where cross_input map doesn't have nulls */
		    if (bmask == 1 && !(cell && Rast_is_f_null_value(&cell[l - 1]))) {
			h = b[n1];
			hcell = b[n1];
			for (m = 1; m <= n_points; m++) {
			    xx = xg - points[m - 1].x;
			    xx2 = xx * xx;
			    if ((cellinp != NULL) && (cellout != NULL) &&
				(i == ngstl)) {
				zcon = (double)(cell[l - 1] * zmult - z_or) - z_orig_in * zmult;	/* bug fix 02/03/00 jh */
				zcon = zcon / dnorm;
				zzcell = zcon - points[m - 1].z;
				zzcell2 = zzcell * zzcell;
				rcell = sqrt(xx2 + w2[m] + zzcell2);
				etarcell = (fi * rcell) / 2.;
				hcell = hcell + b[m] * crs(etarcell);
			    }
			    r2 = xx2 + w2[m] + wz2[m];
			    r = sqrt(r2);
			    etar = (fi * r) / 2.;

                            crs_full(
                              etar,fi,
                              &x_crs,
                              cond1?&x_crsd:NULL,
                              cond2?&x_crsdr2:NULL,
                              cond2?&x_crsdd:NULL
                            );
                            h = h + b[m] * x_crs;
                            if(cond1)
                            {
                                   bmgd1 = b[m] * x_crsd;
			    dx = dx + bmgd1 * xx;
			    dy = dy + bmgd1 * w[m];
			    dz = dz + bmgd1 * wz1[m];
                            }
                            if(cond2)
                            {
                                   bmgd2 = b[m] * x_crsdd;
                                   bmgd1 = b[m] * x_crsdr2;
			    dyy = dyy + bmgd2 * w2[m] + bmgd1 * w2[m];
			    dzz = dzz + bmgd2 * wz2[m] + bmgd1 * wz2[m];
			    dxy = dxy + bmgd2 * xx * w[m] + bmgd1 * xx * w[m];
                                   dxz = dxz + bmgd2 * xx * wz1[m] + bmgd1 * xx * wz1[m];
                                   dyz = dyz + bmgd2 * w[m] * wz1[m] + bmgd1 * w[m] * wz1[m];
                            }                            
			}
			ww = h + wmin;
			if ((cellinp != NULL) && (cellout != NULL) &&
			    (i == ngstl))
			    wwcell = hcell + wmin;
			az[l] = ww;
			if (first_time_z) {
			    first_time_z = 0;
			    zmaxac = zminac = ww;
			    if ((cellinp != NULL) && (cellout != NULL) &&
				(i == ngstl))
				zmaxacell = zminacell = wwcell;
			}
			zmaxac = amax1(ww, zmaxac);
			zminac = amin1(ww, zminac);
			if ((cellinp != NULL) && (cellout != NULL) &&
			    (i == ngstl)) {
			    zmaxacell = amax1(wwcell, zmaxacell);
			    zminacell = amin1(wwcell, zminacell);
			}
			if ((ww > wmax + 0.1 * (wmax - wmin))
			    || (ww < wmin - 0.1 * (wmax - wmin))) {
			    static int once = 0;

			    if (!once) {
				once = 1;
				fprintf(stderr, "WARNING:\n");
				fprintf(stderr,
					"Overshoot -- increase in tension suggested.\n");
				fprintf(stderr,
					"Overshoot occurs at (%d,%d,%d) cell\n",
					l, k, i);
				fprintf(stderr,
					"The w-value is %lf, wmin is %lf,wmax is %lf\n",
					ww, wmin, wmax);
			    }
			}
		    }		/* skip here if you are in masked area, ww should be 0 */
		    az[l] = ww;
		    adx[l] = dx;
		    ady[l] = dy;
		    adz[l] = dz;
		    /*              printf("\n %f", ww); */
		    adxx[l] = dxx;
		    adxy[l] = dxy;
		    adxz[l] = dxz;
		    adyy[l] = dyy;
		    adyz[l] = dyz;
		    adzz[l] = dzz;
		    if ((gradient != NULL) || (aspect1 != NULL) ||
			(aspect2 != NULL)
			|| (ncurv != NULL) || (gcurv != NULL) ||
			(mcurv != NULL))
			if (!(secpar_loop(ngstc, nszc, l))) {
			    clean();
			    G_fatal_error(_("Secpar_loop failed"));
			}
		    if ((cellinp != NULL) && (cellout != NULL) &&
			(i == ngstl)) {
			zero_array_cell[l - 1] = (FCELL) (wwcell);
		    }
		    if (outz != NULL) {
			zero_array1[l - 1] = (float)(az[l] * sciz);
		    }
		    if (gradient != NULL) {
			zero_array2[l - 1] = (float)(adx[l]);
		    }
		    if (aspect1 != NULL) {
			zero_array3[l - 1] = (float)(ady[l]);
		    }
		    if (aspect2 != NULL) {
			zero_array4[l - 1] = (float)(adz[l]);
		    }
		    if (ncurv != NULL) {
			zero_array5[l - 1] = (float)(adxx[l]);
		    }
		    if (gcurv != NULL) {
			zero_array6[l - 1] = (float)(adyy[l]);
		    }
		    if (mcurv != NULL) {
			zero_array7[l - 1] = (float)(adxy[l]);
		    }
		}		/* columns */
		ind = nsizc * (k - 1) + (ngstc - 1);
		ind1 = ngstc - 1;
		offset2 = offset + ind;	/* rows*cols offset */

		if ((cellinp != NULL) && (cellout != NULL) && (i == ngstl)) {
		    G_fseek(Tmp_fd_cell, ((off_t)ind * sizeof(FCELL)), 0);
		    if (!
			(fwrite
			 (zero_array_cell + ind1, sizeof(FCELL),
			  nszc - ngstc + 1, Tmp_fd_cell))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (outz != NULL) {
		    G_fseek(Tmp_fd_z, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array1 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_z))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (gradient != NULL) {
		    G_fseek(Tmp_fd_dx, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array2 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_dx))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (aspect1 != NULL) {
		    G_fseek(Tmp_fd_dy, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array3 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_dy))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (aspect2 != NULL) {
		    G_fseek(Tmp_fd_dz, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array4 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_dz))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (ncurv != NULL) {
		    G_fseek(Tmp_fd_xx, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array5 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_xx))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (gcurv != NULL) {
		    G_fseek(Tmp_fd_yy, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array6 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_yy))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}
		if (mcurv != NULL) {
		    G_fseek(Tmp_fd_xy, (off_t)(offset2 * sizeof(float)), 0);
		    if (!
			(fwrite
			 (zero_array7 + ind1, sizeof(float), nszc - ngstc + 1,
			  Tmp_fd_xy))) {
			clean();
			G_fatal_error
			    (_("Not enough disk space--cannot write files"));
		    }
		}

	    }
	}
    }				/* falls here if LINEQS() returns 0 */
    /*    total++; */
    /*fprintf(stderr,"wminac=%lf,wmaxac=%lf\n",zminac,zmaxac); */
    return 1;

}
예제 #18
0
void destroy_subtrie(struct mb_node_v6 *node, void (*destroy_nhi)(struct next_hop_info *nhi), struct mc *m, int depth, int use_mm)
#endif
{
    int bit;
    int cidr;
    int pos;
    struct next_hop_info ** nhi = NULL;
    int stride;
    struct mb_node_v6 *next = NULL;

    
    int cnt_rules;
    struct mb_node_v6 *first = NULL;

    for (cidr=0;cidr<= STRIDE -1;cidr ++ ){
        for (bit=0;bit< (1<<cidr);bit++) {
            pos = count_inl_bitmap(bit,cidr);
            if (test_bitmap(node->internal, pos)) {
                nhi = (struct next_hop_info**)node->child_ptr - count_ones(node->internal, pos) - 1;
                if (destroy_nhi && *nhi != NULL) {
                    destroy_nhi(*nhi);
                }
                *nhi = NULL;
            }
        }
    }


    for (stride = 0; stride < (1<<STRIDE); stride ++ ){
        pos = count_enl_bitmap(stride);
        if (test_bitmap(node->external, pos)) {
            next = (struct mb_node_v6 *)node->child_ptr + count_ones(node->external, pos);
#ifndef USE_MM
            destroy_subtrie(next, destroy_nhi);
#else
            destroy_subtrie(next, destroy_nhi, m, depth + 1, use_mm);
#endif
        }
    }

    cnt_rules = count_children(node->internal);
    first = POINT(node->child_ptr) - UP_RULE(cnt_rules);


#ifdef DEBUG_MEMORY_FREE
    int cnt = count_children(node->internal);
    mem_destroy += UP_RULE(cnt) * NODE_SIZE;
    cnt = count_children(node->external);
    mem_destroy += UP_CHILD(cnt) * NODE_SIZE;
#endif


    node->internal = 0;
    node->external = 0;
    node->child_ptr = NULL;

#ifdef USE_MM
    //printf("not supported\n");
    int cnt_children = count_children(node->external);
    free_node(m, first, UP_RULE(cnt_rules) + UP_CHILD(cnt_children), depth, use_mm);
#else
    free(first);
#endif

}
예제 #19
0
static Cube *
_cube_new(Evas_Coord w, Evas_Coord h, Evas_Coord d)
{
   Cube *c;
   int i;

   w -= (w / 2);
   h -= (h / 2);
   d -= (d / 2);
   c = calloc(1, sizeof(Cube));
   for (i = 0; i < 6; i++)
     {
        Evas_Object *o;
        char buf[256];
        o = evas_object_image_add(evas);
        c->side[i].o = o;
        snprintf(buf, sizeof(buf), "cube%i.png", i + 1);
        evas_object_image_file_set(o, build_path(buf), NULL);
        evas_object_image_fill_set(o, 0, 0, 256, 256);
        evas_object_resize(o, 256, 256);
        evas_object_show(o);
     }
   POINT(0, 0, -w, -h, -d,   0,   0);
   POINT(0, 1,  w, -h, -d, 256,   0);
   POINT(0, 2,  w,  h, -d, 256, 256);
   POINT(0, 3, -w,  h, -d,   0, 256);

   POINT(1, 0,  w, -h, -d,   0,   0);
   POINT(1, 1,  w, -h,  d, 256,   0);
   POINT(1, 2,  w,  h,  d, 256, 256);
   POINT(1, 3,  w,  h, -d,   0, 256);
   
   POINT(2, 0,  w, -h,  d,   0,   0);
   POINT(2, 1, -w, -h,  d, 256,   0);
   POINT(2, 2, -w,  h,  d, 256, 256);
   POINT(2, 3,  w,  h,  d,   0, 256);

   POINT(3, 0, -w, -h,  d,   0,   0);
   POINT(3, 1, -w, -h, -d, 256,   0);
   POINT(3, 2, -w,  h, -d, 256, 256);
   POINT(3, 3, -w,  h,  d,   0, 256);
   
   POINT(4, 0, -w, -h,  d,   0,   0);
   POINT(4, 1,  w, -h,  d, 256,   0);
   POINT(4, 2,  w, -h, -d, 256, 256);
   POINT(4, 3, -w, -h, -d,   0, 256);
   
   POINT(5, 0, -w,  h, -d,   0,   0);
   POINT(5, 1,  w,  h, -d, 256,   0);
   POINT(5, 2,  w,  h,  d, 256, 256);
   POINT(5, 3, -w,  h,  d,   0, 256);
   
   return c;
}
예제 #20
0
SummonGroundElemental::SummonGroundElemental() throw()
{
	m_MaskIndex[0] = 4;
	m_ElementalMask[0][0] = POINT(0,1);
	m_ElementalMask[0][1] = POINT(0,-1);
	m_ElementalMask[0][2] = POINT(1,0);
	m_ElementalMask[0][3] = POINT(-1,0);

	m_MaskIndex[1] = 8;
	m_ElementalMask[1][0] = POINT(0,-1);
	m_ElementalMask[1][1] = POINT(-1,-1);
	m_ElementalMask[1][2] = POINT(-1, 0);
	m_ElementalMask[1][3] = POINT(-1, 1);
	m_ElementalMask[1][4] = POINT(0, 1);
	m_ElementalMask[1][5] = POINT(1, 1);
	m_ElementalMask[1][6] = POINT(1, 0);
	m_ElementalMask[1][7] = POINT(1,-1);

	m_MaskIndex[2] = 12;
	m_ElementalMask[2][0] = POINT(0,-1);
	m_ElementalMask[2][1] = POINT(-1,-1);
	m_ElementalMask[2][2] = POINT(-1, 0);
	m_ElementalMask[2][3] = POINT(-1, 1);
	m_ElementalMask[2][4] = POINT(0, 1);
	m_ElementalMask[2][5] = POINT(1, 1);
	m_ElementalMask[2][6] = POINT(1, 0);
	m_ElementalMask[2][7] = POINT(1,-1);
	m_ElementalMask[2][8] = POINT(-2, 0);
	m_ElementalMask[2][9] = POINT(2, 0);
	m_ElementalMask[2][10] = POINT(0,-2);
	m_ElementalMask[2][11] = POINT(0, 2);

	m_MaskIndex[3] = 24;
	m_ElementalMask[3][0] = POINT(0,-1);
	m_ElementalMask[3][1] = POINT(-1,-1);
	m_ElementalMask[3][2] = POINT(-1, 0);
	m_ElementalMask[3][3] = POINT(-1, 1);
	m_ElementalMask[3][4] = POINT(0, 1);
	m_ElementalMask[3][5] = POINT(1, 1);
	m_ElementalMask[3][6] = POINT(1, 0);
	m_ElementalMask[3][7] = POINT(1,-1);
	m_ElementalMask[3][8] = POINT(-2, 0);
	m_ElementalMask[3][9] = POINT(-2,-1);
	m_ElementalMask[3][10] = POINT(-2,-2);
	m_ElementalMask[3][11] = POINT(-1,-2);
	m_ElementalMask[3][12] = POINT(0,-2);
	m_ElementalMask[3][13] = POINT(1,-2);
	m_ElementalMask[3][14] = POINT(2,-2);
	m_ElementalMask[3][15] = POINT(2,-1);
	m_ElementalMask[3][16] = POINT(2, 0);
	m_ElementalMask[3][17] = POINT(2, 1);
	m_ElementalMask[3][18] = POINT(2, 2);
	m_ElementalMask[3][19] = POINT(1, 2);
	m_ElementalMask[3][20] = POINT(0, 2);
	m_ElementalMask[3][21] = POINT(-1, 2);
	m_ElementalMask[3][22] = POINT(-2, 2);
	m_ElementalMask[3][23] = POINT(-2, 1);
}
예제 #21
0
static Cube *
_cube_new(Evas *evas, Evas_Coord w, Evas_Coord h, Evas_Coord d)
{
   Cube *c;
   int i;

   w -= (w / 2);
   h -= (h / 2);
   d -= (d / 2);
   c = calloc(1, sizeof(Cube));
   for (i = 0; i < 6; i++)
     {
        Evas_Object *o;
        char buf[PATH_MAX];
        o = evas_object_image_add(evas);
        c->side[i].o = o;
        snprintf(buf, sizeof(buf), "%s/images/%s",
                 elm_app_data_dir_get(), "twofish.jpg");
        evas_object_image_file_set(o, buf, NULL);
        evas_object_image_fill_set(o, 0, 0, 256, 256);
        evas_object_resize(o, 256, 256);
        evas_object_image_smooth_scale_set(o, 0);
        evas_object_show(o);
     }
   POINT(0, 0, -w, -h, -d,   0,   0);
   POINT(0, 1,  w, -h, -d, 256,   0);
   POINT(0, 2,  w,  h, -d, 256, 256);
   POINT(0, 3, -w,  h, -d,   0, 256);

   POINT(1, 0,  w, -h, -d,   0,   0);
   POINT(1, 1,  w, -h,  d, 256,   0);
   POINT(1, 2,  w,  h,  d, 256, 256);
   POINT(1, 3,  w,  h, -d,   0, 256);

   POINT(2, 0,  w, -h,  d,   0,   0);
   POINT(2, 1, -w, -h,  d, 256,   0);
   POINT(2, 2, -w,  h,  d, 256, 256);
   POINT(2, 3,  w,  h,  d,   0, 256);

   POINT(3, 0, -w, -h,  d,   0,   0);
   POINT(3, 1, -w, -h, -d, 256,   0);
   POINT(3, 2, -w,  h, -d, 256, 256);
   POINT(3, 3, -w,  h,  d,   0, 256);

   POINT(4, 0, -w, -h,  d,   0,   0);
   POINT(4, 1,  w, -h,  d, 256,   0);
   POINT(4, 2,  w, -h, -d, 256, 256);
   POINT(4, 3, -w, -h, -d,   0, 256);

   POINT(5, 0, -w,  h, -d,   0,   0);
   POINT(5, 1,  w,  h, -d, 256,   0);
   POINT(5, 2,  w,  h,  d, 256, 256);
   POINT(5, 3, -w,  h,  d,   0, 256);

   return c;
}
예제 #22
0
Variables::Variables()
{
	externPoint = POINT();
	externPoint.x = -1;
	externPoint.y = -1;
}
예제 #23
0
파일: util.hpp 프로젝트: WilstonOreo/GEx
 POINT getNormal(const POINT& _p0, const POINT& _p1)
 {
   POINT _d = _p1 - _p0;
   return POINT(-_d.y(),_d.x());
 }
예제 #24
0
void TileToRowsCCPacker::callGeneric(Array<POINT> &box,
	Array<POINT> &offset,
	double pageRatio)
{
	OGDF_ASSERT(box.size() == offset.size());
	// negative pageRatio makes no sense,
	// pageRatio = 0 will cause division by zero
	OGDF_ASSERT(pageRatio > 0);

	const int n = box.size();
	int nRows = 0;
	Array<RowInfo<POINT> > row(n);

	// sort the box indices according to decreasing height of the
	// corresponding boxes
	Array<int> sortedIndices(n);

	int i;
	for(i = 0; i < n; ++i)
		sortedIndices[i] = i;

	DecrIndexComparer<POINT> comp(box);
	sortedIndices.quicksort(comp);

	// i iterates over all box indices according to decreasing height of
	// the boxes
	for(int iSI = 0; iSI < n; ++iSI)
	{
		int i = sortedIndices[iSI];

		// Find the row which increases the covered area as few as possible.
		// The area measured is the area of the smallest rectangle that covers
		// all boxes and whose width / height ratio is pageRatio
		int bestRow = findBestRow(row,nRows,pageRatio,box[i]);

		// bestRow = -1 indictes that a new row is added
		if (bestRow < 0) {
			struct RowInfo<POINT> &r = row[nRows++];
			r.m_boxes.pushBack(i);
			r.m_maxHeight = box[i].m_y;
			r.m_width = box[i].m_x;

		} else {
			struct RowInfo<POINT> &r = row[bestRow];
			r.m_boxes.pushBack(i);
			r.m_maxHeight = max(r.m_maxHeight,box[i].m_y);
			r.m_width += box[i].m_x;
		}
	}

	// At this moment, we know which box is contained in which row.
	// The following loop sets the required offset of each box
	typename POINT::numberType y = 0;  // sum of the heights of boxes 0,...,i-1
	for(i = 0; i < nRows; ++i)
	{
		const RowInfo<POINT> &r = row[i];

		typename POINT::numberType x = 0;  // sum of the widths of the boxes to the left of box *it

		for(int j : r.m_boxes)
		{
			offset[j] = POINT(x,y);
			x += box[j].m_x;
		}

		y += r.m_maxHeight;
	}

	OGDF_ASSERT_IF(dlConsistencyChecks, checkOffsets(box,offset));
}
예제 #25
0
double GammaNemaCalc::getDiffUniformity(GammaDirection_e direction)
{
	double result = 0;
	
	for(wxUint32 y = 2; y <= 253; y++)
	{
		for(wxUint32 x = 2; x <= 253; x++)
		{
			wxUint32 min = wxUINT32_MAX;
			wxUint32 max = 0;

			switch(direction)
			{
			case GAMMA_DIRECTION_X:
				if( 0 == m_pDataIn->matrix[POINT(x-2, y)] || !POINT_INSIDE_FOV(POINT(x-2, y)) ||
					0 == m_pDataIn->matrix[POINT(x+2, y)] || !POINT_INSIDE_FOV(POINT(x+2, y)) )
				{
					continue;
				}

				for(wxInt32 i = -2; i <= 2; i++)
				{
					if(m_pDataIn->matrix[POINT(x+i, y)] < min)
					{
						min = m_pDataIn->matrix[POINT(x+i, y)];
					}

					if(max < m_pDataIn->matrix[POINT(x+i, y)])
					{
						max = m_pDataIn->matrix[POINT(x+i, y)];
					}
				}
				break;
			case GAMMA_DIRECTION_Y:
				if( 0 == m_pDataIn->matrix[POINT(x, y-2)] || !POINT_INSIDE_FOV(POINT(x, y-2)) ||
					0 == m_pDataIn->matrix[POINT(x, y+2)] || !POINT_INSIDE_FOV(POINT(x, y+2)) )
				{
					continue;
				}

				for(wxInt32 i = -2; i <= 2; i++)
				{
					if(m_pDataIn->matrix[POINT(x, y+i)] < min)
					{
						min = m_pDataIn->matrix[POINT(x, y+i)];
					}

					if(max < m_pDataIn->matrix[POINT(x, y+i)])
					{
						max = m_pDataIn->matrix[POINT(x, y+i)];
					}
				}
				break;
			}
			
			if(result < 100.0 * (max - min) / (max + min))
			{
				result = 100.0 * (max - min) / (max + min);
			}
		}
	}

	return result;
}
예제 #26
0
void StageInfoDictionary::Initialize()
{
    ASSERT_DEBUG(m_StageInfoMap.empty() == true);
    
    StageLevel  stageLevel = 0;
    float       mapPointHeight = 50.f;
    {
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting, 5));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_Single, POINT( 50.f, mapPointHeight ), "걸음마", missionList);
    }
    
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting, 10));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_Single, POINT( 150.f, mapPointHeight), "위습이 나타났다!", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TeamCarrotCollecting, 15));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_TeamCollaboration, POINT( 250.f, mapPointHeight), "쓸쓸해말아요", missionList);
    }
    
    
    {
        mapPointHeight += 70.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TeamCarrotCollecting, 15));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_TeamMatch, POINT( 250.f, mapPointHeight), "우리끼리 한번 겨뤄볼까?", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting, 15));
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TimeAttack, 70));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_Single, POINT( 150.f, mapPointHeight), "시간이 없당근", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_WinTheRace));
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TimeAttack, 65));
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting, 15));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_Single, POINT( 50.f, mapPointHeight), "먼저 간당근", missionList);
    }
    {
        mapPointHeight += 70.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting,20));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_Single, POINT( 50.f, mapPointHeight), "뭉쳐야 산당",  missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TeamCarrotCollecting, 25));
        this->AddStageInfo(stageLevel++, MapType_StrangeForest, StageType_TeamCollaboration, POINT( 150.f, mapPointHeight), "크로이가 나타났다!", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TeamCarrotCollecting, 25));
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TimeAttack, 65));
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_WinTheRace));
        this->AddStageInfo(stageLevel++, MapType_MacaronLand, StageType_TeamCollaboration, POINT( 250.f, mapPointHeight), "크리스탈을 지켜라!", missionList);
    }
    {
        mapPointHeight += 70.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TimeAttack, 60));
        this->AddStageInfo(stageLevel++, MapType_MacaronLand, StageType_Single, POINT( 250.f, mapPointHeight), "구름 절벽", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_WinTheRace));
        this->AddStageInfo(stageLevel++, MapType_MacaronLand, StageType_Single, POINT( 150.f, mapPointHeight), "지옥 계단", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TimeAttack, 55));
        this->AddStageInfo(stageLevel++, MapType_MacaronLand, StageType_Single, POINT( 50.f, mapPointHeight), "지옥 절벽", missionList);
    }
    {
        mapPointHeight += 70.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_TimeAttack, 50));
        this->AddStageInfo(stageLevel++, MapType_ToyRoom, StageType_TeamCollaboration, POINT( 50.f, mapPointHeight), "마카롱 *^^*", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_WinTheRace));
        this->AddStageInfo(stageLevel++, MapType_ToyRoom, StageType_TeamMatch, POINT( 150.f, mapPointHeight), "우리끼리 겨뤄볼까?", missionList);
    }
    {
        mapPointHeight += 30.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting, 35));
        this->AddStageInfo(stageLevel++, MapType_ToyRoom, StageType_TeamCollaboration, POINT( 250.f, mapPointHeight), "수정, 수정을 보자", missionList);
    }
    {
        mapPointHeight += 70.f;
        StageMissionList missionList;
        missionList.push_back(CreateGooRoomObject<StageMission>(StageMissionType_CarrotCollecting, 45));
        this->AddStageInfo(stageLevel++, MapType_ToyRoom, StageType_Single, POINT( 250.f, mapPointHeight), "현기증 난단 말예여", missionList);
    }
    
    
}