本文整理汇总了C++中Bounds::expandBy方法的典型用法代码示例。如果您正苦于以下问题:C++ Bounds::expandBy方法的具体用法?C++ Bounds::expandBy怎么用?C++ Bounds::expandBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bounds
的用法示例。
在下文中一共展示了Bounds::expandBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Bounds
Geometry::getBounds() const
{
Bounds bounds;
for( const_iterator i = begin(); i != end(); ++i )
bounds.expandBy( i->x(), i->y(), i->z() );
return bounds;
}
示例2: inBounds
bool
CubeSpatialReference::transformExtentToMBR(const SpatialReference* to_srs,
double& in_out_xmin,
double& in_out_ymin,
double& in_out_xmax,
double& in_out_ymax ) const
{
// input bounds:
Bounds inBounds(in_out_xmin, in_out_ymin, in_out_xmax, in_out_ymax);
Bounds outBounds;
// for each CUBE face, find the intersection of the input bounds and that face.
for (int face = 0; face < 6; ++face)
{
Bounds faceBounds( (double)(face), 0.0, (double)(face+1), 1.0);
Bounds intersection = faceBounds.intersectionWith(inBounds);
// if they intersect (with a non-zero area; abutting doesn't count in this case)
// transform the intersection and include in the result.
if (intersection.isValid() && intersection.area2d() > 0.0)
{
double
xmin = intersection.xMin(), ymin = intersection.yMin(),
xmax = intersection.xMax(), ymax = intersection.yMax();
if (transformInFaceExtentToMBR(to_srs, face, xmin, ymin, xmax, ymax))
{
outBounds.expandBy(Bounds(xmin, ymin, xmax, ymax));
}
}
}
if (outBounds.valid())
{
in_out_xmin = outBounds.xMin();
in_out_ymin = outBounds.yMin();
in_out_xmax = outBounds.xMax();
in_out_ymax = outBounds.yMax();
return true;
}
else
{
return false;
}
}