Boost logo

Geometry :

Subject: Re: [geometry] distance and comparable_distance
From: jeffpoly (jfw1000_at_[hidden])
Date: 2012-11-26 13:27:35


hello Barend,

Thanks for your reply, and soryy for delay to post the sample below is the
sampel program,

 typedef model::d2::point_xy<double> point_2d;
 typedef model::linestring<point_2d> linestring_2d;

point_2d lp;
lp = make<point_2d>(31.988994, 7.738198);

linestring_2d ls;
ls.push_back(make<point_2d>(32.0, 9.637687));
ls.push_back(make<point_2d>(32.0, 7.0));
ls.push_back(make<point_2d>(33.544565, 7.0));
ls.push_back(make<point_2d>(33.544565, 9.637687));
ls.push_back(make<point_2d>(32.0, 9.637687));

std::cout << "distance of " << dsv(lp)
        << " to line: " << distance(lp, ls) << std::endl;

std::cout << "comparable_distance of " << dsv(lp)
        << " to line: " << comparable_distance(lp, ls) << std::endl;

This gives the following results:

distance of (31.989, 7.7382) to line: 0.011006
comparable_distance of (31.989, 7.7382) to line: 0.011006

Thanks,
Jeff

--
View this message in context: http://boost-geometry.203548.n3.nabble.com/distance-and-comparable-distance-tp4025140p4025155.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net