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

2010-10-20 Thread Jim Graham

Hi Denis,

One clarification:

On 10/20/10 7:11 AM, Denis Lila wrote:

When would the isCW test trigger?  Does it track rev?  What happens
at 180 degrees (is that test reliable for the randomization that might
happen when omxy are directly opposite mxy)?


isCw is used for computing the arc bisector by testing whether the computed
point is on the side it should be (and multiplying by -1 if not), it is used
to compute the sign of cv in drawBezApproxForArc, and for computing rev.


The only reason I ask is
because I think the sign of mmxy is probably controllable by
understanding the input conditions, but this test should be safe
(modulo if it really works at 180 degrees).  If it has failure modes at 180
degrees then reworking the math to produce the right sign in the first
place may be more robust for that case.  A test for this is to render
(0,0) -  (100,0) -  (0,0) with round caps and then rotate it through
360 degrees and see if the round caps invert at various angles.


I already did that. I drew 100 lines like the one you describe. I attached
the results. It never fails. It is still possible that there could be some
case where it fails, but this does prove that such a case would be very rare.


Also, line 256 - does that track rev?


It does. I changed the test to if(rev).


Cool, but above I was also asking the same question about line 231, and 
you provided a lot of information about line 231 (and a test to verify 
it), but didn't answer if the test in line 231 also tracks rev the same 
way...?


...jim


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

2010-10-20 Thread Jim Graham

On 10/20/10 7:54 AM, Denis Lila wrote:

In #2, you have a bunch of I'() || B'() which I read as the slope
of the derivative (i.e. acceleration) is equal, don't you really mean
I() || B() which would mean the original curves should be parallel?
Otherwise you could say I'() == B'(), but I think you want to show
parallels because that shows how you can use the dxy1,dxy4 values as
the parallel equivalents.


Not really. I've updated the comment explaining what || does, and
it should be clearer now. Basically, A(t) || B(t) means that vectors
A(t) and B(t) are parallel (i.e. A(t) = c*B(t), for some nonzero t),
not that curves A and B are parallel at t.


I'm not sure we are on the same page here.

I'() is usually the symbol indicating the derivative of I().  My issue 
is not with the || operator, but with the fact that you are applying it 
to the I'() instead of I().


Also, how is A(t) and B(t) are parallel not the same as the curves A 
and B are parallel at t?


Also, A(t) = c*B(t) is always true for all A and B and all t if you take 
a sample in isolation.  Parallel means something like A(t) = c*B(t) 
with the same value of c for some interval around t, not that the 
values at t can be expressed as a multiple.


Again, I'() || B'() says to me that the derivative curves are parallel, 
not that the original curves are parallel...


...jim


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

2010-10-20 Thread Denis Lila
 Cool, but above I was also asking the same question about line 231,
 and you provided a lot of information about line 231 (and a test to verify
 it), but didn't answer if the test in line 231 also tracks rev the
 same way...?

Oh, no, line 231 isn't mean to be related to rev at all. It just checks
to see on which side of the (omx,omy),(mx,my) chord the computed (mmx, mmy)
is.

Regards,
Denis.

- Jim Graham james.gra...@oracle.com wrote:

 Hi Denis,
 
 One clarification:
 
 On 10/20/10 7:11 AM, Denis Lila wrote:
  When would the isCW test trigger?  Does it track rev?  What
 happens
  at 180 degrees (is that test reliable for the randomization that
 might
  happen when omxy are directly opposite mxy)?
 
  isCw is used for computing the arc bisector by testing whether the
 computed
  point is on the side it should be (and multiplying by -1 if not), it
 is used
  to compute the sign of cv in drawBezApproxForArc, and for computing
 rev.
 
  The only reason I ask is
  because I think the sign of mmxy is probably controllable by
  understanding the input conditions, but this test should be safe
  (modulo if it really works at 180 degrees).  If it has failure
 modes at 180
  degrees then reworking the math to produce the right sign in the
 first
  place may be more robust for that case.  A test for this is to
 render
  (0,0) -  (100,0) -  (0,0) with round caps and then rotate it
 through
  360 degrees and see if the round caps invert at various angles.
 
  I already did that. I drew 100 lines like the one you describe. I
 attached
  the results. It never fails. It is still possible that there could
 be some
  case where it fails, but this does prove that such a case would be
 very rare.
 
  Also, line 256 - does that track rev?
 
  It does. I changed the test to if(rev).
 
   ...jim


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

2010-10-20 Thread Denis Lila
 Also, how is A(t) and B(t) are parallel not the same as the curves A
 and B are parallel at t?

Well, suppose A and B are lines with endpoints (0,0), (2,0) for A
and (0,1),(2,1) for B. Obviously, for all t, A and B are parallel at t.
However let t = 0.5. Then A(t) = (1,0) and B(t) = (1, 1). The vectors
(1,0) and (1,1) are not parallel, so saying A(t) || B(t) is the same
as saying that there exists c such that (1,0) = c*(1,1), which isn't true.

However, A'(t)=(2,0) and B'(t)=(2,0), and the vectors 
(2,0) and (2,0) are parallel.

Does this make more sense?

Regards,
Denis.

- Jim Graham james.gra...@oracle.com wrote:

 On 10/20/10 7:54 AM, Denis Lila wrote:
  In #2, you have a bunch of I'() || B'() which I read as the
 slope
  of the derivative (i.e. acceleration) is equal, don't you really
 mean
  I() || B() which would mean the original curves should be
 parallel?
  Otherwise you could say I'() == B'(), but I think you want to
 show
  parallels because that shows how you can use the dxy1,dxy4 values
 as
  the parallel equivalents.
 
  Not really. I've updated the comment explaining what || does, and
  it should be clearer now. Basically, A(t) || B(t) means that
 vectors
  A(t) and B(t) are parallel (i.e. A(t) = c*B(t), for some nonzero
 t),
  not that curves A and B are parallel at t.
 
 I'm not sure we are on the same page here.
 
 I'() is usually the symbol indicating the derivative of I().  My
 issue 
 is not with the || operator, but with the fact that you are applying
 it 
 to the I'() instead of I().
 
 Also, A(t) = c*B(t) is always true for all A and B and all t if you
 take 
 a sample in isolation.  Parallel means something like A(t) = c*B(t) 
 with the same value of c for some interval around t, not that the 
 values at t can be expressed as a multiple.
 
 Again, I'() || B'() says to me that the derivative curves are
 parallel, 
 not that the original curves are parallel...
 
   ...jim


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

2010-10-20 Thread Jim Graham
Right, but it seemed to me that if omxy was the from vector and mxy 
was the to vector, that the computed mmxy should always be predictably 
on the same side of it, no?  If it was on the wrong side then it 
wouldn't be a random occurence, it must be related to the input data. 
So either it is always on the right side, always on the wrong side (i.e. 
just reverse the rotation in the math), or always on the right/wrong 
side depending on the CWness of the join angle - which would be 
reflected in rev...  No?


...jim

On 10/20/10 10:29 AM, Denis Lila wrote:

Cool, but above I was also asking the same question about line 231,
and you provided a lot of information about line 231 (and a test to verify
it), but didn't answer if the test in line 231 also tracks rev the
same way...?


Oh, no, line 231 isn't mean to be related to rev at all. It just checks
to see on which side of the (omx,omy),(mx,my) chord the computed (mmx, mmy)
is.

Regards,
Denis.

- Jim Grahamjames.gra...@oracle.com  wrote:


Hi Denis,

One clarification:

On 10/20/10 7:11 AM, Denis Lila wrote:

When would the isCW test trigger?  Does it track rev?  What

happens

at 180 degrees (is that test reliable for the randomization that

might

happen when omxy are directly opposite mxy)?


isCw is used for computing the arc bisector by testing whether the

computed

point is on the side it should be (and multiplying by -1 if not), it

is used

to compute the sign of cv in drawBezApproxForArc, and for computing

rev.



The only reason I ask is
because I think the sign of mmxy is probably controllable by
understanding the input conditions, but this test should be safe
(modulo if it really works at 180 degrees).  If it has failure

modes at 180

degrees then reworking the math to produce the right sign in the

first

place may be more robust for that case.  A test for this is to

render

(0,0) -   (100,0) -   (0,0) with round caps and then rotate it

through

360 degrees and see if the round caps invert at various angles.


I already did that. I drew 100 lines like the one you describe. I

attached

the results. It never fails. It is still possible that there could

be some

case where it fails, but this does prove that such a case would be

very rare.



Also, line 256 - does that track rev?


It does. I changed the test to if(rev).


...jim


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

2010-10-20 Thread Jim Graham
OK, I can see how your terminology works now, but it seems odd to me.  I 
never consider re-expressing the coordinates on a curve as a vector and 
basing geometric properties on those constructed vectors.  I either 
consider the points on the curve, or its tangent or its normal - none of 
which is the value you are expressing.  You are, essentially, operating 
on tangent vectors, but you aren't calling them that, you are calling 
them something like the vector of the derivative which is a relative 
(direction only) version of the tangent vector (which has location and 
direction).  When one talks about curves and being parallel, my mind 
tends to think of the tangents of the curves being parallel and tangents 
are directed by the first derivative.


Also, if you are going to use your definition of vector then parallel 
is an odd term to use for values that originate from the same point 
(points considered as a vector are taken to originate from 0,0) - really 
you want those vectors to be collinear, not (just) parallel.


So, either || means the coordinates of the curves expressed as vectors 
are collinear or it means the curves (i.e. the tangents of the curve 
at the indicated point) are parallel.  Saying vector I() is parallel 
to vector B() didn't really have meaning to me based on the above biases.


So, I get your comment now and all of the math makes sense, but the 
terminology seemed foreign to me...


...jim

On 10/20/10 10:48 AM, Denis Lila wrote:

Also, how is A(t) and B(t) are parallel not the same as the curves A
and B are parallel at t?


Well, suppose A and B are lines with endpoints (0,0), (2,0) for A
and (0,1),(2,1) for B. Obviously, for all t, A and B are parallel at t.
However let t = 0.5. Then A(t) = (1,0) and B(t) = (1, 1). The vectors
(1,0) and (1,1) are not parallel, so saying A(t) || B(t) is the same
as saying that there exists c such that (1,0) = c*(1,1), which isn't true.

However, A'(t)=(2,0) and B'(t)=(2,0), and the vectors
(2,0) and (2,0) are parallel.

Does this make more sense?

Regards,
Denis.

- Jim Grahamjames.gra...@oracle.com  wrote:


On 10/20/10 7:54 AM, Denis Lila wrote:

In #2, you have a bunch of I'() || B'() which I read as the

slope

of the derivative (i.e. acceleration) is equal, don't you really

mean

I() || B() which would mean the original curves should be

parallel?

Otherwise you could say I'() == B'(), but I think you want to

show

parallels because that shows how you can use the dxy1,dxy4 values

as

the parallel equivalents.


Not really. I've updated the comment explaining what || does, and
it should be clearer now. Basically, A(t) || B(t) means that

vectors

A(t) and B(t) are parallel (i.e. A(t) = c*B(t), for some nonzero

t),

not that curves A and B are parallel at t.


I'm not sure we are on the same page here.

I'() is usually the symbol indicating the derivative of I().  My
issue
is not with the || operator, but with the fact that you are applying
it
to the I'() instead of I().

Also, A(t) = c*B(t) is always true for all A and B and all t if you
take
a sample in isolation.  Parallel means something like A(t) = c*B(t)
with the same value of c for some interval around t, not that the
values at t can be expressed as a multiple.

Again, I'() || B'() says to me that the derivative curves are
parallel,
not that the original curves are parallel...

...jim