久久久久久久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在线亚洲天堂 | 欧美日韩久久久 | 青久草视频 | 成人av电影免费在线观看 | 日韩欧美一区二区三区免费观看 | 亚洲网站在线观看 | 香蕉国产在线视频 | 亚洲国产精品一区二区三区 | 色视频在线免费观看 | 伊人影院99 | 337p日本欧洲亚洲大胆 | 日日欧美 | 国内自拍视频在线观看 | 成人在线免费视频 | 午夜小视频在线观看 | 日韩第1页 | 免费在线观看成人av | 国产精品一区二区不卡 | 久久久久国产一区二区三区四区 | 亚洲一区二区免费 | 日韩在线一区二区三区 | 又黄又爽的网站 | 国产精品视频久久 | 亚洲精品国产综合区久久久久久久 | 欧美成人专区 | 亚洲国产成人av好男人在线观看 | 一区二区三区免费 | 在线中文字幕视频 | 亚洲色欲色欲www | 人人干在线视频 | 亚洲一区二区电影在线观看 | 国产高清免费 | 精品久久国产视频 | 国产1区2区 | 狠狠躁18三区二区一区 | 99精品视频在线 | 操人网| 成人在线一区二区 | 天天草狠狠干 |