Click here to Skip to main content
15,902,810 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: system() parameter complications Pin
Stuart Dootson30-Mar-09 21:57
professionalStuart Dootson30-Mar-09 21:57 
QuestionProblem with WinDef.h Pin
T.RATHA KRISHNAN30-Mar-09 18:44
T.RATHA KRISHNAN30-Mar-09 18:44 
AnswerRe: Problem with WinDef.h Pin
gamefreak229130-Mar-09 19:53
gamefreak229130-Mar-09 19:53 
QuestionRe: Problem with WinDef.h Pin
T.RATHA KRISHNAN30-Mar-09 20:26
T.RATHA KRISHNAN30-Mar-09 20:26 
Questionrectangle rotation Pin
Member 337533430-Mar-09 13:15
Member 337533430-Mar-09 13:15 
AnswerRe: rectangle rotation Pin
Stuart Dootson30-Mar-09 14:57
professionalStuart Dootson30-Mar-09 14:57 
GeneralRe: rectangle rotation Pin
Member 337533430-Mar-09 16:41
Member 337533430-Mar-09 16:41 
GeneralRe: rectangle rotation Pin
Stuart Dootson30-Mar-09 20:16
professionalStuart Dootson30-Mar-09 20:16 
OK - for 'Pi', read 'rectangle[i]', for i in the range 0 to 3.

So, for rectangle, assuming you're transforming rectangle into a new rectangle, rectangleNew:

void rotate (float angle)
{
        rectangleNew[0].x = (rectangle[0].x - px) * cos(angle) - (rectangle[0].y - py) * sin(angle);
	rectangleNew[0].y = (rectangle[0].x - px) * sin(angle) + (rectangle[0].y - py) * cos(angle);
        rectangleNew[1].x = (rectangle[1].x - px) * cos(angle) - (rectangle[1].y - py) * sin(angle);
        rectangleNew[1].y = (rectangle[1].x - px) * sin(angle) + (rectangle[1].y - py) * cos(angle);
        rectangleNew[2].x = (rectangle[2].x - px) * cos(angle) - (rectangle[2].y - py) * sin(angle);
        rectangleNew[2].y = (rectangle[2].x - px) * sin(angle) + (rectangle[2].y - py) * cos(angle);
        rectangleNew[3].x = (rectangle[3].x - px) * cos(angle) - (rectangle[3].y - py) * sin(angle);
        rectangleNew[3].y = (rectangle[3].x - px) * sin(angle) + (rectangle[3].y - py) * cos(angle);
}


Don't try and rotate points in-place...

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

AnswerRe: rectangle rotation Pin
Iain Clarke, Warrior Programmer1-Apr-09 1:07
Iain Clarke, Warrior Programmer1-Apr-09 1:07 
QuestionUsing DirectSound and Synthesis toolkit in Visual Studio [modified] Pin
someguy16430-Mar-09 12:46
someguy16430-Mar-09 12:46 
QuestionFiltering processes of current user Pin
Moak30-Mar-09 8:20
Moak30-Mar-09 8:20 
AnswerRe: Filtering processes of current user Pin
Code-o-mat30-Mar-09 8:43
Code-o-mat30-Mar-09 8:43 
GeneralRe: Filtering processes of current user Pin
Moak30-Mar-09 12:10
Moak30-Mar-09 12:10 
GeneralRe: Filtering processes of current user Pin
Code-o-mat30-Mar-09 21:06
Code-o-mat30-Mar-09 21:06 
QuestionExecute a system process from ring0 Pin
Biosstar30-Mar-09 7:00
Biosstar30-Mar-09 7:00 
Questionfull screen message box Pin
gamefreak229130-Mar-09 5:58
gamefreak229130-Mar-09 5:58 
AnswerRe: full screen message box Pin
CPallini30-Mar-09 6:03
mveCPallini30-Mar-09 6:03 
QuestionRe: full screen message box Pin
David Crow30-Mar-09 7:06
David Crow30-Mar-09 7:06 
AnswerRe: full screen message box Pin
gamefreak229130-Mar-09 7:23
gamefreak229130-Mar-09 7:23 
GeneralRe: full screen message box Pin
David Crow30-Mar-09 7:25
David Crow30-Mar-09 7:25 
GeneralRe: full screen message box Pin
gamefreak229130-Mar-09 7:28
gamefreak229130-Mar-09 7:28 
QuestionRe: full screen message box Pin
David Crow30-Mar-09 7:34
David Crow30-Mar-09 7:34 
AnswerRe: full screen message box Pin
gamefreak229130-Mar-09 7:47
gamefreak229130-Mar-09 7:47 
GeneralRe: full screen message box Pin
David Crow30-Mar-09 7:57
David Crow30-Mar-09 7:57 
AnswerRe: full screen message box Pin
bulg30-Mar-09 10:41
bulg30-Mar-09 10:41 

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.