当前位置: 首页>>代码示例>>C++>>正文


C++ Cylinder::isSwapped方法代码示例

本文整理汇总了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];
	}
    }
//.........这里部分代码省略.........
开发者ID:heididahl,项目名称:GoTools,代码行数:101,代码来源:repairInvalidBoundedSurfaces.C


注:本文中的Cylinder::isSwapped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。