I'm trying to draw a high precision arc in Java using AWT/Swing. The Graphics class offers the "drawArc" method to do this and in most cases this is fine. However, when the arc has a large radius (I.e. The "width" and "height" parameters are large) then the arc will not be drawn precisely. This is because the "startAngle" and "arcAngle" parameters are given as integer degrees. I'm forced to convert an angle (given in radians) to degrees and then rounding it. The loss of precision leads to the arc falling short of its actual end point (if you round down) or go further than it should (if you round up).
我想用AWT/Swing在Java中畫一個高精度的弧線。圖形類提供了“drawArc”方法來實現這一點,在大多數情況下這是可以的。但是,當圓弧的半徑較大(即“寬度”和“高度”參數較大)時,圓弧就不會被精確地繪制出來。這是因為“startAngle”和“arcAngle”參數是作為整數度給出的。我被迫把一個角度(以弧度表示)轉換成度數,然后把它四舍五入。精度的損失會導致圓弧無法達到它的實際端點(如果你將圓弧向下)或者比它應該走的更遠(如果你將圓弧向上)。
I'm looking for an alternative