~eliasnaur/gio

3 3

wording in io/pointer#Event.Position

Details
Message ID
<CA+ctqrq6nj0j1Cs=V56yqmHhDeHX9W2T+nRUyREy-FZBrDcxBA@mail.gmail.com>
DKIM signature
missing
Download raw message
The comment on https://pkg.go.dev/gioui.org/io/pointer#Event :
	// Position is the position of the event, relative to
	// the current transformation, as set by op.TransformOp.
	Position f32.Point

What's the intended semantics of "relative"? How is position relative
to a transformation?

thanks!
Details
Message ID
<CAHe4cPnuLrAof7pWkRQn8wJTbp-YsEAXRxrR4LQXHYqQQnpkMg@mail.gmail.com>
In-Reply-To
<CA+ctqrq6nj0j1Cs=V56yqmHhDeHX9W2T+nRUyREy-FZBrDcxBA@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
>
> What's the intended semantics of "relative"? How is position relative
> to a transformation?
>

As I understand it, a 2d point is described by two coordinates, where
each coordinate measures some distance from an origin along (usually)
perpendicular axes. You can phrase this a different way to say that
the point describes a location _relative_ to the origin. In this case,
the origin for the point has been transformed (i.e. shifted, rotated,
etc) to a different place, so the origin for the point is no longer
the top-left corner of the window. Thus, the location described by the
point is relative to the transformation, not relative to the top-left
corner of the window.
Details
Message ID
<CAMAFT9XnK-L9xBceh9i53YkJ2=FC8VmDuoCbRJZZAo7O0Jyu2g@mail.gmail.com>
In-Reply-To
<CAHe4cPnuLrAof7pWkRQn8wJTbp-YsEAXRxrR4LQXHYqQQnpkMg@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Wed, 15 Nov 2023 at 07:40, Jeff Williams <kanobe@gmail.com> wrote:
>
> >
> > What's the intended semantics of "relative"? How is position relative
> > to a transformation?
> >
>
> As I understand it, a 2d point is described by two coordinates, where
> each coordinate measures some distance from an origin along (usually)
> perpendicular axes. You can phrase this a different way to say that
> the point describes a location _relative_ to the origin. In this case,
> the origin for the point has been transformed (i.e. shifted, rotated,
> etc) to a different place, so the origin for the point is no longer
> the top-left corner of the window. Thus, the location described by the
> point is relative to the transformation, not relative to the top-left
> corner of the window.

Correct, the position is in the local coordinate system of the receiving tag.
I've (hopefully) cleared up the documentation in

https://git.sr.ht/~eliasnaur/gio/commit/23b6f06e3e0bd85cc52d928f418db4d6692b39a7

Elias
Details
Message ID
<CA+ctqrpvU-j=8AADB=9ktNm86vgXL1=fgsZqPK4X5WUQ5WkbRQ@mail.gmail.com>
In-Reply-To
<CAMAFT9XnK-L9xBceh9i53YkJ2=FC8VmDuoCbRJZZAo7O0Jyu2g@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
Cool, thanks all!

On 11/15/23, Elias Naur <mail@eliasnaur.com> wrote:
> On Wed, 15 Nov 2023 at 07:40, Jeff Williams <kanobe@gmail.com> wrote:
>>
>> >
>> > What's the intended semantics of "relative"? How is position relative
>> > to a transformation?
>> >
>>
>> As I understand it, a 2d point is described by two coordinates, where
>> each coordinate measures some distance from an origin along (usually)
>> perpendicular axes. You can phrase this a different way to say that
>> the point describes a location _relative_ to the origin. In this case,
>> the origin for the point has been transformed (i.e. shifted, rotated,
>> etc) to a different place, so the origin for the point is no longer
>> the top-left corner of the window. Thus, the location described by the
>> point is relative to the transformation, not relative to the top-left
>> corner of the window.
>
> Correct, the position is in the local coordinate system of the receiving
> tag.
> I've (hopefully) cleared up the documentation in
>
> https://git.sr.ht/~eliasnaur/gio/commit/23b6f06e3e0bd85cc52d928f418db4d6692b39a7
>
> Elias
>
Reply to thread Export thread (mbox)