本文整理汇总了C++中Cylinder::isSwapped方法的典型用法代码示例。如果您正苦于以下问题:C++ Cylinder::isSwapped方法的具体用法?C++ Cylinder::isSwapped怎么用?C++ Cylinder::isSwapped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cylinder
的用法示例。
在下文中一共展示了Cylinder::isSwapped方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fixParCvCrossingCylinderSeem
// @@sbr This method should be moved to BoundedSurface. The method is
// not that straight forward when handling other closed sfs as we may
// not assume that the surface is cyclic with a common period. For
// these cases we may have to split the surface up into smaller
// pieces. And then it makes sense to use an external routine
// (i.e. not a BoundedSurface member function).
bool fixParCvCrossingCylinderSeem(BoundedSurface* trimmed_cyl)
{
MESSAGE("Under construction!");
if (trimmed_cyl->underlyingSurface()->instanceType() != Class_Cylinder)
{
return false;
}
Cylinder* cyl = dynamic_cast<Cylinder*>(trimmed_cyl->underlyingSurface().get());
bool params_swapped = cyl->isSwapped();
RectDomain rect_dom = cyl->containingDomain();
// We may not assume that the cylinder is parametrized on [0, 2*M_PI).
// We run through all the bd_cvs, extracting the convex hull of
// the coefs of the parameter cvs. Comparing this with the domain
// of the cylinder we can decide if we should and are able to move
// the seem. We only need to look at the outer loop (the first)
// to test for crossing of seem and possibly the translation
// vector.
shared_ptr<CurveLoop> outer_loop = trimmed_cyl->loop(0);
vector<BoundingBox> par_bd_boxes;
vector<ParamCurve*> par_cvs(outer_loop->size());
#ifndef NDEBUG
CurveOnSurface* first_cv_on_sf = dynamic_cast<CurveOnSurface*>((*outer_loop)[0].get());
assert(first_cv_on_sf != NULL);
Point space_cv_pt = first_cv_on_sf->spaceCurve()->point(first_cv_on_sf->spaceCurve()->startparam());
Point par_cv_pt =
first_cv_on_sf->parameterCurve()->point(first_cv_on_sf->parameterCurve()->startparam());
Point sf_pt = cyl->ParamSurface::point(par_cv_pt[0], par_cv_pt[1]);
#endif
for (size_t ki = 0; ki < outer_loop->size(); ++ki)
{
CurveOnSurface* cv_on_sf = dynamic_cast<CurveOnSurface*>((*outer_loop)[ki].get());
assert(cv_on_sf != 0);
ParamCurve* par_cv = cv_on_sf->parameterCurve().get();
par_cvs[ki] = par_cv;
if (par_cv != 0)
{
BoundingBox par_bd_box(2);
SplineCurve* spline_cv = par_cv->geometryCurve();
Point lin_dir;
double eps = 1e-05;
if (spline_cv != NULL)
{
// Not handling rational cases at the moment.
assert(!spline_cv->rational());
// vector<double>
par_bd_box.setFromArray(spline_cv->coefs_begin(), spline_cv->coefs_end(), 2);
}
else if (par_cv->isLinear(lin_dir, eps))
{
vector<Point> pts(2);
pts[0] = par_cv->point(par_cv->startparam());
pts[1] = par_cv->point(par_cv->endparam());
par_bd_box.setFromPoints(pts);
}
else
{
MESSAGE("Case not handled!");
return false;
}
par_bd_boxes.push_back(par_bd_box);
}
}
// We then run through all the bd_box elements, checking if they line inside the RectDomain of the cylinder.
// We may assume that the cylinder is closed in the u-direction.
bool closed_dir_u, closed_dir_v;
cyl->isClosed(closed_dir_u, closed_dir_v);
if (params_swapped)
{
std::swap(closed_dir_u, closed_dir_v);
}
assert(closed_dir_u && (!closed_dir_v));
double umin = rect_dom.umin();
double umax = rect_dom.umax();
double u_low = umax;
double u_high = umin;
for (size_t ki = 0; ki < par_bd_boxes.size(); ++ki)
{
Point low = par_bd_boxes[ki].low();
if (low[0] < u_low)
{
u_low = low[0];
}
Point high = par_bd_boxes[ki].high();
if (high[0] > u_high)
{
u_high = high[0];
}
}
//.........这里部分代码省略.........