开发者

In the .NET framework, why are there PointF (float) and no "PointD" (double)?

开发者 https://www.devze.com 2023-01-06 18:05 出处:网络
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)?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消