本文整理汇总了C++中SearchPointVector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ SearchPointVector::begin方法的具体用法?C++ SearchPointVector::begin怎么用?C++ SearchPointVector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchPointVector
的用法示例。
在下文中一共展示了SearchPointVector::begin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static FlatGeoPoint
nearest_point_convex(const SearchPointVector& spv, const FlatGeoPoint &p3)
{
unsigned distance_min = 0-1;
SearchPointVector::const_iterator i_best = spv.end();
// find nearest point in vector
for (SearchPointVector::const_iterator i = spv.begin();
i!= spv.end(); ++i) {
unsigned d_this = p3.distance_sq_to(i->get_flatLocation());
if (d_this<distance_min) {
distance_min = d_this;
i_best = i;
}
}
FlatGeoPoint pc = i_best->get_flatLocation();
// find nearest point on this segment
FlatGeoPoint pa = segment_nearest_point(spv,i_best,p3);
if (!(pa == pc)) {
unsigned d_seg = pa.distance_sq_to(p3);
if (d_seg < distance_min) {
distance_min = d_seg;
pc = pa;
}
}
// find nearest point on previous segment
SearchPointVector::const_iterator i_prev;
if (i_best == spv.begin()) {
i_prev = spv.end()-1;
} else {
i_prev = i_best-1;
}
FlatGeoPoint pb = segment_nearest_point(spv,i_prev,p3);
if (!(pb == pc)) {
unsigned d_seg = pb.distance_sq_to(p3);
if (d_seg < distance_min) {
distance_min = d_seg;
pc = pb;
}
}
return pc;
}
示例2:
void
MapCanvas::project(const Projection &projection,
const SearchPointVector &points, RasterPoint *screen)
{
for (auto it = points.begin(); it != points.end(); ++it)
*screen++ = projection.GeoToScreen(it->get_location());
}
示例3:
void
MapCanvas::Project(const Projection &projection,
const SearchPointVector &points, BulkPixelPoint *screen)
{
for (auto it = points.begin(); it != points.end(); ++it)
*screen++ = projection.GeoToScreen(it->GetLocation());
}
示例4: write_spv
void write_spv (const SearchPointVector& spv)
{
for (auto v = spv.begin(); v != spv.end(); ++v) {
write_point(*v, v->get_flatLocation(), "spv");
}
printf("spv\n");
fflush(stdout);
}
示例5: nearest_point
static FlatGeoPoint
segment_nearest_point(const SearchPointVector& spv,
const SearchPointVector::const_iterator i1,
const FlatGeoPoint &p3)
{
if (i1+1 == spv.end()) {
return nearest_point(i1->get_flatLocation(),
spv.begin()->get_flatLocation(),
p3);
} else {
return nearest_point(i1->get_flatLocation(),
(i1+1)->get_flatLocation(),
p3);
}
}
示例6: NearestPoint
gcc_pure
static FlatGeoPoint
SegmentNearestPoint(const SearchPointVector& spv,
const SearchPointVector::const_iterator i1,
const FlatGeoPoint &p3)
{
if (i1+1 == spv.end()) {
return NearestPoint(i1->GetFlatLocation(),
spv.begin()->GetFlatLocation(),
p3);
} else {
return NearestPoint(i1->GetFlatLocation(),
(i1 + 1)->GetFlatLocation(),
p3);
}
}
示例7: SegmentNearestPoint
static FlatGeoPoint
NearestPointNonConvex(const SearchPointVector& spv, const FlatGeoPoint &p3)
{
unsigned distance_min = 0-1;
FlatGeoPoint point_best;
for (SearchPointVector::const_iterator i = spv.begin();
i!= spv.end(); ++i) {
FlatGeoPoint pa = SegmentNearestPoint(spv,i,p3);
unsigned d_this = p3.distance_sq_to(pa);
if (d_this<distance_min) {
distance_min = d_this;
point_best = pa;
}
}
return point_best;
}
示例8: size
GrahamScan::GrahamScan(SearchPointVector& sps, const fixed sign_tolerance):
raw_points(sps.begin(), sps.end()), raw_vector(sps), size(sps.size()),
tolerance(sign_tolerance)
{
}