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

Krishna Addepalli krishna.addepalli at oracle.com
Mon Aug 13 06:39:50 UTC 2018


Dear Ralph,

Thanks for pointing this out, could you also come up with a patch for the same?

Thanks,
Krishna

-----Original Message-----
From: Ralph Hummeling <engineering at hummeling.com> 
Sent: Friday, July 20, 2018 8:25 PM
To: 2d-dev at openjdk.java.net
Cc: james.graham at oracle.com
Subject: [OpenJDK 2D-Dev] ArcIterator#btan(double)

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