KJB
line.h
Go to the documentation of this file.
1 // line.h - utils for drawing or traversing lines
3 // Author: Franklin Antonio -- the integer routine was adapted from
4 // Graphics Gems, by Doron Tal
5 // Date last modified: April, 2000
6
7 #ifndef _LINE_H
8 #define _LINE_H
9
10 namespace DTLib {
11
13  // INTERFACE:
15
17  // From Graphics Gems. Modifications by Doron Tal: (a) removed
18  // code to compute the intersection itself, just computing the
19  // boolean of whether the intersection occurred or not, for speed
20  // (b) float line coordinates are handled, no shorts or longs.
21  // POSTCONDITION: returns true if the line passing through (x1,
22  // y1) and (x2, y2) and the line passing through (x3, y3) and (x4,
23  // y4) intersect each other.
24
25  bool LinesIntersect(const int& x1, const int& y1,
26  const int& x2, const int& y2,
27  const int& x3, const int& y3,
28  const int& x4, const int& y4);
29
30  // same as above, but in float
31  bool LinesIntersect(const float& x1, const float& y1,
32  const float& x2, const float& y2,
33  const float& x3, const float& y3,
34  const float& x4, const float& y4);
35
36 } // namespace DTLib {
37
38 #endif /* #ifndef _LINE_H */
39
40 // www.homefindersbulletin.com
y2
Definition: APPgetLargeConnectedEdges.m:125
x1
Definition: APPgetLargeConnectedEdges.m:122
y1
Definition: APPgetLargeConnectedEdges.m:124
x2
Definition: APPgetLargeConnectedEdges.m:123
bool LinesIntersect(const int &x1, const int &y1, const int &x2, const int &y2, const int &x3, const int &y3, const int &x4, const int &y4)
Definition: line.cpp:24