第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Point2D Double 不存儲(chǔ)雙精度

Point2D Double 不存儲(chǔ)雙精度

森林海 2021-09-29 13:23:16
所以我正在研究一個(gè)三角形類,我想使用 Point2D.Double 來存儲(chǔ)高精度的點(diǎn)。import java.awt.geom.Point2D.Double;public class Triangle {private Double pointOne = new Double();private Double pointTwo = new Double();private Double pointThree = new Double();private final float PERCISION = 0.009f;public Triangle(double x1, double y1, double x2, double y2, double x3, double y3){    pointOne.x = x1;    pointOne.y = y1;    pointOne.setLocation(x2, y2);    pointOne.setLocation(x3, y3);}public Double getPointOne() {    return pointOne;}public Double getPointTwo() {    return pointTwo;}public Double getPointThree() {    return pointThree;}但是,當(dāng)我在 main 中測試它并輸入下面的代碼時(shí),它會(huì)打印出坐標(biāo),但精度非常低。我嘗試使用浮點(diǎn)數(shù),但它總是以相同的結(jié)果結(jié)束。    Triangle tri = new Triangle( 0.0000, 0.0000, 2.0008, 0.0000, 0.0000, 2.0000);    System.out.println("Point 1 coordinates: (" + tri.getPointOne().getX() + ", " + tri.getPointOne().getY() + ")");    System.out.println("Point 2 coordinates: (" + tri.getPointTwo().getX() + ", " + tri.getPointTwo().getY() + ")");    System.out.println("Point 3 coordinates: (" + tri.getPointThree().getX() + ", " + tri.getPointThree().getY() + ")");這是它打印出來的內(nèi)容,以備不時(shí)之需。點(diǎn) 1 坐標(biāo):(0.0, 2.0)點(diǎn) 2 坐標(biāo):(0.0, 0.0)點(diǎn) 3 坐標(biāo):(0.0, 0.0)理想情況下,這就是我希望它打印出來的內(nèi)容。點(diǎn) 1 坐標(biāo):(0.0000, 2.0008)點(diǎn) 2 坐標(biāo):(0.0000, 0.0000)點(diǎn) 3 坐標(biāo):(0.0000, 0.0000)
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 242 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)