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

Author Topic: Shape::line produces 5 points?  (Read 2102 times)

0 Members and 1 Guest are viewing this topic.

Prodigga

  • Newbie
  • *
  • Posts: 2
    • View Profile
Shape::line produces 5 points?
« on: April 22, 2012, 01:25:43 am »
Hey guys in trying to do some collision testing or ray casting with sfml's lines. I am doing a line to line collision check, so I need to know the start and end points of either line. Figured this'd be easy since I specify those 2 points when I create the line using shape::line. But I looked thro the shapes points and instead of 2 points I found 5. And none of them contain the coordinate of the start/end points. Any way I can retreive this?

Prodigga

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Shape::line produces 5 points?
« Reply #1 on: April 22, 2012, 05:00:32 am »
i should probably add that i dont think im using the latest version of SFML. (2?). I am using a customer framework created by my uni, that is built on top of SFML. (basically its just a wrapper for it, because i still get direct access to everything SFML). I've realized it may not be the latest after reading around - ive noticed that i have an input object for input rather than keyboard/mouse/etc. i am at work now and can confirm tonight

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: Shape::line produces 5 points?
« Reply #2 on: April 22, 2012, 06:23:27 am »
The reason is that the "line" shape can have arbitrary thickness - it's essentially a rectangle in the right position.

You should really decouple your physics from rendering anyway. Implement a simple line segment class with intersect method/s. Or google for one, I'm sure they're out there.

 

anything