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


C++ Point3::getAngleXY方法代码示例

本文整理汇总了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;
        }
开发者ID:TacoVox,项目名称:OpenDaVINCI,代码行数:29,代码来源:PointSensor.cpp

示例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();
    }
开发者ID:Duxiao777,项目名称:2013-mini-smart-vehicles,代码行数:35,代码来源:CamGen.cpp


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