本文整理汇总了C++中mantid::kernel::V3D::Z方法的典型用法代码示例。如果您正苦于以下问题:C++ V3D::Z方法的具体用法?C++ V3D::Z怎么用?C++ V3D::Z使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid::kernel::V3D
的用法示例。
在下文中一共展示了V3D::Z方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: getSolutionForEllipsoid
SliceEllipseInfo EllipsoidPlaneSliceCalculator::getSolutionForEllipsoid(
const Kernel::Matrix<double> &m, double zPlane,
Mantid::Kernel::V3D originEllipsoid) const {
// Shift the z value into a suitable frame
const double z = zPlane - originEllipsoid.Z();
// Setup the A matrix
Mantid::Kernel::DblMatrix A;
A.setMem(2, 2);
const std::vector<double> ARow0 = {m[0][0], m[0][1]};
const std::vector<double> ARow1 = {m[0][1], m[1][1]};
A.setRow(0, ARow0);
A.setRow(1, ARow1);
// Setup the inverse Matrix of A
Mantid::Kernel::DblMatrix AInverse;
const double detA = A.determinant();
AInverse.setMem(2, 2);
const std::vector<double> AInverseRow0 = {m[1][1] / detA, -m[0][1] / detA};
const std::vector<double> AInverseRow1 = {-m[0][1] / detA, m[0][0] / detA};
AInverse.setRow(0, AInverseRow0);
AInverse.setRow(1, AInverseRow1);
// Setup the B vector
Mantid::Kernel::DblMatrix B;
std::vector<double> BColumn = {m[0][2], m[1][2]};
B.setMem(2, 1);
B.setColumn(0, BColumn);
B *= 2 * z;
// Setip the Transpose B vector
Mantid::Kernel::DblMatrix BT;
std::vector<double> BTRow = {m[0][2], m[1][2]};
BT.setMem(1, 2);
BT.setRow(0, BTRow);
BT *= 2 * z;
// Setup the C factor
const double c = m[2][2] * std::pow(z, 2);
// Get the origin
const auto origin = getOrigin(AInverse, B, originEllipsoid, z);
// Get the radii + directions
const auto eigenSystem = getAxesInformation(A, AInverse, B, BT, c);
// Get angle. If we have a circle then the angle is 0 (we want to avoid a
// divergence here)
const auto isCircle = checkIfIsCircle(m);
const double angle = isCircle ? 0.0 : getAngle(eigenSystem.majorAxis);
return SliceEllipseInfo(origin, eigenSystem.majorRadius,
eigenSystem.minorRadius, angle);
}
示例3: 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()");
}
}
示例4: checkIfCutExists
/**
* Check if a cut with the ellipsoid is possible at all
* @param directions: the three ellipsoid directions
* @param radii: the ellipsoid radii
* @param originEllipsoid: the origin of the ellipsoid
* @param zPlane: the z plane value
* @return true if the a cut exists, else false
*/
bool checkIfCutExists(const std::vector<Mantid::Kernel::V3D> &directions,
const std::vector<double> &radii,
const Mantid::Kernel::V3D &originEllipsoid,
double zPlane) {
// Translate into ellipsoid
const double z = zPlane - originEllipsoid.Z();
bool hasCut = false;
// For each axis check if the z point is between the z values of the
// axis endpoints
int counter = 0;
for (const auto &direction : directions) {
const auto endpoint1 = direction[2] * radii[counter];
const auto endpoint2 = -1 * direction[2] * radii[counter];
if (isBetweenEndpoints(endpoint1, endpoint2, z)) {
hasCut = true;
break;
}
++counter;
}
return hasCut;
}
示例5: 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));
}
示例6: 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();
}
}