Re: [css-masking] CR from 2014-08-26: 'Appendix B: Compute stroke bounding box'

Dirk Schulze:
..
>
> No, just inflate the box with the computed delta as described in the spec.
> Your suggested algorithm should work just fine. Even simpler:
>
> 1) Subtract delta from the rectangle's horizontal and vertical position.
> 2) Double delta and add it to the rectangle’s width and height.
>
> So we have different algorithms but the same outcome arithmetically. The
> used algorithm may depend on the user agent’s internal representation of
> rectangles.
>

It is not the same, simple example:

Input:
delta =2
BoundingBox   x,y,width, height

-1,-1,2,2

StrokeBoundingBox by method A
'
a) Translate the center (the average of the vectors to the corners) of the
    object bounding box to the origin.
b) Multiply data/vectors by delta
c) Apply inverse operation of a)
'


'

result: -2,-2,4,4

StrokeBoundingBox by method B
'
1) Subtract delta from the rectangle's horizontal and vertical position.
2) Double delta and add it to the rectangle’s width and height.
'

result: -3,-3,6,6


General result for A

(x-width/2)*delta +width/2, (y-height/2)*delta +height/2, width*delta, 
height*delta

General result for B

x-delta, y-delta, width+2delta, height+2delta

This is typically not the same ...
However, method A is typically more related to 'inflation' how it is used
for example for finances, recursive functions to generate (graphical)
content (fractals, iterated function systems, pattern like those from Penrose 
etc).
But method B seems more related to how a stroke is applied to a path in
SVG, with this (at least for trivial paths like circles, horizontally aligned 
rectangles or ellipses, did not test others yet) one gets  the smallest 
possible horizontally aligned rectangle around the outline of the stroked
path.  
If something like 'inflate' is really used by some people for this operation,
they have a least a quite different interpretation of the word than others, 
therefore it is even more important either to avoid it or to define it for 
this application. 

>
> > 'Inflate box with the value of delta.'  is in general not testable, at
> > least not with quantitative tests.
> >

This applies, because there is no prose about what is intended with
it, therefore one cannot decide, which algorithm above is more meaningful.
Please add both, short prose explanation about what the stroke bounding box
is and such a short trivial algorithm how to determine the inflated box.

Do you agree, that such a stroke bounding box should be something
with the meaning of:
'The smallest box aligned horizontally and vertically in the local coordinate
system, that contains a stroked object or group of stroked objects (not
excluding objects without stroke)'?

a) If yes:
One issue I will test soon with method B is, whether the rule about 
stroke-miterlimit is really meaningful - 
maybe it fits only for especially selected paths with specific symmetries?
For a shape like a naive heart representation - it has only a line-join 
bottom, no to left, right, top and only one mirror axis - do you think, the
algorithm does the job? Or that the calculated stroke bounding box has
any application for such objects with low or no symmetry?
Did already someone has a larger test collection, how such a box is
related to the stroked object?
The other issue I will test, is the rule for stroke-linecap square
and how this might be related to the calculated box for paths with
no specific symmetry.


b) If no:
What is the intended purpose of this feature?
What are the applications for it?


Olaf

Received on Friday, 5 September 2014 09:46:24 UTC