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

    <legend id='ZirFW'><style id='ZirFW'><dir id='ZirFW'><q id='ZirFW'></q></dir></style></legend>

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

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

      檢查一個點是否在指定的 Rectangle 內

      checking if a point is inside a specified Rectangle(檢查一個點是否在指定的 Rectangle 內)
        <legend id='Buz94'><style id='Buz94'><dir id='Buz94'><q id='Buz94'></q></dir></style></legend>

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

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

            <tfoot id='Buz94'></tfoot>
                <bdo id='Buz94'></bdo><ul id='Buz94'></ul>
              • 本文介紹了檢查一個點是否在指定的 Rectangle 內的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                好的,所以我正在為一個 Java 類進行分配,其中一部分是確定一個點是否在矩形的尺寸范圍內.所以我創建了這段代碼:

                ok, so i'm doing an assignment for a Java class and one part of the assignment is to find out if a point is within the dimensions of a rectangle. so I created this code:

                public boolean contains(Point p) {
                    return (this.getLocation().getX() < p.getX() && this.getLocation().getY() < p.getY() &&
                            this.getLocation().getX() + this.getWidth() > p.getX()  &&
                            this.getLocation().getY() + this.getHeight() > p.getY());
                }
                

                我也創建了一個 Point 類,這就是我要求 Point p 參數的原因.為了測試這個 boolean 我在我的 Main 類中創建了一個簡單的 if 語句:

                I created a Point class as well, which is why I asked for a Point p parameter. To test this boolean I created a simple if statement in my Main class:

                //check if one rectangle's point is inside another
                if (rectangle.contains(rectangle2.getLocation()))
                    System.out.println("the point is in the rectangle");
                

                點的位置是(6,7).矩形 1 的點、寬和高分別為 (4,5)、9 和 3.我知道這一點在第一個矩形內,但是 println 語句沒有顯示,這意味著我創建的 boolean 肯定有問題,但我沒有'沒有看到錯誤,也許我的頭是多云的,但有人可以向我指出這里有什么問題嗎?

                The location of the point is (6,7). The point, width, and height of rectangle 1 is (4,5), 9, and 3, respectively. I know for a fact that this point is inside the first rectangle, but the println statement is not showing, meaning there must be a problem with the boolean i created but I don't see an error, maybe my head is cloudy but can someone point out to me what's wrong here?

                附:這都是控制臺工作,我不是在處理一些 GUI 或圖形編程.

                P.S. this is all Console work, i'm not dealing with some GUI or graphics programming.

                推薦答案

                我覺得沒問題.我會檢查你的測試用例是否真的有你認為的數字;我還會檢查您的訪問器是否都返回了正確的值(我無法告訴您我將 getX() 實現為 {return this.y;} 的次數).除此之外,這是任何人的猜測.

                It looks ok to me. I would check that your test case actually has the numbers you think it does; I would also check that your accessors are all returning the right values (I can't tell you the number of times I've implemented getX() as {return this.y;}). Other than that it's anyone's guess.

                這篇關于檢查一個點是否在指定的 Rectangle 內的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)
                <i id='0H0QB'><tr id='0H0QB'><dt id='0H0QB'><q id='0H0QB'><span id='0H0QB'><b id='0H0QB'><form id='0H0QB'><ins id='0H0QB'></ins><ul id='0H0QB'></ul><sub id='0H0QB'></sub></form><legend id='0H0QB'></legend><bdo id='0H0QB'><pre id='0H0QB'><center id='0H0QB'></center></pre></bdo></b><th id='0H0QB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0H0QB'><tfoot id='0H0QB'></tfoot><dl id='0H0QB'><fieldset id='0H0QB'></fieldset></dl></div>

                    <tbody id='0H0QB'></tbody>

                  <small id='0H0QB'></small><noframes id='0H0QB'>

                  <tfoot id='0H0QB'></tfoot>

                        • <bdo id='0H0QB'></bdo><ul id='0H0QB'></ul>
                        • <legend id='0H0QB'><style id='0H0QB'><dir id='0H0QB'><q id='0H0QB'></q></dir></style></legend>
                          主站蜘蛛池模板: 国产精品美女一区二区三区 | 亚洲国产成人精品女人久久久 | 99re99| 在线成人 | 亚洲国产欧美日韩 | 国产一区视频在线 | 久久福利网站 | 久久久久国产精品午夜一区 | 欧美久久久久久 | 国产免费拔擦拔擦8x高清 | 国产在线对白 | 欧美一级高清片 | 逼逼网 | 女女百合av大片一区二区三区九县 | 国产一区二区在线91 | 国产乱码精品一区二区三区忘忧草 | av中文字幕在线观看 | 伊人性伊人情综合网 | 国产精品久久网 | 日韩精品一区二区三区视频播放 | 在线欧美 | 91精品国产一区二区三区 | 国产午夜精品理论片a大结局 | 大象视频一区二区 | 综合国产 | 亚洲国产精品自拍 | 噜噜噜色网 | 成人小视频在线免费观看 | 嫩草懂你的影院入口 | 久久国产香蕉 | 在线免费观看毛片 | 日本精品视频在线观看 | 国产精品区二区三区日本 | 国产成人啪免费观看软件 | 91在线一区 | 亚洲一区播放 | 精品在线一区 | 欧美精品一区二区三区在线 | 欧美福利 | 颜色网站在线观看 | 久久久精品久久 |