17 return out <<
"line: " << rhs.
theP1 <<
"," << rhs.
theP2 << endl;
26 double numerator = ((p4.
x-p3.
x)*(theP1.y-p3.
y) - (p4.
y-p3.
y)*(theP1.x-p3.
x));
27 double denominator = ((p4.
y-p3.
y)*(theP2.x-theP1.x) - (p4.
x-p3.
x)*(theP2.y-theP1.y));
32 double ua = numerator/ denominator;
33 result =
ossimDpt(theP1.x + ua*(theP2.x-theP1.x),
34 theP1.y + ua*(theP2.y-theP1.y));
46 double numerator = ((p4.
x-p3.
x)*(theP1.y-p3.
y) - (p4.
y-p3.
y)*(theP1.x-p3.
x));
47 double denominator = ((p4.
y-p3.
y)*(theP2.x-theP1.x) - (p4.
x-p3.
x)*(theP2.y-theP1.y));
52 double ua = numerator/ denominator;
57 theP1.y + ua*(theP2.y-theP1.y));
71 return (theP2-theP1).length();
76 return (theP1 + (theP2-theP1)*.5);
81 if(isPointOnInfiniteLine(point, delta))
83 double minx =
std::min(theP1.x, theP2.x);
84 double miny =
std::min(theP1.y, theP2.y);
85 double maxx =
std::max(theP1.x, theP2.x);
86 double maxy =
std::max(theP1.y, theP2.y);
101 if((point == theP1) || (point == theP2))
107 return (fabs(point.
x - theP1.x) <= delta);
111 return (fabs(point.
y - theP1.y) <= delta);
116 v1 = v1 * (1.0/v1.
length());
118 double s = v1.
x*v2.x + v1.
y*v2.y;
120 double len = (point-p).length();
154 double len = result.
length();
158 result = result*(1.0/len);
bool pointWithin(const ossimDpt &pt, double epsilon=0.0) const
ossimDpt intersectSegment(const ossimLine &line) const
ossimDpt intersectInfinite(const ossimLine &line) const
ossimDpt midPoint() const
bool isPointWithin(const ossimDpt &point, double delta=FLT_EPSILON) const
std::ostream & operator<<(std::ostream &out, const ossimLine &rhs)
bool isPointOnInfiniteLine(const ossimDpt &point, double delta=FLT_EPSILON) const
std::basic_ostream< char > ostream
Base class for char output streams.