Can anyone explain why, in the .NET framework, there are PointF
structures (using the single-precision float
type) and no "PointD" (using the double-precision double
type)?
Did 开发者_JAVA技巧they establish that such precision would never make sense in the System.Drawing namespace? Is there any other reason?
At the time when GDI+ (the technology which System.Drawing
is based on) was developed, hardware was nowhere near the performance and capability of today, and a Double
-based coordinate system would have imposed a heavy burden on the hardware for very little benefit on the display-end, with displays having the size and resolution that they did. Even with today's monster video cards, we are only this year seeing the ability to do double-precision floating point operations that have acceptable performance, and these are still 1/2 the speed of single-precision ops. So it was a choice of practicality to use Single
types to model the graphics operations.
Today, with WPF, we have a platform which began with an eye toward the next decade or two, and so using Double
to model the coordinate system made sense.
精彩评论