Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Getting current position of the point  (Read 2737 times)

0 Members and 1 Guest are viewing this topic.

Travnick

  • Newbie
  • *
  • Posts: 12
    • View Profile
Getting current position of the point
« 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?

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Getting current position of the point
« Reply #1 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 : )

Travnick

  • Newbie
  • *
  • Posts: 12
    • View Profile
Getting current position of the point
« Reply #2 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)

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Getting current position of the point
« Reply #3 on: February 02, 2011, 11:47:10 pm »
They are calculated by opengl every draw using the transform matrix for the vertex set.

:)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Getting current position of the point
« Reply #4 on: February 03, 2011, 07:43:50 am »
Code: [Select]
Polygon.TransformToGlobal(point);
Laurent Gomila - SFML developer

Travnick

  • Newbie
  • *
  • Posts: 12
    • View Profile
Getting current position of the point
« Reply #5 on: February 03, 2011, 07:33:28 pm »
sounds nice, I'll check it
thx