Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / GetPointInLine()

Author
Message
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 31st Aug 2004 03:35
Hey. This is nothing fancy and im sure people can write their own fine - but for a game im working on I needed to be able to trace a certain amount of steps down a line and return the x,y of that point.
Heres the function I wrote to do it, should work with any line at any angle regardless of co-ordinate positions. Dunno what will happen if you ask to get a point further down the line than the length of the line though


axis 0 is return the X co-ordinate, axis 1 is return the Y. Steps is simply how far down the line (like 5 would return the point 5 pixels down the line)
Maybe someone will find it usful ^^

p4 2.4ghz, 768ddr ram, Geforce FX 5200
Innovate, redefine, recreate whats in your mind. It isnt fate, you decide, only you can cross that line.
BiggAdd
Retired Moderator
20
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 31st Aug 2004 03:59
Coool! I Wrote my own one of those but I lost the paper i wrote it on That will really come in handy!!!! Thanx!

Login to post a reply

Server time is: 2024-11-23 19:51:57
Your offset time is: 2024-11-23 19:51:57