void KReportPosition::setPointPos(const QPointF& pos, UpdatePropertyFlag update) { m_pointPos.setX(pos.x()); m_pointPos.setY(pos.y()); if (update == UpdateProperty) m_property->setValue(toUnit()); }
void KReportPosition::setUnitPos(const QPointF& pos, UpdatePropertyFlag update) { const qreal x = m_unit.fromUserValue(pos.x()); const qreal y = m_unit.fromUserValue(pos.y()); m_pointPos.setX(x); m_pointPos.setY(y); if (update == UpdateProperty) m_property->setValue(toUnit()); }
void KReportPosition::setScenePos(const QPointF& pos, UpdatePropertyFlag update) { QScreen *srn = QApplication::screens().at(0); const qreal x = INCH_TO_POINT(pos.x() / srn->logicalDotsPerInchX()); const qreal y = INCH_TO_POINT(pos.y() / srn->logicalDotsPerInchY()); m_pointPos.setX(x); m_pointPos.setY(y); if (update == UpdateProperty) m_property->setValue(toUnit()); }
void Quaternion2::GetAxisAngle(double &theta, double &xx, double &yy, double &zz) { toUnit(); theta = 2 * acos(w); double s = sqrt(1 - w * w); // assuming Quaternion2 normalised then w is less than 1, so term always positive. if (s < 0.001) { // test to avoid divide by zero, s is always positive due to sqrt // if s close to zero then direction of axis not important xx = x; // if it is important that axis is normalised then replace with x=1; y=z=0; yy = y; zz = z; } else { xx = x / s; // normalise axis yy = y / s; zz = z / s; } }
void KReportPosition::setUnit(const KReportUnit& u) { m_unit = u; m_property->setValue(toUnit()); }