# [OpenJDK 2D-Dev] X11 uniform scaled wide lines and dashed lines; STROKE_CONTROL in Pisces

Jim Graham james.graham at oracle.com
Tue Dec 28 15:00:17 PST 2010

```Aha!

I finally figured out what I was missing.

On 12/24/2010 4:43 PM, Denis Lila wrote:
>> Line 1133 - I don't understand why that term has -q in it. The above
>> link and the original code both computed essentially the arccos of
>> this

Basically, the negative comes in when you push all of the p terms back
inside the sqrt().

= (q/p)*sqrt(-1/p)
= (-q/-p)*sqrt(-1/p)
= -q*(-1/p)*sqrt(-1/p)
= -q/(-p*sqrt(-p))
= -q/(sqrt(-p^3)
which is what you calculate, so we are not calculating the negative of
the angle after all - we are calculating the same angle using different
math.  (Though it begs the question - is "-q/sqrt(-p^3)" more accurate
than "-q/(p*sqrt(-p)"?  If p is < 1 then the cube is an even smaller
number, does that matter?)

> Let X = (3q/2p)*sqrt(-3/p) where p and q are the ones from the wikipedia
> article, not our code.
> So, when we do ret[0] = t * cos(phi), that's:
>                        = t * cos(acos(-X))

actually, it really was t*cos(acos(X)), not -X.

>                        = t * cos(pi/3 - acos(X))
>                        = t * cos(acos(X) - pi/3)
>                        = t * cos(acos(X) - pi/3 - pi)

There was an error here in this step as well, this line should read:
= t * cos(acos(X) - pi/3 - 2pi)
= t * cos(acos(X) -7pi/3)
= nothing because this isn't our math... ;-)

> I unfortunately don't have access to the icedtea servers at this moment,
> so I attached a patch. I hope that's ok.

Have you updated the webrev yet?

...jim

```