SRL Archive - C/C++ Help and Tutorials

I need to get an array of points...


R0b0t1

2007-11-04 13:59:42

Well, I have two points… A and B. I want to get all of the points in-between them, but I want them split like paint does when you draw lines of whatever.


I don't really want to use any drawing functions if possible - I can't really optimize those. Although I'm not saying they're slow…

Paul23

2007-11-04 16:02:54

Suggestion,

Work out the distances x,y between the two points. (Called idistx, idisty).

Decide how many dots you want, say 10. Your dots will then be idistx/10, idisty/10 apart.

Start at A and add idistx, idisty and store first point (in your array).
Repeat until you reach b.

Is this any help?

Paul

R0b0t1

2007-11-04 20:13:24

Not really… Could you write the equations you are talking about out?


Well, in case you didn't exactly get it, I just want to split lines into smaller contiguous (straight) lines that provide the effect of being at an angle.

Boreas

2007-11-04 22:19:57

edit: nvm just saw its C