日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

AGG第二十课 agg::ellipse 方法approximation_scale()

發布時間:2025/6/15 编程问答 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AGG第二十课 agg::ellipse 方法approximation_scale() 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?獻給:任何一種方案都是一種折中的選擇,任何一種替代方案都可能會實現同樣的效果。而這完全取決于你是如何思考定位的。請教是學,自學是學,只不過可以站在巨人的肩膀上,你可以看的更加清楚或許走的更遠。

摘自:http://franko.github.io/agg-intro/vertex-source.html

????In the previous section we have seen?agg::path_storage?object. While this object is very flexible and can be used to describe all kind of geometric shapes there are a few other vertex source primitive types. Actually there are not so many of them and we will just discuss the?agg::ellipse?object because it will be also useful to illustrate some important idea.

????The?agg::ellipse?does not share anything with a?agg::path_storage?in term of C++ class hierarchy, all the they have in common is that they implement the basic?methods of a vertex source. You may wonder why the ellipse object can be useful if you can describe it with a?agg::path_storage. The answer is that this latter needs to store a fixed number of vertices that approximate the ellipse for all the possible resolution of the p_w_picpath. The problem is that if you draw a small circle a few vertices can be enough but if the circle is big you are going to need a lot of vertices to have a decent approximation. We will see that with an?agg::ellipse?object the number of points will be adapted on the fly, you just need to use the?approximation_scale()method. Actually the?agg::ellipse?does not store all the coordinates of the vertices but generetes them on the fly when needed using the mathematical equations. As a side effect you will have also a benefit in term of memory usage because an ellipse object will use a very small amount of memory indipendently of the approximation level that you may request.

????At this point we need to explain the?approximation_scale()?method.?approximation_scale()?we need to go back to the coordinates specifications. The coordinates are actually given as double precision floating point number and they may or may not map directly to pixel coordinates. For example we can map some logical coordinates ranging from 0 to 1 to an huge viewport of size 1280x1280. The problem at this point is that an?agg::ellipse?object does not know the mapping between logical coordinates and viewport coordinates. So the idea is that to let?agg::ellipse?adjust correctly the level of approximation you should call the method?approximation_scale()?and pass as an argument the ratio between the viewport coordinates and the logical coordinates. So in the example of the viewport of size 1280x1280 we would need to use?approximation_scale()?with an scale argument of 1280.

We will see later that the?approximation_scale()?is also important with some kind of transformation like Bezier curves that are supposed to generate smooth curves based on a few vertices and some mathematical equations.


轉載于:https://blog.51cto.com/fengyuzaitu/1961908

總結

以上是生活随笔為你收集整理的AGG第二十课 agg::ellipse 方法approximation_scale()的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。