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

I've had a few jobs since graduating, but for the last four years I've been settled at Red Gate Software in Cambridge, UK. Over that time I've worked on a wide range of products, both as a developer and as a project manager, including 18 months on SQL Prompt; right now I'm finishing up with ANTS Profiler 4, which we think is going to be amazing - hopefully you will too.

















<January 2006>
SuMoTuWeThFrSa
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234
Virtual Exchange Servers
 Microsoft now supports running Exchange Server 2007 in server virtualization environments, not just on... Read more...

Virtualizing Exchange: points for discussion
 With the increasing acceptance of the use of Virtualization as a means of providing server... Read more...

Encouraging .NET Reflector Add-ins
 Jason Haley is well-known for the resources he's provided to developers who wish to extend Reflector's... Read more...

Using .NET Reflector Add-ins
 .NET Reflector by itself is great, but it really comes into its own with the help of some add-ins. Here... Read more...

Unique Experiences!
 You'd have thought that a unique constraint was an easy concept - Not a bit of it; it can cause a lot... Read more...