Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I use CListCtrl's LVS_REPORT Pin
Philip Patrick26-Jul-02 23:47
professionalPhilip Patrick26-Jul-02 23:47 
Generalthank you,your are really good! Pin
Angel Kid27-Jul-02 4:33
Angel Kid27-Jul-02 4:33 
QuestionHow to replace last line of a file? Pin
Jon Taylor26-Jul-02 22:14
Jon Taylor26-Jul-02 22:14 
AnswerRe: How to replace last line of a file? Pin
Nish Nishant26-Jul-02 22:40
sitebuilderNish Nishant26-Jul-02 22:40 
GeneralRe: How to replace last line of a file? Pin
l a u r e n27-Jul-02 1:10
l a u r e n27-Jul-02 1:10 
AnswerRe: How to replace last line of a file? Pin
Sharad Ganesh27-Jul-02 4:11
Sharad Ganesh27-Jul-02 4:11 
Generalcmb1 (and edt1) and OFN_EXPLORER Pin
Atlantys26-Jul-02 21:08
Atlantys26-Jul-02 21:08 
GeneralGDI Rotation Question Pin
jonbrown26-Jul-02 20:23
jonbrown26-Jul-02 20:23 
Hello all,

I am writing a little vector animation program and want to add rotation to my basic shapes. I have an algorithm that works ok... other than the fact that is shrinks the shape as it rotates! It works much better in OpenGL since its points are floating point. As far as I can tell, the shrinking is due to round off error, going from double to int. I am using the GDI in this case so I can't really do much about it. I am also programming this to run on both 9X and XP so no world transformations. I intend to make this method work for all gdi type basic shapes it is only working (appropriately) with the shapes that are invariant under rotation, the Polyxxxx shapes.

So, can anyone verify my diagnosis or point out other problems? Moreover, can anyone suggest a... less destructive way to rotate?

Thanks alot
////////////////////////////////////////////////////////////////////
int CShape::Rotate(int nAngle) // thar she be!
{
double dAngle = -nAngle * DEG_TO_RAD,
tX, tY, tX2, tY2;

for(int i = 0; i < m_aSourcePoints.GetSize(); i++)
{
tX = m_aPoints[i].x - m_ptRotate.x;
tY = m_aPoints[i].y - m_ptRotate.y;

tX2 = (int)((tX*cos(dAngle))-(tY*sin(dAngle)))+m_ptRotate.x;
tY2 = (int)((tX*sin(dAngle))+(tY*cos(dAngle)))+m_ptRotate.y;

//round the rotates point values
if((tX2 - floor(tX2)) >= 0.5) tX2 = ceil(tX2);
else tX2 = floor(tX2);
if((tY2 - floor(tY2)) >= 0.5) tY2 = ceil(tY2);
else tY2 = floor(tY2);

m_aPoints[i].x = tX2;
m_aPoints[i].y = tY2;
}
return ANI_OK;
}

jon brown
GeneralHelp in CStatic Pin
SamirSood26-Jul-02 19:30
SamirSood26-Jul-02 19:30 
GeneralRe: Help in CStatic Pin
l a u r e n27-Jul-02 1:18
l a u r e n27-Jul-02 1:18 
GeneralTiff image format and CMYK color mode Pin
storein26-Jul-02 18:29
storein26-Jul-02 18:29 
GeneralRe: Tiff image format and CMYK color mode Pin
storein26-Jul-02 18:55
storein26-Jul-02 18:55 
GeneralRe: Tiff image format and CMYK color mode Pin
Chris Losinger27-Jul-02 5:46
professionalChris Losinger27-Jul-02 5:46 
GeneralRe: Tiff image format and CMYK color mode Pin
storein27-Jul-02 20:00
storein27-Jul-02 20:00 
GeneralHelp me . Pin
storein28-Jul-02 16:47
storein28-Jul-02 16:47 
GeneralRe: Help me . Pin
storein28-Jul-02 20:50
storein28-Jul-02 20:50 
Generalhelp me Pin
Anonymous26-Jul-02 18:28
Anonymous26-Jul-02 18:28 
GeneralRe: help me Pin
Ken Mazaika26-Jul-02 18:33
Ken Mazaika26-Jul-02 18:33 
GeneralRe: help me Pin
perlmunger26-Jul-02 18:44
perlmunger26-Jul-02 18:44 
GeneralRe: help me Pin
Peter Occil26-Jul-02 18:52
Peter Occil26-Jul-02 18:52 
GeneralRe: help me Pin
perlmunger27-Jul-02 5:21
perlmunger27-Jul-02 5:21 
GeneralRe: help me Pin
Tim Smith27-Jul-02 5:25
Tim Smith27-Jul-02 5:25 
GeneralGo Go Gadget Sockets!!! Pin
Ken Mazaika26-Jul-02 18:13
Ken Mazaika26-Jul-02 18:13 
GeneralUser define iostream manipulators with parameters Pin
oRion26-Jul-02 15:44
oRion26-Jul-02 15:44 
GeneralRe: User define iostream manipulators with parameters Pin
Christian Graus26-Jul-02 21:42
protectorChristian Graus26-Jul-02 21:42 

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.