本文整理汇总了C++中Cylinder::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Cylinder::setPosition方法的具体用法?C++ Cylinder::setPosition怎么用?C++ Cylinder::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cylinder
的用法示例。
在下文中一共展示了Cylinder::setPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePlanets
void updatePlanets(void)
{
orbitTimer+= orbitSpeed;
mercury.update();
venus.update();
earth.update();
mars.update();
jupiter.update();
saturn.update();
uranus.update();
neptune.update();
//update saturn ring
saturnRing.xPosition = saturn.planet.xPosition;
saturnRing.zPosition = saturn.planet.zPosition;
neptunePole.zAngle = -neptune.outPole.yAngle;
uranusPole.zAngle = -uranus.outPole.yAngle;
saturnPole.zAngle = -saturn.outPole.yAngle;
jupiterPole.zAngle = -jupiter.outPole.yAngle;
marsPole.zAngle = -mars.outPole.yAngle;
earthPole.zAngle = -earth.outPole.yAngle;
venusPole.zAngle = -venus.outPole.yAngle;
mercuryPole.zAngle = -mercury.outPole.yAngle;
GLfloat xPositionT= earth.planet.xPosition + sin(orbitTimer* moon.rotateModifier)*moon.radius;
GLfloat zPositionT = earth.planet.zPosition + cos(orbitTimer* moon.rotateModifier)*moon.radius;
moon.planet.setPosition(xPositionT ,moon.planet.yPosition , zPositionT);
moon.upPole.setPosition(xPositionT , moon.upPole.yPosition , zPositionT);
moon.upPole.spin(1.0);
moon.outPole.setOriginPosition(earth.planet.xPosition , 0 , earth.planet.zPosition);
GLfloat deltaZ = moon.planet.zPosition - earth.planet.zPosition;
GLfloat deltaX = moon.planet.xPosition - earth.planet.xPosition;
GLfloat angle = atan2(deltaZ , deltaX) ;
angle = -angle * 180.0f / (GLfloat)M_PI;
angle+= 90;
moon.outPole.setAngle(0, angle , 0);
moonCylinder.setPosition(earth.upPole.xPosition ,earth.upPole.yPosition - 1.8f , earth.upPole.zPosition);
saturnRingPole.setPosition(saturn.planet.xPosition , saturn.planet.yPosition , saturn.planet.zPosition);
}
示例2: update
void update(void)
{
GLfloat xPositionT = 0 + sin(orbitTimer * rotateModifier) * radius;
GLfloat zPositionT = 0 + cos(orbitTimer * rotateModifier) * radius;
planet.setPosition(xPositionT ,planet.yPosition , zPositionT);
upPole.setPosition(xPositionT , upPole.yPosition , zPositionT);
GLfloat angle = atan2(zPositionT , xPositionT);
angle = -angle * 180.0f / (GLfloat)M_PI;
angle+= 90.0f;
outPole.setAngle(0, angle, 0);
}
示例3: 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();
//.........这里部分代码省略.........