Do 2 parallel line segments overlap, and where?
quote:Original post by MrScout
furthermore, if the slopes of the lines are the same, unless they got a point in common, they don''t intersect. (In 2-space!!!!!!)
I know, but if they have a point in common, they''ll overlap, in which case there''s still chance of collision.
quote:Original post by MrScout
But using y=mx+b you still can''t represent a vertical line - you''ll divide by zero!
Now I''m not gonna lecture you over the evils of y=mx+b, but I''ll just tell ya to watch for division by zero. :-/
I know. It''s easily fixed by testing if the start and end x or y are the same. If that''s the case, just set the slope to a really high number. As long as the world dimensions don''t get exorbitantly high, that''ll work fine.
It''s a bit of a hack, but it works well in this particular case, and is far more comprehensible, and thus less error-prone.
In this specific case, mind you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement