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


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

本文整理汇总了C++中Cylinder::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Cylinder::rotate方法的具体用法?C++ Cylinder::rotate怎么用?C++ Cylinder::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cylinder的用法示例。


在下文中一共展示了Cylinder::rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fixParCvCrossingCylinderSeem


//.........这里部分代码省略.........
		    }
		}
		else
		{
		    if (low[0] < new_u_low)
		    {
			new_u_low = low[0];
		    }
		    if (high[0] > new_u_high)
		    {
			new_u_high = high[0];
		    }
		}
	    }
	}

	u_span = new_u_high - new_u_low;
	if (u_span > 2*M_PI)
	{
	    // We next run through all cvs setting the common translation.
	    MESSAGE("Moving of seem is not enough to handle this case, u_span = " << u_span);
	}
	// new_u_low will be the value used for moving the seem.
	for (size_t ki = 0; ki < par_bd_boxes.size(); ++ki)
	{
	    transl_u[ki] -= new_u_low;
	    cout << "transl_u[ki] = " << transl_u[ki] << endl;
	}

	// We then run through the par_cvs translating the u-values of the coefs.
	cout << "DEBUG: Soon we will handle this case!" << endl;
	// We rotate the cylinder by u_low - new_u_low.
	double rot_ang_deg = new_u_low;
	cyl->rotate(rot_ang_deg);
	// Finally we run through all curve segments and perfomr the translation in the u-dir.
	for (size_t ki = 0; ki < par_cvs.size(); ++ki)
	{
	    if (par_cvs[ki] != NULL)
	    {
		if (par_cvs[ki]->instanceType() == Class_SplineCurve)
		{
		    SplineCurve* spline_cv = dynamic_cast<SplineCurve*>(par_cvs[ki]);
		    vector<double>::iterator iter = spline_cv->coefs_begin();
		    while (iter != spline_cv->coefs_end())
		    {
			iter[0] += transl_u[ki];
			iter += 2;
		    }
		}
		else if (par_cvs[ki]->instanceType() == Class_Line)
		{
		    Line* line = dynamic_cast<Line*>(par_cvs[ki]);
		    Point transl_vec(2, 0.0);
		    transl_vec[0] = transl_u[ki];
		    line->translateCurve(transl_vec);
		}
		else
		{
		    THROW("Unsupported curve type: " << par_cvs[ki]->instanceType());
		}
	    }
	}

#ifndef NDEBUG
	std::ofstream debug("tmp/debug.g2");
	cyl->writeStandardHeader(debug);
开发者ID:heididahl,项目名称:GoTools,代码行数:67,代码来源:repairInvalidBoundedSurfaces.C

示例2: initAxisHandleObjects

void Handle::initAxisHandleObjects()
{
	// assumes none of them have been created yet

	Handle::pObjectXTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
	Handle::pObjectYTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
	Handle::pObjectZTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);

	Handle::pObjectXTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
	Handle::pObjectYTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
	Handle::pObjectZTranslateHandleHead = new Cone(0.2f, 0.07f, 8);

	Cylinder *pX = Handle::pObjectXTranslateHandleLine;
	Cylinder *pY = Handle::pObjectYTranslateHandleLine;
	Cylinder *pZ = Handle::pObjectZTranslateHandleLine;

	pX->setObjectID(eXTranslate);
	pX->setPosition(Point(0.6f, 0.0f, 0.0f));
	pX->rotate(0.0f, 0.0f, 90.0f);
	pX->constructGeometry();

	pY->setObjectID(eYTranslate);
	pY->setPosition(Point(0.0f, 0.6f, 0.0f));
	pY->constructGeometry();

	pZ->setObjectID(eZTranslate);
	pZ->setPosition(Point(0.0f, 0.0f, 0.6f));
	pZ->rotate(-90.0f, 0.0f, 0.0f);
	pZ->constructGeometry();

	Cone *pXHead = Handle::pObjectXTranslateHandleHead;
	Cone *pYHead = Handle::pObjectYTranslateHandleHead;
	Cone *pZHead = Handle::pObjectZTranslateHandleHead;

	pXHead->setObjectID(eXTranslate);
	pXHead->setPosition(Point(1.1f, 0.0f, 0.0f));
	pXHead->rotate(0.0f, 0.0f, -90.0f);
	pXHead->constructGeometry();

	pYHead->setObjectID(eYTranslate);
	pYHead->setPosition(Point(0.0f, 1.1f, 0.0f));
	pYHead->constructGeometry();

	pZHead->setObjectID(eZTranslate);
	pZHead->setPosition(Point(0.0f, 0.0f, 1.1f));
	pZHead->rotate(90.0f, 0.0f, 0.0f);
	pZHead->constructGeometry();

	/// object rotate

	Torus* pXRotate = new Torus(kObjectRotateHandleThickness, kObjectRotateHandleRadius, kObjectRotateHandleSegments, kObjectRotateHandleSides);
	Torus* pYRotate = new Torus(kObjectRotateHandleThickness, kObjectRotateHandleRadius, kObjectRotateHandleSegments, kObjectRotateHandleSides);
	Torus* pZRotate = new Torus(kObjectRotateHandleThickness, kObjectRotateHandleRadius, kObjectRotateHandleSegments, kObjectRotateHandleSides);

	Handle::pObjectXRotateHandleLoop = pXRotate;
	Handle::pObjectYRotateHandleLoop = pYRotate;
	Handle::pObjectZRotateHandleLoop = pZRotate;

	pXRotate->setObjectID(eXRotate);
	pXRotate->rotate(0.0f, 0.0f, -90.0f);
	pXRotate->constructGeometry();

	pYRotate->setObjectID(eYRotate);
	pYRotate->rotate(0.0f, 0.0f, 0.0f);
	pYRotate->constructGeometry();

	pZRotate->setObjectID(eZRotate);
	pZRotate->rotate(90.0f, 0.0f, 0.0f);
	pZRotate->constructGeometry();

	/// face

	Handle::pFaceNormalTranslateHandleLine = new Cylinder(1.0f, 0.03f, 6, 1);
	Handle::pFaceNormalTranslateHandleHead = new Cone(0.2f, 0.07f, 8);
	Handle::pFaceExtrude = new Cube(0.05f);

	Cylinder* pFaceNormalLine = Handle::pFaceNormalTranslateHandleLine;
	pFaceNormalLine->setObjectID(eFaceNormalTranslate);
	pFaceNormalLine->setPosition(Point(0.0f, 0.6f, 0.0f));
	pFaceNormalLine->constructGeometry();

	Cone* pFaceNormalHead = Handle::pFaceNormalTranslateHandleHead;
	pFaceNormalHead->setObjectID(eFaceNormalTranslate);
	pFaceNormalHead->setPosition(Point(0.0f, 1.1f, 0.0f));
	pFaceNormalHead->constructGeometry();

	Cube* pFaceExtrude = Handle::pFaceExtrude;
	pFaceExtrude->setObjectID(eFaceExtrude);
	pFaceExtrude->setPosition(Point(0.0f, 1.4f, 0.0f));
	pFaceExtrude->constructGeometry();

	Handle::pFaceTranslateXLine = new Cylinder(1.0f, 0.03f, 6, 1);
	Handle::pFaceTranslateYLine = new Cylinder(1.0f, 0.03f, 6, 1);

	Cylinder* pFaceTranslateXLine = Handle::pFaceTranslateXLine;
	pFaceTranslateXLine->setObjectID(eFaceTranslateX);
	pFaceTranslateXLine->setRotation(Vector(0.0f, 0.0f, -90.0f));
	pFaceTranslateXLine->setPosition(Point(0.6f, 0.0f, 0.0f));
	pFaceTranslateXLine->constructGeometry();

//.........这里部分代码省略.........
开发者ID:ppearson,项目名称:ImaginePartial,代码行数:101,代码来源:handle.cpp


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