On Thu, Apr 24, 2008 at 7:41 AM, Tomas Frydrych <[EMAIL PROTECTED]> wrote:

>
>  Bob Dickinson wrote:
>  > I've run into a problem, either with get_abs_position, or with my
>  > understanding of it.
>  >
>  > I have been using get_abs_position in order to do coordinate
>  > transformations to position actors relative to each other.  I have a
>  > lot of little spacing problems, which I have tracked down to
>  > get_abs_position returning values with a higher granularity than
>  > get_position (on the order of 3-4 pixels when the stage is full
>  > screen).
>  >
>
> > Is get_abs_position broken, or am I using it incorrectly?  The docs
>  > say "Gets the absolute position of an actor, in pixels, relative to
>  > the stage", which does not seem to be the case.
>
>  The error is inherent to the nature of the problem, and the function
>  cannot be expected to be pixel perfect, so that any code that uses it
>  needs to allow for the inherent error. In any case, you should not need
>  it to position actors, since actors are always placed relative to their
>  parent, not the stage. If you need to coordinate the actor positions
>  relative to some other ancestor than the immediate parent, then as you
>  mentioned you need to walk the ancestor hierarchy and do the adding up.
>

I did end up writing a simple method that just walks up to the stage
to compute the position of an actor relative to the stage, which of
course works fine and is pixel perfect.

I understand the approximate nature of get_abs_position, and if for no
other reason than the conversion from clutter units to pixels, I can
see that it might not always be pixel perfect.  But as currently
implemented it's really no more than a gross approximation (it can be
off by as much as 5 pixels in even the simplest test case of a
non-scaled, non-rotated rectangle sitting directly on the stage).  If
this is the intended functionality, then at the very least it seems
that the docs should be updated.  Given the amount of error in the
calculation, I'm wondering when this method should be used (I'm just
having a hard time thinking of a situation where knowing the
approximate location of something would be useful, though such a case
may very well exist).

Bob
-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to