[OpenJDK 2D-Dev] ArcIterator#btan(double)

Ralph Hummeling engineering at hummeling.com
Fri Jul 20 14:55:26 UTC 2018


Dear Java 2D dev team,

I came across your java.awt.geom.ArcIterator class in which an arc 
Bezier control point segment length is determined in method 
btan(double). You arrive at the following equation:
4/3*(1 - cos(a/2))/(sin(a/2))

It is mentioned that this can return NaN for small "a" and so it is 
written as:
4/3*(sin(a/2))/(1 + cos(a/2))

Please note that this relation can also be written as follows:
4/3*tan(a/4)

A performance increase and no NaN issues ;-)


Kind regards,

Ralph Hummeling
+316 5758 1679
Hummeling Engineering BV
www.hummeling.com


More information about the 2d-dev mailing list