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


C++ CurveData::setY方法代码示例

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


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

示例1: UpdateCurve

void StringToCurve::UpdateCurve()
{
  // Remove any existing curves
  while ( !m_OutCurveList->getCurveList().empty() ) {
    delete m_OutCurveList->getCurveList().back();
    m_OutCurveList->getCurveList().pop_back();
  }

  std::string dataString = f_CurveString->getStringValue();
  dataString.append( f_CurveSeparator->getStringValue() );

  std::string indexString = f_IndexString->getStringValue();
  std::vector< float > indexValues;
  if (indexString.length() != 0 ){
    StringToVector(indexString, indexValues );
  }

  if ( dataString.length() > 0 ){
    // Split string into curves
    std::vector<std::string> curves;
    boost::split(curves, dataString, boost::is_any_of(f_CurveSeparator->getStringValue() ));

    // Iterate over curves
    std::vector<std::string>::iterator stringIt = curves.begin();
    for (;stringIt < curves.end(); ++stringIt ){
      std::string curCurve = *stringIt;
      if (curCurve.length() == 0) {continue;}
      // Remove leading and trailing spaces
      boost::trim( curCurve );
      std::vector< MLfloat > curveValues;
      StringToVector( curCurve, curveValues );
      CurveData *outputCurve = new CurveData;
      outputCurve->setY( curveValues.size(),&curveValues[0], 1 );
      if ( f_IndexString->getStringValue().length() != 0 ){
        outputCurve->setX( indexValues.size(),&indexValues[0], 1 );
      }
      m_OutCurveList->getCurveList().push_back( outputCurve );
    }
  }
}
开发者ID:hjkuijf,项目名称:communitymodules,代码行数:40,代码来源:mlStringToCurve.cpp

示例2: _process


//.........这里部分代码省略.........
      {
        CurveData *outputCurve = new CurveData;
        double    *yValues     = new double[ nCSOs ];

        double minDist = ML_DOUBLE_MAX;
        vec3 point1;
        vec3 point2;
        double averageMinDistance = 0.0;
        double averageMeanDistance = 0.0;
        double averageMaxDistance = 0.0;
        for ( int iCSO = 0; iCSO<nCSOs; ++iCSO ){
          CSO* currentCSO = _csoList0->getCSOAt( iCSO );
          CSO* matchingCSO = _findMatchingCSO(iCSO);
          if (!matchingCSO) {continue;}

          std::vector<vec3>pointSet1;
          std::vector<vec3>pointSet2;
          currentCSO->fillPathPointCoordinatesFlattened(pointSet1);
          matchingCSO->fillPathPointCoordinatesFlattened(pointSet2);

          Vector3 minPoint1,minPoint2,maxPoint1,maxPoint2;

          _getDistances( pointSet1, pointSet2,
                         minDistance,maxDistance,avgDistance,stdDevDistance,
                         minPoint1,minPoint2,maxPoint1,maxPoint2);

          averageMinDistance  += minDistance;
          averageMeanDistance += avgDistance;
          averageMaxDistance  += maxDistance;

          distances << currentCSO->getId()  << "," 
                    << matchingCSO->getId() << "," 
                    << minDistance << "," 
                    << maxDistance << "," 
                    << avgDistance << "," 
                    << stdDevDistance 
                    << std::endl;

          if ( minDistance < minDist ){
            minDist = minDistance;
            point1 = minPoint1;
            point2 = minPoint2;
          }

          _outputXMarkerList->appendItem(XMarker( vec6(minPoint1[0],minPoint1[1],minPoint1[2],0.5f,0.0f,0.0f),
                                                  vec3(minPoint2[0]-minPoint1[0],minPoint2[1]-minPoint1[1],minPoint2[2]-minPoint1[2]),
                                                  currentCSO->getId(),""));

          switch ( _curveStatistic->getEnumValue() ){
            case MIN:
              yValues[ iCSO ] = minDistance;
              break;
            case MAX:
              yValues[ iCSO ] = maxDistance;
              break;
            case MEAN:
              yValues[ iCSO ] = avgDistance;
              break;
            case STDEV:
              yValues[ iCSO ] = stdDevDistance;
              break;
            default:
              break;
          } 
        } // iCSO
        averageMinDistance  /= (nCSOs != 0 ? nCSOs : 1.0);
        averageMeanDistance /= (nCSOs != 0 ? nCSOs : 1.0);
        averageMaxDistance  /= (nCSOs != 0 ? nCSOs : 1.0);

        outputCurve->setY( nCSOs, yValues);
        delete[] yValues;
        _outputCurveList->getCurveList().push_back( outputCurve );
        _distancesFld->setStringValue( distances.str() );
        _minimumDistancePoint1Fld->setVec3fValue(point1);
        _minimumDistancePoint2Fld->setVec3fValue(point2);
        _minimumDistanceFld->setFloatValue( static_cast<float>(minDistance) );

        _AverageMinimumDistanceFld->setDoubleValue( averageMinDistance  );
        _AverageMeanDistanceFld->setDoubleValue(    averageMeanDistance );
        _AverageMaxDistanceFld->setDoubleValue(     averageMaxDistance  );



        break;
      }
    default:
      break;
    }

  } else {
    _minimumDistancePoint1Fld->setVec3fValue(vec3(0.0,0.0,0.0));
    _minimumDistancePoint2Fld->setVec3fValue(vec3(0.0,0.0,0.0));
    _minimumDistanceFld->setFloatValue(0.0f);
    _distancesFld->setStringValue( _tableHeader );
  }

  _outputXMarkerListFld->setBaseValue(_outputXMarkerList);
  _outputCurveListFld->touch();

}
开发者ID:hjkuijf,项目名称:communitymodules,代码行数:101,代码来源:CSODistance.cpp


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