Re: Rounding with #xywh=percent:25,25,50,50

Hi Philip,

> xywh=percent:a,b,c,d with a+c <= 100, b+d <= 100: the UA displays a
> spatial fragment with coordinates (in pixel xywh format) floor(a/w*100),
> floor(b/h*100), ceil(c/w*100), ceil(d/h*100) (the normal percent case).
>
> Unfortunately, the formula is wrong for the right and bottom edge, as
> ceil(w) != ceil(x+w) - floor(x), try e.g. x=12.5 and w=50:
>
> ceil(50) = 50
> ceil(12.5+50) - floor(12.5) = 63 - 12 = 51
>
> In other words, it is the right/bottom edge that must be ceil'd, not the
> width/height.

Arg! Thanks for the careful reading!
So, would this text work?

   xywh=percent:a,b,c,d with a+c <= 100, b+d <= 100:
   the UA displays a  spatial fragment with coordinates (in pixel xywh 
format)
     floor(a/w*100), floor(b/h*100), ceil((c+w)/w*100)-floor(a/w*100), 
ceil((d+h)/h*100)-floor(b/h*100)

Best regards.

   Raphaël

-- 
Raphaël Troncy
EURECOM, Multimedia Communications Department
2229, route des Crêtes, 06560 Sophia Antipolis, France.
e-mail: raphael.troncy@eurecom.fr & raphael.troncy@gmail.com
Tel: +33 (0)4 - 9300 8242
Fax: +33 (0)4 - 9000 8200
Web: http://www.eurecom.fr/~troncy/

Received on Tuesday, 3 January 2012 13:31:44 UTC