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


C++ V3D::Y方法代码示例

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


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

示例1: left

MantidQt::SliceViewer::PeakBoundingBox getPeakBoundingBoxForEllipsoid(
    const std::vector<Mantid::Kernel::V3D> &directions,
    const std::vector<double> &radii,
    const Mantid::Kernel::V3D &originEllipsoid) {
  // Get the length of largest projection onto x,y,z
  auto projectionLengths = getProjectionLengths(directions, radii);

  using namespace MantidQt::SliceViewer;

  // Corners
  EllipsoidPlaneSliceCalculator calc;
  auto zoomOutFactor = calc.getZoomOutFactor();
  const double leftValue =
      originEllipsoid.X() - zoomOutFactor * projectionLengths[0];
  const double rightValue =
      originEllipsoid.X() + zoomOutFactor * projectionLengths[0];
  const double bottomValue =
      originEllipsoid.Y() - zoomOutFactor * projectionLengths[1];
  const double topValue =
      originEllipsoid.Y() + zoomOutFactor * projectionLengths[1];

  Left left(leftValue);
  Right right(rightValue);
  Bottom bottom(bottomValue);
  Top top(topValue);
  SlicePoint slicePoint(originEllipsoid.Z());

  return PeakBoundingBox(left, right, top, bottom, slicePoint);
}
开发者ID:samueljackson92,项目名称:mantid,代码行数:29,代码来源:EllipsoidPlaneSliceCalculator.cpp

示例2: setProjection

/**
 * Convenience overload.
 * 
 * @param minBounds :: Near-bottom-left corner of the scene.
 * @param maxBounds :: Far-top-right corner of the scene.
 * @param type :: Projection type: ORTHO or PERSPECTIVE. PERSPECTIVE isn't fully implemented
 */
void Viewport::setProjection(const Mantid::Kernel::V3D& minBounds, const Mantid::Kernel::V3D& maxBounds, ProjectionType type)
{
  double radius = minBounds.norm();
  double tmp = maxBounds.norm();
  if (tmp > radius) radius = tmp;

  setProjection( minBounds.X(), maxBounds.X(), minBounds.Y(), maxBounds.Y(), -radius, radius, type );
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:15,代码来源:Viewport.cpp

示例3: calcSize

/** Calculate the size of the detector in U/V
*
* @param udet :: UwrappedDetector struct to calculate the size for. udet's size
*fields
* are updated by this method.
*/
void UnwrappedSurface::calcSize(UnwrappedDetector &udet) {
  // U is the horizontal axis on the screen
  const Mantid::Kernel::V3D U(-1, 0, 0);
  // V is the vertical axis on the screen
  const Mantid::Kernel::V3D V(0, 1, 0);

  // find the detector's rotation
  Mantid::Kernel::Quat R;
  this->rotate(udet, R);

  Mantid::Geometry::BoundingBox bbox = udet.detector->shape()->getBoundingBox();
  Mantid::Kernel::V3D scale = udet.detector->getScaleFactor();

  // sizes of the detector along each 3D axis
  Mantid::Kernel::V3D size = bbox.maxPoint() - bbox.minPoint();
  size *= scale;

  Mantid::Kernel::V3D s1(size);
  Mantid::Kernel::V3D s2 = size + Mantid::Kernel::V3D(-size.X(), 0, 0) -
                           Mantid::Kernel::V3D(size.X(), 0, 0);
  Mantid::Kernel::V3D s3 = size + Mantid::Kernel::V3D(0, -size.Y(), 0) -
                           Mantid::Kernel::V3D(0, size.Y(), 0);
  // rotate the size vectors to get the dimensions along axes U and V
  R.rotate(s1);
  R.rotate(s2);
  R.rotate(s3);

  // get the larges projection to the U axis which is the visible width
  double d = fabs(s1.scalar_prod(U));
  udet.width = d;
  d = fabs(s2.scalar_prod(U));
  if (d > udet.width)
    udet.width = d;
  d = fabs(s3.scalar_prod(U));
  if (d > udet.width)
    udet.width = d;

  // get the larges projection to the V axis which is the visible height
  d = fabs(s1.scalar_prod(V));
  udet.height = d;
  d = fabs(s2.scalar_prod(V));
  if (d > udet.height)
    udet.height = d;
  d = fabs(s3.scalar_prod(V));
  if (d > udet.height)
    udet.height = d;

  // apply the scale factors
  udet.width *= udet.uscale;
  udet.height *= udet.vscale;

  // don't let them be too large
  if (udet.width > m_width_max)
    m_width_max = udet.width;
  if (udet.height > m_height_max)
    m_height_max = udet.height;
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:63,代码来源:UnwrappedSurface.cpp

示例4: draw

/**
* Implementation of rendering Sample.
*/
void SampleActor::draw(bool picking) const {
  if (!picking && isVisible()) {
    OpenGLError::check("SampleActor::draw()");
    glPushAttrib(GL_ENABLE_BIT);
    GLboolean hasLight0;
    glGetBooleanv(GL_LIGHT0, &hasLight0);
    if (hasLight0) {
      glEnable(GL_LIGHTING);
    }
    glPushMatrix();
    m_color.paint();
    Mantid::Kernel::V3D pos = m_samplePos->getPos();
    glTranslated(pos.X(), pos.Y(), pos.Z());
    m_sample.getShape().draw();
    glPopMatrix();
    glPopAttrib();
    OpenGLError::check("SampleActor::draw()");
  }
}
开发者ID:liyulun,项目名称:mantid,代码行数:22,代码来源:SampleActor.cpp

示例5: weightAt

 /**
 Implementation doesn't make sense on this type.
 @param distance : 
 @return weighting
 */
 double ParabolicWeighting::weightAt(const Mantid::Kernel::V3D& distance)
 {
   return static_cast<double>(m_cutOff - std::abs(distance.X()) + m_cutOff - std::abs(distance.Y()) + 1);
 }
开发者ID:AlistairMills,项目名称:mantid,代码行数:9,代码来源:WeightingStrategy.cpp

示例6: updateDataCache

    void QPeaksTableModel::updateDataCache(const Mantid::Geometry::IPeak& peak, const int row) const
    {
      // if the index is what is already cached just return
      if (row == m_dataCachePeakIndex)
        return;

      // generate the cache
      m_dataCache.clear();
      m_dataCache.push_back(QString::number(peak.getRunNumber()));
      m_dataCache.push_back(QString::number(peak.getDetectorID()));
      m_dataCache.push_back(QString::number(peak.getH(), 'f', m_hklPrec));
      m_dataCache.push_back(QString::number(peak.getK(), 'f', m_hklPrec));
      m_dataCache.push_back(QString::number(peak.getL(), 'f', m_hklPrec));
      m_dataCache.push_back(QString::number(peak.getWavelength(), 'f', 4));
      double eI = peak.getInitialEnergy();
      double eF = peak.getFinalEnergy();
      m_dataCache.push_back(QString::number(eI, 'f', 4));
      m_dataCache.push_back(QString::number(eF, 'f', 4));
      m_dataCache.push_back(QString::number(eI - eF, 'f', 4));
      m_dataCache.push_back(QString::number(peak.getTOF(), 'f', 1));
      m_dataCache.push_back(QString::number(peak.getDSpacing(), 'f', 4));
      double intensity = peak.getIntensity();
      double sigma = peak.getSigmaIntensity();
      m_dataCache.push_back(QString::number(intensity, 'f', 1));
      m_dataCache.push_back(QString::number(sigma, 'f', 1));
      m_dataCache.push_back(QString::number(intensity/sigma, 'f', 2));
      m_dataCache.push_back(QString::number(peak.getBinCount(), 'g', 2));
      m_dataCache.push_back(QString(peak.getBankName().c_str()));
      m_dataCache.push_back(QString::number(peak.getRow()));
      m_dataCache.push_back(QString::number(peak.getCol()));

      const QString COMMA(",");

      const Mantid::Kernel::V3D qlab = peak.getQLabFrame();
      m_dataCache.push_back(QString::number(qlab.X(), 'f', 4) + COMMA + QString::number(qlab.Y(), 'f', 4) + COMMA + QString::number(qlab.Z(), 'f', 4));

      const Mantid::Kernel::V3D qsample = peak.getQSampleFrame();
      m_dataCache.push_back(QString::number(qsample.X(), 'f', 4) + COMMA + QString::number(qsample.Y(), 'f', 4) + COMMA + QString::number(qsample.Z(), 'f', 4));
    }
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:39,代码来源:QPeaksTableModel.cpp

示例7: updateSelectionInfo

/**
 * Update the info window with information for a selected detector.
 * @param detid :: ID of the selected detector.
 */
void InstrumentWindowPickTab::updateSelectionInfo(int detid)
{
    if (m_freezePlot)
    {   // freeze the plot for one update
        m_freezePlot = false;
        return;
    }
    if (m_instrWindow->blocked())
    {
        m_selectionInfoDisplay->clear();
        return;
    }
    if (detid >= 0)
    {
        InstrumentActor* instrActor = m_instrWindow->getInstrumentActor();
        Mantid::Geometry::IDetector_const_sptr det = instrActor->getInstrument()->getDetector(detid);
        QString text = "Selected detector: " + QString::fromStdString(det->getName()) + "\n";
        text += "Detector ID: " + QString::number(detid) + '\n';
        QString wsIndex;
        try {
            wsIndex = QString::number(instrActor->getWorkspaceIndex(detid));
            updatePlot(detid); // Update the plot if the detector links to some data
        } catch (Mantid::Kernel::Exception::NotFoundError &) {
            // Detector doesn't have a workspace index relating to it
            wsIndex = "None";
            m_plot->clearCurve(); // Clear the plot window
            m_plot->replot();
        }
        text += "Workspace index: " + wsIndex + '\n';
        Mantid::Kernel::V3D pos = det->getPos();
        text += "xyz: " + QString::number(pos.X()) + "," + QString::number(pos.Y()) + "," + QString::number(pos.Z())  + '\n';
        double r,t,p;
        pos.getSpherical(r,t,p);
        text += "rtp: " + QString::number(r) + "," + QString::number(t) + "," + QString::number(p)  + '\n';
        Mantid::Geometry::ICompAssembly_const_sptr parent = boost::dynamic_pointer_cast<const Mantid::Geometry::ICompAssembly>(det->getParent());
        if (parent)
        {
            QString textpath;
            while (parent)
            {
                textpath="/"+QString::fromStdString(parent->getName())+textpath;
                parent=boost::dynamic_pointer_cast<const Mantid::Geometry::ICompAssembly>(parent->getParent());
            }
            text += "Component path:" +textpath+"/"+ QString::fromStdString(det->getName()) +'\n';
        }
        const double integrated = instrActor->getIntegratedCounts(detid);
        const QString counts = integrated == -1.0 ? "N/A" : QString::number(integrated);
        text += "Counts: " + counts + '\n';
        QString xUnits;
        if (m_selectionType > SingleDetectorSelection && !m_plotSum)
        {
            switch(m_tubeXUnits)
            {
            case DETECTOR_ID:
                xUnits = "Detector ID";
                break;
            case LENGTH:
                xUnits = "Length";
                break;
            case PHI:
                xUnits = "Phi";
                break;
            default:
                xUnits = "Detector ID";
            }
        }
        else
        {
            xUnits = QString::fromStdString(instrActor->getWorkspace()->getAxis(0)->unit()->caption());
            //xUnits = "Time of flight";
        }
        text += "X units: " + xUnits + '\n';
        m_selectionInfoDisplay->setText(text);
    }
    else
    {
        m_selectionInfoDisplay->clear();
        m_plot->clearCurve(); // Clear the plot window
        m_plot->replot();
    }
}
开发者ID:trnielsen,项目名称:mantid,代码行数:85,代码来源:InstrumentWindowPickTab.cpp


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