SFML community forums

Help => Graphics => Topic started by: Travnick on February 02, 2011, 10:10:04 pm

Title: Getting current position of the point
Post by: Travnick on February 02, 2011, 10:10:04 pm
there is function
Code: [Select]
Polygon.GetPointPosition(i)

but it only returns posiotion which was defined at the creating shape.

i wanna get actual position of points that is actualy rendered on the screen (shape was moved, rotated, scaled etc. and i wanna know where exactly is my point on the screen)

as far as I found there is
Code: [Select]
const Matrix3& GetMatrix() const;
and it probably contains what I want, but this function is protected

any solution?
Title: Getting current position of the point
Post by: Grimshaw on February 02, 2011, 10:41:34 pm
The points are still right, but relative to the Shape Position, i think you could do it easy calculating yourself

Not sure if there is any other way : )
Title: Getting current position of the point
Post by: Travnick on February 02, 2011, 11:13:27 pm
I can calculate them, but it will be wasting time, because positions have been already calculated (they are rendered at this positions)
Title: Getting current position of the point
Post by: Grimshaw on February 02, 2011, 11:47:10 pm
They are calculated by opengl every draw using the transform matrix for the vertex set.

:)
Title: Getting current position of the point
Post by: Laurent on February 03, 2011, 07:43:50 am
Code: [Select]
Polygon.TransformToGlobal(point);
Title: Getting current position of the point
Post by: Travnick on February 03, 2011, 07:33:28 pm
sounds nice, I'll check it
thx