Click here to Skip to main content
15,895,740 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: conversion of jpg to data ie. txt Pin
El Corazon5-Jan-07 6:04
El Corazon5-Jan-07 6:04 
GeneralRe: conversion of jpg to data ie. txt Pin
Rilhas30-Jan-07 12:39
Rilhas30-Jan-07 12:39 
GeneralRe: conversion of jpg to data ie. txt Pin
Rilhas30-Jan-07 12:46
Rilhas30-Jan-07 12:46 
QuestionRe: conversion of jpg to data ie. txt Pin
Maximilien5-Jan-07 5:40
Maximilien5-Jan-07 5:40 
AnswerRe: conversion of jpg to data ie. txt Pin
Lowki8-Jan-07 1:51
Lowki8-Jan-07 1:51 
GeneralRe: conversion of jpg to data ie. txt Pin
Jeremy Falcon31-Jan-07 6:03
professionalJeremy Falcon31-Jan-07 6:03 
QuestionMoving window along a cosine path Pin
Tommy Svensson28-Dec-06 4:50
Tommy Svensson28-Dec-06 4:50 
AnswerRe: Moving window along a cosine path Pin
Kacee Giger28-Dec-06 7:52
Kacee Giger28-Dec-06 7:52 
I don't know what language you're using, but I've always used ::GetSystemMetrics(SM_CXSCREEN) to get the screen width and similar calls to get other screen dimensions. For your problem, since cos(180)=-1 and cos(0)=1, you will want to find the center of the screen to pivot from, but to do this you will need to subtract off the height of the splash screen and any borders. The following worked in a dialog based app:

void CTestSplashDlg::SetPosition(double dDegrees)<br />
{<br />
	const double pi = 3.1415926535;<br />
	double dRadians = (2 * dDegrees * pi)/360;<br />
	double dCos = cos(dRadians);<br />
<br />
	CRect rect;<br />
	GetClientRect(&rect);<br />
<br />
	long nNewWidth = (long)(::GetSystemMetrics(SM_CXSCREEN) - rect.Width() - ::GetSystemMetrics(SM_CXDLGFRAME)) * (dDegrees/180);<br />
	<br />
	// Since cos(0) = 1 and cos(180) = -1, must have center of screen as cos(90) = 0<br />
	long nHeightCenter = (long)(::GetSystemMetrics(SM_CYSCREEN) - rect.Height() - ::GetSystemMetrics(SM_CYDLGFRAME) - ::GetSystemMetrics(SM_CYCAPTION))/2;<br />
	long nNewHeight = (long)(nHeightCenter - (dCos * (nHeightCenter)));<br />
	<br />
	SetWindowPos(NULL, nNewWidth, nNewHeight, 0, 0, SWP_NOZORDER | SWP_NOSIZE);<br />
}


when called with:
for (double i = 180; i >= 0; i--)<br />
	{<br />
		SetPosition(i);<br />
		Sleep(10);<br />
	}


Note that you would probably call this from a timer instead of a for loop and the starting position does not take into account the taskbar that may be at the bottom of the screen.
Questionhow to change wave file frequency Pin
hserver25-Dec-06 21:37
hserver25-Dec-06 21:37 
AnswerRe: how to change wave file frequency Pin
Rilhas22-Jan-07 12:57
Rilhas22-Jan-07 12:57 
QuestionPuzzle Challenge Site Pin
Are Jay22-Dec-06 21:47
Are Jay22-Dec-06 21:47 
AnswerRe: Puzzle Challenge Site Pin
PIEBALDconsult26-Dec-06 6:47
mvePIEBALDconsult26-Dec-06 6:47 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 7:38
sitebuilderLuc Pattyn26-Dec-06 7:38 
GeneralRe: Puzzle Challenge Site Pin
PIEBALDconsult26-Dec-06 9:28
mvePIEBALDconsult26-Dec-06 9:28 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 9:47
sitebuilderLuc Pattyn26-Dec-06 9:47 
GeneralRe: Puzzle Challenge Site Pin
PIEBALDconsult26-Dec-06 10:21
mvePIEBALDconsult26-Dec-06 10:21 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 11:41
sitebuilderLuc Pattyn26-Dec-06 11:41 
GeneralRe: Puzzle Challenge Site Pin
Are Jay26-Dec-06 18:01
Are Jay26-Dec-06 18:01 
GeneralRe: Puzzle Challenge Site Pin
PIEBALDconsult27-Dec-06 8:20
mvePIEBALDconsult27-Dec-06 8:20 
AnswerRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 8:00
sitebuilderLuc Pattyn26-Dec-06 8:00 
GeneralRe: Puzzle Challenge Site Pin
Are Jay26-Dec-06 19:00
Are Jay26-Dec-06 19:00 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn27-Dec-06 0:34
sitebuilderLuc Pattyn27-Dec-06 0:34 
GeneralRe: Puzzle Challenge Site Pin
Are Jay27-Dec-06 3:30
Are Jay27-Dec-06 3:30 
AnswerRe: Puzzle Challenge Site Pin
PIEBALDconsult27-Dec-06 8:54
mvePIEBALDconsult27-Dec-06 8:54 
QuestionAssist about 3d modelling Pin
ms raj21-Dec-06 23:50
ms raj21-Dec-06 23:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.