Click here to monitor SSC

Bart

Software Engineer - Red Gate Software

.NET Oddities #4

Published Monday, January 09, 2006 3:08 PM

This is sheer genius:

System.Math.Sin( double a )
System.Math.Cos( double a )

...etc

all take an angle in radians as their argument. However:

System.Drawing.Drawing2D.Matrix.Rotate( float angle )
and System.Drawing.Drawing2D.Matrix.Rotate( float angle, MatrixOrder order )

both take the angle in degrees. Who on earth designed this?!??

...

Never mind, it's not that important. I'm just going to take a few deep breaths, get my blood pressure down, and go and make a nice, soothing cup of tea instead... and then I'm going to submit this to thedailywtf.com. For the rest of you, just watch out for this little gotcha: things like this are the reason multi-million dollar space probes go missing.
by Bart Read
Filed Under:

Comments

 

Richard said:

The System.Drawing.Drawing2D.Matrix class is a very thin wrapper over the unmanaged GDI+ Matrix class. Since the unmanaged method takes the angle in degrees, it makes sense for the managed version to do the same.

http://msdn.microsoft.com/library/en-us/gdicpp/GDIPlus/GDIPlusreference/classes/matrixclass/matrixmethods/rotate.asp
January 16, 2006 12:30 PM
 

Bart Read said:

Hi Richard,
Quite so... but then why does the GDI+ matrix class take an angle in degrees? ;)
Bart
August 10, 2006 4:30 AM
You need to sign in to comment on this blog

About Bart Read

Bart has done many things since he started work at Red Gate Software Ltd in August 2004, but nowadays he's (mainly) the product manager for the .NET Developer Tools. He still feels like this is a bit like admitting you were cheering for the Empire whilst watching Star Wars, but for now he's along for the ride. In a previous incarnation he was a project manager leading the .NET Reflector Pro, ANTS Memory Profiler 5, ANTS Performance Profiler 4 & 5, and SQL Prompt 3.0 - 3.6 projects. He still occasionally writes some code and, in the past, has touched the code for most of the Red Gate SQL developer tools... some of them still haven't recovered from the shock. He was born and grew up in Dorset, was educated in Nottingham and London, and likes music and real ale. His photo is extremely misleading.
Latest articles
Backups, What Are They Good For?
 We've heard the confessional story from Pixar that Toy Story 2 was almost lost due to a bad backup, but... Read more...

C# Async: What is it, and how does it work?
 The biggest new feature in C#5 is Async, and its associated Await (contextual) keyword. Anybody who is... Read more...

Handling Deadlocks in SQL Server
 In this excerpt from his book Troubleshooting SQL Server: A Guide for the Accidental DBA, Jonathan... Read more...

SQL VIEW Basics
 SQL Views are essential for the database developer. However, it is common to see them misued, or... Read more...

The PoSh DBA: Grown-Up PowerShell Functions
 Laerte goes step-by-step through the process of tidying up and making more reusable an untidy... Read more...