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


C++ cFrequencyCounter::getFrequency方法代码示例

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


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

示例1: updateGraphics

void updateGraphics(void)
{
    /////////////////////////////////////////////////////////////////////
    // UPDATE WIDGETS
    /////////////////////////////////////////////////////////////////////

    // update haptic rate label
    labelHapticRate->setString ("haptic rate: "+cStr(frequencyCounter.getFrequency(), 0) + " [Hz]");

    // update position of haptic rate label
    labelHapticRate->setLocalPos((int)(0.5 * (windowW - labelHapticRate->getWidth())), 15);

    // update position of message label
    labelMessage->setLocalPos((int)(0.5 * (windowW - labelMessage->getWidth())), 50);


    /////////////////////////////////////////////////////////////////////
    // RENDER SCENE
    /////////////////////////////////////////////////////////////////////

    // render world
    camera->renderView(windowW, windowH);

    // swap buffers
    glutSwapBuffers();

    // check for any OpenGL errors
    GLenum err = glGetError();
    if (err != GL_NO_ERROR) cout << "Error: " << gluErrorString(err) << endl;
}
开发者ID:WoodenHaptics,项目名称:woody-experimental,代码行数:30,代码来源:15-paint.cpp

示例2: updateGraphics

void updateGraphics(void)
{
    int px, py;

    // update haptic rate label
    labelHapticRate->setString ("haptic rate: "+cStr(frequencyCounter.getFrequency(), 0) + " [Hz]");

    px = (int)(0.5 * (displayW - labelHapticRate->getWidth()));
    labelHapticRate->setLocalPos(px, 15);

    // update other widgets
    py = (int)(0.5 * (displayH - level->getHeight()));
    level->setLocalPos(50, py);
    level->setValue(tool->m_lastComputedGlobalForce.length());

    px = displayW - 80;
    py = (int)(0.5 * displayH);
    dial->setLocalPos(px, py);
    dial->setValue1(angVel.length());

    // render world
    camera->renderView(displayW, displayH);

    // swap buffers
    glutSwapBuffers();

    // check for any OpenGL errors
    GLenum err;
    err = glGetError();
    if (err != GL_NO_ERROR) printf("Error:  %s\n", gluErrorString(err));
}
开发者ID:flair2005,项目名称:haptics-chai3d-demo,代码行数:31,代码来源:10-oring.cpp

示例3: updateGraphics

void updateGraphics(void)
{
    int px;

    // update position of label
    labelHapticDeviceModel->setLocalPos(10, displayH - 30, 0.0);

    // update position of label and content
    double posX = 1000 * hapticDevicePosition.x();
    double posY = 1000 * hapticDevicePosition.y();
    double posZ = 1000 * hapticDevicePosition.z();

    labelHapticDevicePosition->setString("position [mm]: " + cStr(posX, 0) + " " +
                                         cStr(posY, 0) + " " +
                                         cStr(posZ, 0));

    labelHapticDevicePosition->setLocalPos(10, displayH - 50, 0.0);

    // update haptic rate label
    labelHapticRate->setString ("haptic rate: "+cStr(frequencyCounter.getFrequency(), 0) + " [Hz]");

    px = (int)(0.5 * (displayW - labelHapticRate->getWidth()));
    labelHapticRate->setLocalPos(px, 15);

    // render world
    camera->renderView(displayW, displayH);

    // swap buffers
    glutSwapBuffers();

    // check for any OpenGL errors
    GLenum err;
    err = glGetError();
    if (err != GL_NO_ERROR) printf("Error:  %s\n", gluErrorString(err));
}
开发者ID:ChellaVignesh,项目名称:ros_haptics,代码行数:35,代码来源:01-mydevice.cpp

示例4: updateGraphics

void updateGraphics(void)
{
    /////////////////////////////////////////////////////////////////////
    // UPDATE WIDGETS
    /////////////////////////////////////////////////////////////////////

    // display haptic rate data
    labelHapticRate->setString ("haptic rate: "+cStr(frequencyCounter.getFrequency(), 0) + " [Hz]");

    // update position of label
    labelHapticRate->setLocalPos((int)(0.5 * (windowW - labelHapticRate->getWidth())), 15);

    // update value of level
    level->setValue( cylinder->getLocalPos().y() );

    // update value of scope
    scope->setSignalValues( tool->m_lastComputedGlobalForce.length() );
    

    /////////////////////////////////////////////////////////////////////
    // RENDER SCENE
    /////////////////////////////////////////////////////////////////////

    // render world
    camera->renderView(windowW, windowH);

    // swap buffers
    glutSwapBuffers();

    // check for any OpenGL errors
    GLenum err;
    err = glGetError();
    if (err != GL_NO_ERROR) cout << "Error:  %s\n" << gluErrorString(err);
}
开发者ID:WoodenHaptics,项目名称:woody-experimental,代码行数:34,代码来源:04-shapes.cpp

示例5: updateGraphics

void updateGraphics(void)
{
    // update haptic rate label
    labelHapticRate->setString ("haptic rate: "+cStr(frequencyCounter.getFrequency(), 0) + " [Hz]");

    int px = (int)(0.5 * (displayW - labelHapticRate->getWidth()));
    labelHapticRate->setLocalPos(px, 15);

    // render world
    camera->renderView(displayW, displayH);

    // swap buffers
    glutSwapBuffers();

    // check for any OpenGL errors
    GLenum err;
    err = glGetError();
    if (err != GL_NO_ERROR) printf("Error:  %s\n", gluErrorString(err));
}
开发者ID:ChellaVignesh,项目名称:ros_haptics,代码行数:19,代码来源:22-chrome.cpp

示例6: updateGraphics

void updateGraphics( void )
{
    /////////////////////////////////////////////////////////////////////
    // CHECK GAME STATUS
    /////////////////////////////////////////////////////////////////////

    if ( particles_left[ELECTRON] == 0 &&
        particles_left[PROTON] == 0 &&
        particles_left[NEUTRON] == 0 )
    {
        // Display game over screen
        camera->m_frontLayer->addChild( clear_screen );
        // Set timeout
        timeout_start = clock();

        show_clear_screen = true;

        // Get new random atom
        getNewAtom( rand() % NUM_ATOMS + 1 );
    }
    // If timeout
    if ( show_clear_screen && ( ( clock() - timeout_start )/( double )CLOCKS_PER_SEC ) > CLEAR_SCREEN_TIMEOUT )
    {
        // Reset screen
        resetScreen();
        show_clear_screen = false;
        camera->m_frontLayer->removeChild( clear_screen );
    }

    /////////////////////////////////////////////////////////////////////
    // UPDATE WIDGETS
    /////////////////////////////////////////////////////////////////////

    // update haptic rate label
    labelHapticRate->setString( "haptic rate: "+cStr( frequencyCounter.getFrequency(), 0 ) + " [Hz]" );

    // update position of label
    labelHapticRate->setLocalPos( ( int )( 0.5 * ( windowW - labelHapticRate->getWidth() ) ), 15 );

    // Set text and position of atom number label
    atom_num->setString( to_string( current_atom_num ) );
    atom_num->setLocalPos( ( int )( 0.089 * ( windowW - atom_num->getWidth() ) ),
                          ( int )( 0.93 * ( windowH - atom_num->getHeight() ) ) );

    // Set text and position of element symbol label
    atom_label->setString( current_atom_symbol );
    atom_label->setLocalPos( ( int )( 0.11 * ( windowW - atom_label->getWidth() ) ),
                            ( int )( 0.91 * ( windowH - atom_label->getHeight() ) ) );

    // Set text and position of element name label
    atom_name->setString( current_atom_name );
    atom_name->setLocalPos( ( int )( 0.08 * ( windowW - atom_name->getWidth() ) ),
                           ( int )( 0.81 * ( windowH - atom_name->getHeight() ) ) );

    // Set text and posistion of particle labels
    particle_labels[ELECTRON]->setString( "e-" );
    particle_labels[PROTON]->setString( "p+" );
    particle_labels[NEUTRON]->setString( "n" );
    particle_labels[ELECTRON]->setLocalPos( ( int )( 0.95 * ( windowW - particle_labels[0]->getWidth() ) ),
                                            ( int )( 0.835 * ( windowH - particle_labels[0]->getHeight() ) ) );
    particle_labels[PROTON]->setLocalPos( ( int )( 0.95 * ( windowW - particle_labels[1]->getWidth() ) ),
                                          ( int )( 0.520 * ( windowH - particle_labels[1]->getHeight() ) ) );
    particle_labels[NEUTRON]->setLocalPos( ( int )( 0.95 * ( windowW - particle_labels[2]->getWidth() ) ),
                                           ( int )( 0.190 * ( windowH - particle_labels[2]->getHeight() ) ) );

    // Check if button is pressed
    bool buttonStatus;
    hapticDevice->getUserSwitch( 0, buttonStatus );
    if ( buttonStatus && !show_clear_screen )
    {
        // If user is holding the button, don't change color
        if ( !selected_particle->getShowEnabled() )
        {
            // Get cursor position
            cVector3d tool_pos;
            tool_pos = tool->getDeviceLocalPos();
            for ( int i = 0; i < NUM_PARTICLE_TYPE; i++ )
            {
                // Get box position
                cVector3d boxPos = particle_boxes[i]->getLocalPos();
                double box_x_max = boxPos.x() + PARTICLE_BOX*2; // Let user pick above box
                double box_x_min = boxPos.x() - PARTICLE_BOX*2; // Let user pick above box
                double box_y_max = boxPos.y() + PARTICLE_BOX/2;
                double box_y_min = boxPos.y() - PARTICLE_BOX/2;
                double box_z_max = boxPos.z() + PARTICLE_BOX/2;
                double box_z_min = boxPos.z() - PARTICLE_BOX/2;

                // If collision, set colors
                if ( tool_pos.x() <= box_x_max && tool_pos.x() >= box_x_min &&
                     tool_pos.y() <= box_y_max && tool_pos.y() >= box_y_min &&
                     tool_pos.z() <= box_z_max && tool_pos.z() >= box_z_min )
                {
                    selected_particle->setMaterial( select_material[i] );
                    selected_particle->setShowEnabled( true,true );
                    is_selected = i;
                }
            }
        }
    }
    else
//.........这里部分代码省略.........
开发者ID:anddani,项目名称:Haptics_Atom,代码行数:101,代码来源:main.cpp


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