本文整理汇总了C++中Point3::getAngleXY方法的典型用法代码示例。如果您正苦于以下问题:C++ Point3::getAngleXY方法的具体用法?C++ Point3::getAngleXY怎么用?C++ Point3::getAngleXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3::getAngleXY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateFOV
Polygon PointSensor::updateFOV(const Point3 &translationGlobal, const Point3 &rotationGlobal) {
// 1. Rotate the translation of the sensor w.r.t. the global rotation of the vehicle.
m_sensorPosition = m_translation;
m_sensorPosition.rotateZ(rotationGlobal.getAngleXY());
m_sensorPosition += translationGlobal;
m_totalRotation = rotationGlobal.getAngleXY() + m_rotZ*cartesian::Constants::DEG2RAD;
// 2. Construct the FOV in the origin w.r.t. the global rotation of the vehicle.
Point3 leftBoundaryFOV(m_distanceFOV, 0, 0);
leftBoundaryFOV.rotateZ(m_totalRotation + (m_angleFOV/2.0)*cartesian::Constants::DEG2RAD);
Point3 rightBoundaryFOV(m_distanceFOV, 0, 0);
rightBoundaryFOV.rotateZ(m_totalRotation - (m_angleFOV/2.0)*cartesian::Constants::DEG2RAD);
// 3. Translate the FOV to the sensor's position.
leftBoundaryFOV += m_sensorPosition;
rightBoundaryFOV += m_sensorPosition;
// Iterate through all available polygons and intersect FOV-polygon with polygon.
Polygon FOV;
FOV.add(m_sensorPosition);
FOV.add(leftBoundaryFOV);
FOV.add(rightBoundaryFOV);
FOV.add(m_sensorPosition);
m_FOV = FOV;
return m_FOV;
}
示例2: display
void CamGen::display() {
glClearColor(0, 0.58, 0.78, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
Point3 dir = m_egoState.getRotation();
Point3 target(15, 0, 0);
target.rotateZ(dir.getAngleXY());
target += m_egoState.getPosition();
// cerr << "Look from: " << m_egoState.getPosition().toString() << "/angle: " << dir.getAngleXY() << endl;
// cerr << "Look to: " << target.toString() << endl << endl;
gluLookAt(m_egoState.getPosition().getX(), m_egoState.getPosition().getY(), 2.8,
target.getX(), target.getY(), 0,
0, 0, 1);
// First, apply the translation.
glTranslatef(m_translationX, m_translationY, 0);
// Second, rotate the model.
glRotatef(m_theta, 1, 0, 0);
glRotatef(m_phi, 0, 1, 0);
// Third, scale the model.
glScalef(m_scale, m_scale, m_scale);
glPushMatrix();
drawScene();
glPopMatrix();
glutSwapBuffers();
}