久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='IulrE'></small><noframes id='IulrE'>

    <tfoot id='IulrE'></tfoot>
    <legend id='IulrE'><style id='IulrE'><dir id='IulrE'><q id='IulrE'></q></dir></style></legend>

    • <bdo id='IulrE'></bdo><ul id='IulrE'></ul>

    <i id='IulrE'><tr id='IulrE'><dt id='IulrE'><q id='IulrE'><span id='IulrE'><b id='IulrE'><form id='IulrE'><ins id='IulrE'></ins><ul id='IulrE'></ul><sub id='IulrE'></sub></form><legend id='IulrE'></legend><bdo id='IulrE'><pre id='IulrE'><center id='IulrE'></center></pre></bdo></b><th id='IulrE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IulrE'><tfoot id='IulrE'></tfoot><dl id='IulrE'><fieldset id='IulrE'></fieldset></dl></div>

        如何計算 java.awt.geom.Area 的面積?

        How to calculate the area of a java.awt.geom.Area?(如何計算 java.awt.geom.Area 的面積?)

          <small id='Cawop'></small><noframes id='Cawop'>

              <bdo id='Cawop'></bdo><ul id='Cawop'></ul>
              <i id='Cawop'><tr id='Cawop'><dt id='Cawop'><q id='Cawop'><span id='Cawop'><b id='Cawop'><form id='Cawop'><ins id='Cawop'></ins><ul id='Cawop'></ul><sub id='Cawop'></sub></form><legend id='Cawop'></legend><bdo id='Cawop'><pre id='Cawop'><center id='Cawop'></center></pre></bdo></b><th id='Cawop'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Cawop'><tfoot id='Cawop'></tfoot><dl id='Cawop'><fieldset id='Cawop'></fieldset></dl></div>
              <legend id='Cawop'><style id='Cawop'><dir id='Cawop'><q id='Cawop'></q></dir></style></legend>
              <tfoot id='Cawop'></tfoot>
                <tbody id='Cawop'></tbody>

                • 本文介紹了如何計算 java.awt.geom.Area 的面積?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在尋找一種方法來計算 java.awt.geom.Area 的任意實例的面積(以像素為單位).

                  I am looking for a way to calculate the area, in pixels, of an arbitrary instance of java.awt.geom.Area.

                  背景:我的應用程序中有可能重疊的 Shape.我想知道一個 Shape 與另一個重疊多少.Shape 可能會傾斜、旋轉等.如果我有一個函數 area(Shape)(或 Area),我可以使用兩個 Shape 的交集如下:

                  The background: I have Shapes in my applications that may overlap. I want to know how much one Shape overlaps another. The Shapes may be skewed, rotated, etc. If I had a function area(Shape) (or Area), I could use the intersection of two Shapes like so:

                  double fractionObscured(Shape bottom, Shape top) {
                      Area intersection = new Area(bottom);
                      intersection.intersect(new Area(top));
                      return area(intersection) / area(bottom);
                  }
                  

                  推薦答案

                  一種方法是 fill() 每個都按比例縮放和 轉換 Shape 使用合適的 AlphaComposite 和計算底層 中的重疊像素光柵.

                  One approach would be to fill() each scaled and transformed Shape with a different color using a suitable AlphaComposite and count the overlapping pixels in the underlying Raster.

                  附錄1:使用這個計算器查看AlphaComposite.Xor表明任意兩種不透明顏色的交集為零.

                  Addendum 1: Using this calculator to see the effect of AlphaComposite.Xor shows that the intersetion of any two opaque colors is zero.

                  附錄2:計數像素可能存在性能問題;采樣可能會有所幫助.如果每個 Shape 是相當凸的,可以從 intersect() 面積為 的面積之和Shapes' getBounds2D().例如,

                  Addendum 2: Counting pixels may have performance problems; sampling may help. If each Shape is reasonably convex, it may be possible to estimate the overlap from the ratio of the intersect() area to the sum of the areas of the Shapes' getBounds2D(). For example,

                  Shape s1, s2 ...
                  Rectangle2D r1 = s1.getBounds2D();
                  Rectangle2D r2 = s2.getBounds2D();
                  Rectangle2D r3 = new Rectangle2D.Double();
                  Rectangle2D.intersect(r1, r2, r3);
                  double overlap = area(r3) / (area(r1) + area(r2));
                  ...
                  private double area(Rectangle2D r) {
                      return r.getWidth() * r.getHeight();
                  }
                  

                  您可能需要憑經驗驗證結果.

                  You may need to validate the results empirically.

                  這篇關于如何計算 java.awt.geom.Area 的面積?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                    <legend id='SK6gv'><style id='SK6gv'><dir id='SK6gv'><q id='SK6gv'></q></dir></style></legend>
                    <i id='SK6gv'><tr id='SK6gv'><dt id='SK6gv'><q id='SK6gv'><span id='SK6gv'><b id='SK6gv'><form id='SK6gv'><ins id='SK6gv'></ins><ul id='SK6gv'></ul><sub id='SK6gv'></sub></form><legend id='SK6gv'></legend><bdo id='SK6gv'><pre id='SK6gv'><center id='SK6gv'></center></pre></bdo></b><th id='SK6gv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SK6gv'><tfoot id='SK6gv'></tfoot><dl id='SK6gv'><fieldset id='SK6gv'></fieldset></dl></div>
                    1. <small id='SK6gv'></small><noframes id='SK6gv'>

                        <tbody id='SK6gv'></tbody>

                        • <tfoot id='SK6gv'></tfoot>
                          • <bdo id='SK6gv'></bdo><ul id='SK6gv'></ul>

                          • 主站蜘蛛池模板: 亚洲一区有码 | 国产精品一区二区av | 国产电影一区二区在线观看 | 国产成人在线一区二区 | 成人久草 | 久久久精 | 国产在线网址 | 一区二区三区回区在观看免费视频 | 国产成人在线视频播放 | 精品国产乱码久久久久久蜜退臀 | 国产一区二区不卡 | 中文字幕在线观看一区 | 91福利在线导航 | 91p在线观看 | 国产精品一区二区三区久久 | 中文字幕一区二区三区四区五区 | 国产激情片在线观看 | 精品一区二区三区四区 | 少妇一区二区三区 | www.久草| 91精品国产欧美一区二区成人 | 久久精品在线 | 日韩一区二区三区视频 | 久久九九网站 | 国产在线网站 | 日日骚视频 | 天天草夜夜骑 | 91久久精品一区二区二区 | 日韩精品在线观看一区二区 | 一区二区三区回区在观看免费视频 | 中文字幕av网站 | 成人在线精品视频 | www.se91| 国产女人与拘做受免费视频 | 午夜精品久久久久久不卡欧美一级 | 可以在线看的黄色网址 | 91在线精品视频 | 久久国产精品一区二区三区 | 国产成人久久精品一区二区三区 | 久久99精品久久久久久国产越南 | 欧美一级观看 |