Example #1
0
void Object::create()
{
  clearObject();

  scale_.x = bounding_box_lwh_.x;
  scale_.y = bounding_box_lwh_.y;
  scale_.z = bounding_box_lwh_.z;

  object_.header.frame_id = frame_id_;
  object_.name = name_;
  //object_.description = description_;
  object_.pose = pose_;
  object_.scale = maxScale(scale_);

  createMesh();

  control_.name = "object_control";
  control_.interaction_mode = InteractiveMarkerControl::BUTTON;
  control_.always_visible = true;
  control_.markers.push_back(mesh_);

  object_.controls.clear();
  object_.controls.push_back(control_);

  if (scale_.x != 0.0f && scale_.y != 0.0f && scale_.z != 0.0f)
    BoundingBox::createBoundingBoxControl(0.0f, 0.0f, 0.0f);

  createMenu();
}
bool KlustersView::qt_emit( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: updatedDimensions((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 1: singleColorUpdated((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 2: clusterRemovedFromView((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 3: clusterAddedToView((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 4: newClusterAddedToView((QValueList<int>&)*((QValueList<int>*)static_QUType_ptr.get(_o+1)),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break;
    case 5: newClusterAddedToView((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 6: spikesRemovedFromClusters((QValueList<int>&)*((QValueList<int>*)static_QUType_ptr.get(_o+1)),(bool)static_QUType_bool.get(_o+2)); break;
    case 7: modeToSet((BaseFrame::Mode)(*((BaseFrame::Mode*)static_QUType_ptr.get(_o+1)))); break;
    case 8: spikesAddedToCluster((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 9: updateContents(); break;
    case 10: emptySelection(); break;
    case 11: modifiedClusters((QValueList<int>&)*((QValueList<int>*)static_QUType_ptr.get(_o+1)),(bool)static_QUType_bool.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break;
    case 12: modifiedClustersUndo((QValueList<int>&)*((QValueList<int>*)static_QUType_ptr.get(_o+1)),(bool)static_QUType_bool.get(_o+2)); break;
    case 13: updatedTimeFrame((long)(*((long*)static_QUType_ptr.get(_o+1))),(long)(*((long*)static_QUType_ptr.get(_o+2)))); break;
    case 14: sampleMode(); break;
    case 15: timeFrameMode(); break;
    case 16: meanPresentation(); break;
    case 17: allWaveformsPresentation(); break;
    case 18: overLayPresentation(); break;
    case 19: sideBySidePresentation(); break;
    case 20: increaseAmplitude(); break;
    case 21: decreaseAmplitude(); break;
    case 22: updateDisplayNbSpikes((long)(*((long*)static_QUType_ptr.get(_o+1)))); break;
    case 23: increaseAmplitudeofCorrelograms(); break;
    case 24: decreaseAmplitudeofCorrelograms(); break;
    case 25: noScale(); break;
    case 26: maxScale(); break;
    case 27: shoulderScale(); break;
    case 28: updatedBinSizeAndTimeFrame((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 29: setShoulderLine((bool)static_QUType_bool.get(_o+1)); break;
    case 30: updateDrawing(); break;
    case 31: changeGain((int)static_QUType_int.get(_o+1)); break;
    case 32: changeTimeInterval((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break;
    case 33: changeChannelPositions((QValueList<int>&)*((QValueList<int>*)static_QUType_ptr.get(_o+1))); break;
    case 34: computeProbabilities(); break;
    case 35: changeBackgroundColor((QColor)(*((QColor*)static_QUType_ptr.get(_o+1)))); break;
    case 36: clustersRenumbered((bool)static_QUType_bool.get(_o+1)); break;
    case 37: updateClusters((QString)static_QUType_QString.get(_o+1),(QValueList<int>&)*((QValueList<int>*)static_QUType_ptr.get(_o+2)),(ItemColors*)static_QUType_ptr.get(_o+3),(bool)static_QUType_bool.get(_o+4)); break;
    case 38: increaseAllAmplitude(); break;
    case 39: decreaseAllAmplitude(); break;
    case 40: showLabels((bool)static_QUType_bool.get(_o+1)); break;
    case 41: nextCluster(); break;
    case 42: previousCluster(); break;
    default:
	return KDockArea::qt_emit(_id,_o);
    }
    return TRUE;
}
Example #3
0
float HFViewport::getMinZoom()
{
    CC_ASSERT(this->m_TargetNode);
    cocos2d::CCPoint maxScale(1,1);
    if( this->m_TargetNode->getContentSize().width > 0 )
    {
        maxScale.x = cocos2d::CCDirector::sharedDirector()->getWinSize().width / this->mWorldBound.size.width;
    }
    
    if( this->m_TargetNode->getContentSize().height > 0 )
    {
        maxScale.y = cocos2d::CCDirector::sharedDirector()->getWinSize().height / this->mWorldBound.size.height;
    }
    return MAX(maxScale.x , maxScale.y);
}
Example #4
0
float Viewport::getMinZoom()
{
    CC_ASSERT(this->m_TargetNode);
    Vec2 maxScale(1,1);
    if( this->m_TargetNode->getContentSize().width > 0 )
    {
        maxScale.x = Director::getInstance()->getWinSize().width / this->mWorldBound.size.width;
    }
    
    if( this->m_TargetNode->getContentSize().height > 0 )
    {
        maxScale.y = Director::getInstance()->getWinSize().height / this->mWorldBound.size.height;
    }
    return MAX(maxScale.x , maxScale.y);
}
Example #5
0
//-------------------------------------------------------------------------------
void SpatialWellFilter::completeSigmaE(std::vector<NRLib::Matrix>  & sigmae,
                                       int                           lastn,
                                       const AVOInversion          * avoInversionResult,
                                       const std::vector<Grid2D *> & noiseScale)
//-------------------------------------------------------------------------------
{
  // finds the scale at  default inversion (all minimum noise in case of local noise)
  sigmae[0](0,0) /= lastn;
  sigmae[0](1,0) /= lastn;
  sigmae[0](1,1) /= lastn;
  sigmae[0](2,0) /= lastn;
  sigmae[0](2,1) /= lastn;
  sigmae[0](2,2) /= lastn;
  sigmae[0](0,1)  = sigmae[0](1,0);
  sigmae[0](0,2)  = sigmae[0](2,0);
  sigmae[0](1,2)  = sigmae[0](2,1);

  adjustDiagSigma(sigmae[0]);

  if (sigmae.size() > 1) { // We have local noise
    int nAng = static_cast<int>(noiseScale.size());

    NRLib::Vector maxScale(nAng);
    for (int angle=0 ; angle < nAng ; angle++) {
      double maxS = noiseScale[angle]->FindMax(RMISSING);
      double minS = noiseScale[angle]->FindMin(RMISSING);
      maxScale(angle) = maxS/minS;
    }

    NRLib::Vector scale(nAng);
    for (int angle=0 ; angle<nAng ; angle++)
      scale(angle) = 1.0;

    NRLib::Matrix G(nAng, 3);
    avoInversionResult->computeG(G);

    NRLib::Matrix dummy(3,3);
    NRLib::Matrix H(3,3);

    avoInversionResult->newPosteriorCovPointwise(dummy,
                                                 G,
                                                 scale,
                                                 H);

    NRLib::Matrix postCovAdj = H * H;

    NRLib::SymmetricMatrix symPostCovAdj(3);
    for(int i = 0 ; i < 3 ; i++)
      for(int j = 0 ; j <= i ; j++)
        symPostCovAdj(j,i) = postCovAdj(j,i);

    NRLib::SymmetricMatrix SigmaPri0  = avoInversionResult->getSymmetricPriorVar0();
    NRLib::Matrix          filter     = avoInversionResult->computeFilter(SigmaPri0, symPostCovAdj);

    NRLib::Matrix          sigmaE0    = filter * postCovAdj;

    // Idealy sigmaE0 = sigmae[0] but this is not the case due to
    // spatial effects.  We therfor adjust the sigmae[0]
    // by   sqrt(sigmaETmp*sigmaE0^-1)*sigmae[0]* sqrt(sigmaE0^-1*sigmaETmp)

    // Interpret conf counter bitwise - 0 means min value noise for that component, 1 means max.

    for(unsigned int conf = 1; conf < sigmae.size() ; conf++) {

      // Compute pointwise filter
      int factor = 1;
      for (int angle=0 ; angle<nAng ; angle++) {
        if ((conf & factor) > 0)
          scale(angle) = maxScale(angle);
        else
          scale(angle) = 1.0;
        factor *= 2;
      }

      avoInversionResult->newPosteriorCovPointwise(dummy,
                                                   G,
                                                   scale,
                                                   H);    // H is the square root of postCovAdj

      postCovAdj = H * H;

      for(int i = 0 ; i < 3 ; i++)
        for(int j = 0 ; j <= i ; j++)
          symPostCovAdj(j,i) = postCovAdj(j,i);

      filter = avoInversionResult->computeFilter(SigmaPri0, symPostCovAdj);

      NRLib::Matrix sigmaETmp = filter * postCovAdj;

      computeSigmaEAdjusted(sigmae[0],
                            sigmaE0,
                            sigmaETmp,
                            sigmae[conf]);

      adjustDiagSigma(sigmae[conf]);
    }
  }
}
Example #6
0
//------------------------------------------------------------------------------------
void SpatialWellFilter::completeSigmaEVpRho(std::vector<NRLib::Matrix>  & sigmaeVpRho,
                                            int                           lastn,
                                            const AVOInversion          * avoInversionResult,
                                            const std::vector<Grid2D *> & noiseScale)
//------------------------------------------------------------------------------------
{
  sigmaeVpRho[0](0,0) /= lastn;
  sigmaeVpRho[0](1,0) /= lastn;
  sigmaeVpRho[0](1,1) /= lastn;
  sigmaeVpRho[0](0,1)  = sigmae_[0](1,0);

  adjustDiagSigma(sigmaeVpRho[0]);

  if(sigmaeVpRho.size() > 1) { // We have local noise
    // initialization
    int nAng = static_cast<int>(noiseScale.size());
    std::vector<double> maxScale(nAng);
    double maxS, minS;
    for(int angle=0;angle<nAng;angle++) {
      minS = noiseScale[angle]->FindMin(RMISSING);
      maxS = noiseScale[angle]->FindMax(RMISSING);
      maxScale[angle] = maxS/minS;
    }

    NRLib::Matrix sigmaPri0 = avoInversionResult->getPriorVar0();

    NRLib::SymmetricMatrix priCovVpRho(2);
    priCovVpRho(0,0) = sigmaPri0(0,0);
    priCovVpRho(0,1) = sigmaPri0(0,2);
    priCovVpRho(1,0) = sigmaPri0(2,0);
    priCovVpRho(1,1) = sigmaPri0(2,2);

    NRLib::Matrix dummy(3,3);
    NRLib::Matrix help(nAng,3);

    NRLib::Vector scale(nAng);
    for(int angle=0 ; angle<nAng ; angle++)
      scale(angle) = 1.0;

    NRLib::Matrix G(nAng, 3);

    avoInversionResult->computeG(G);
    avoInversionResult->newPosteriorCovPointwise(dummy,
                                                 G,
                                                 scale,
                                                 help);

    NRLib::Matrix postCovAdj = help * help;

    NRLib::SymmetricMatrix postCovVpRho(2);
    postCovVpRho(0,0) = postCovAdj(0,0);
    postCovVpRho(1,0) = postCovAdj(2,0);
    postCovVpRho(1,1) = postCovAdj(2,2);

    NRLib::Matrix filter = avoInversionResult->computeFilter(priCovVpRho,
                                                             postCovVpRho);

    NRLib::Matrix sigmaE0 = filter * postCovVpRho;

    for(unsigned int conf = 1; conf < sigmaeVpRho.size();conf++) {

      //Compute pointwise filter
      int factor = 1;
      for(int angle=0;angle<nAng;angle++) {
        if((conf & factor) > 0)
          scale(angle) = maxScale[angle];
        else
          scale(angle) = 1.0;
        factor *= 2;
      }

      avoInversionResult->newPosteriorCovPointwise(dummy, G, scale,  help);  // help is the square root of postCovAdj

      postCovAdj = help * help;

      postCovVpRho(0,0) = postCovAdj(0,0);
      postCovVpRho(0,1) = postCovAdj(0,2);
      postCovVpRho(1,0) = postCovAdj(2,0);
      postCovVpRho(1,1) = postCovAdj(2,2);

      filter = avoInversionResult->computeFilter(priCovVpRho,
                                                 postCovVpRho);

      NRLib::Matrix sigmaETmp = filter * postCovVpRho;

      computeSigmaEAdjusted(sigmaeVpRho[0],
                            sigmaE0,
                            sigmaETmp,
                            sigmaeVpRho[conf]);
      adjustDiagSigma(sigmaeVpRho[conf]);
    }
  }
}
void
FltExportVisitor::writeDegreeOfFreedom(const osgSim::DOFTransform *dof)
{
    const osg::Matrix &invPut = dof->getInversePutMatrix();

    // Origin of DOF coord sys
    osg::Vec3d origin(invPut.getTrans());

    osg::Vec3 xAxis(invPut(0, 0), invPut(0, 1), invPut(0, 2));
    osg::Vec3 yAxis(invPut(1, 0), invPut(1, 1), invPut(1, 2));
    // Reference point along DOF coord sys's X axis
    osg::Vec3d pointOnXAxis = origin + xAxis;
    // Reference point in DOF coord sys's X-Y plane
    osg::Vec3d pointInXYPlane = origin + yAxis;

    // Translations
    osg::Vec3d minTranslate(dof->getMinTranslate());
    osg::Vec3d maxTranslate(dof->getMaxTranslate());
    osg::Vec3d currTranslate(dof->getCurrentTranslate());
    osg::Vec3d incrTranslate(dof->getIncrementTranslate());

    // Rotations
    osg::Vec3d minHPR(dof->getMinHPR());
    osg::Vec3d maxHPR(dof->getMaxHPR());
    osg::Vec3d currHPR(dof->getCurrentHPR());
    osg::Vec3d incrHPR(dof->getIncrementHPR());

    // Scaling
    osg::Vec3d minScale(dof->getMinScale());
    osg::Vec3d maxScale(dof->getMaxScale());
    osg::Vec3d currScale(dof->getCurrentScale());
    osg::Vec3d incrScale(dof->getIncrementScale());


    uint16   length(384);
    IdHelper id(*this, dof->getName());

    _records->writeInt16((int16) DOF_OP);
    _records->writeInt16(length);
    _records->writeID(id);
    _records->writeInt32(0);    // 'Reserved' (unused)
    _records->writeVec3d(origin);
    _records->writeVec3d(pointOnXAxis);
    _records->writeVec3d(pointInXYPlane);

    // Translations
    _records->writeFloat64(minTranslate.z());
    _records->writeFloat64(maxTranslate.z());
    _records->writeFloat64(currTranslate.z());
    _records->writeFloat64(incrTranslate.z());

    _records->writeFloat64(minTranslate.y());
    _records->writeFloat64(maxTranslate.y());
    _records->writeFloat64(currTranslate.y());
    _records->writeFloat64(incrTranslate.y());

    _records->writeFloat64(minTranslate.x());
    _records->writeFloat64(maxTranslate.x());
    _records->writeFloat64(currTranslate.x());
    _records->writeFloat64(incrTranslate.x());

    // Rotations: 0 = Yaw, 1 = Pitch, 2 = Roll
    _records->writeFloat64(osg::RadiansToDegrees(minHPR[1]));
    _records->writeFloat64(osg::RadiansToDegrees(maxHPR[1]));
    _records->writeFloat64(osg::RadiansToDegrees(currHPR[1]));
    _records->writeFloat64(osg::RadiansToDegrees(incrHPR[1]));

    _records->writeFloat64(osg::RadiansToDegrees(minHPR[2]));
    _records->writeFloat64(osg::RadiansToDegrees(maxHPR[2]));
    _records->writeFloat64(osg::RadiansToDegrees(currHPR[2]));
    _records->writeFloat64(osg::RadiansToDegrees(incrHPR[2]));

    _records->writeFloat64(osg::RadiansToDegrees(minHPR[0]));
    _records->writeFloat64(osg::RadiansToDegrees(maxHPR[0]));
    _records->writeFloat64(osg::RadiansToDegrees(currHPR[0]));
    _records->writeFloat64(osg::RadiansToDegrees(incrHPR[0]));

    // Scaling
    _records->writeFloat64(minScale.z());
    _records->writeFloat64(maxScale.z());
    _records->writeFloat64(currScale.z());
    _records->writeFloat64(incrScale.z());

    _records->writeFloat64(minScale.y());
    _records->writeFloat64(maxScale.y());
    _records->writeFloat64(currScale.y());
    _records->writeFloat64(incrScale.y());

    _records->writeFloat64(minScale.x());
    _records->writeFloat64(maxScale.x());
    _records->writeFloat64(currScale.x());
    _records->writeFloat64(incrScale.y());

    _records->writeInt32(dof->getLimitationFlags());    //  Constraint flags
    _records->writeInt32(0);                            // 'Reserved' (unused)
}