本文整理汇总了C++中Polyline::getPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyline::getPoint方法的具体用法?C++ Polyline::getPoint怎么用?C++ Polyline::getPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyline
的用法示例。
在下文中一共展示了Polyline::getPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isLineSegmentIntersecting
bool isLineSegmentIntersecting(const Polyline& ply, GEOLIB::Point const& s0, GEOLIB::Point const& s1)
{
const size_t n(ply.getNumberOfPoints() - 1);
bool intersect(false);
GEOLIB::Point intersection_pnt;
for (size_t k(0); k < n && !intersect; k++)
{
intersect = MathLib::lineSegmentIntersect(*(ply.getPoint(k)), *(ply.getPoint(k + 1)), s0, s1, intersection_pnt);
}
return intersect;
}
示例2: convertFromPolyline
void BezierSpline::convertFromPolyline(const Polyline &polyline, int smooth_coefficient)
{
float scale = 1.0/smooth_coefficient;
int n = polyline.numPoints();
assert(n >= 2);
for (int i = 0; i < n; ++i)
addControlPoint(polyline.getPoint(i));
// for (int i = 0; i < n; ++i)
// {
// if (i == 0) // is first
// {
// Eigen::Vector3f p1 = polyline.getPoint(i);
// Eigen::Vector3f p2 = polyline.getPoint(i+1);
// Eigen::Vector3f tangent = (p2 - p1);
// Eigen::Vector3f q1 = p1 + scale * tangent;
// addControlPoint(p1);
// addControlPoint(q1);
// } else if (i == n - 1)
// {
// Eigen::Vector3f p0 = polyline.getPoint(i-1);
// Eigen::Vector3f p1 = polyline.getPoint(i);
// Eigen::Vector3f tangent = (p1 - p0);
// Eigen::Vector3f q0 = p1 - scale * tangent;
// addControlPoint(q0);
// addControlPoint(p1);
// } else
// {
// Eigen::Vector3f p0 = polyline.getPoint(i-1);
// Eigen::Vector3f p1 = polyline.getPoint(i);
// Eigen::Vector3f p2 = polyline.getPoint(i+1);
// Eigen::Vector3f tangent = (p2 - p0).normalized();
// Eigen::Vector3f q0 = p1 - scale * tangent * (p1 - p0).norm();
// Eigen::Vector3f q1 = p1 + scale * tangent * (p2 - p1).norm();
// addControlPoint(q0);
// addControlPoint(p1);
// addControlPoint(q1);
// }
// }
setClosed(polyline.closed());
}
示例3: isPartOfPolylineInPolygon
bool Polygon::isPartOfPolylineInPolygon(const Polyline& ply) const
{
const std::size_t ply_size (ply.getNumberOfPoints());
// check points
for (std::size_t k(0); k < ply_size; k++) {
if (isPntInPolygon (*(ply.getPoint(k)))) {
return true;
}
}
GeoLib::Point s;
for (auto polygon_seg : *this) {
for (auto polyline_seg : ply) {
if (GeoLib::lineSegmentIntersect(polyline_seg, polygon_seg, s)) {
return true;
}
}
}
return false;
}