void dxJointPU::setRelativeValues() { dVector3 anchor; dJointGetPUAnchor(this, anchor); setAnchors( this, anchor[0], anchor[1], anchor[2], anchor1, anchor2 ); dVector3 ax1, ax2, ax3; dJointGetPUAxis1(this, ax1); dJointGetPUAxis2(this, ax2); dJointGetPUAxis3(this, ax3); if ( flags & dJOINT_REVERSE ) { setAxes( this, ax1[0], ax1[1], ax1[2], NULL, axis2 ); setAxes( this, ax2[0], ax2[1], ax2[2], axis1, NULL ); } else { setAxes( this, ax1[0], ax1[1], ax1[2], axis1, NULL ); setAxes( this, ax2[0], ax2[1], ax2[2], NULL, axis2 ); } setAxes( this, ax3[0], ax3[1], ax3[2], axisP1, NULL ); computeInitialRelativeRotations(); }
void dxJointHinge2::setRelativeValues() { dVector3 anchor; dJointGetHinge2Anchor(this, anchor); setAnchors( this, anchor[0], anchor[1], anchor[2], anchor1, anchor2 ); dVector3 axis; if ( node[0].body ) { dJointGetHinge2Axis1(this, axis); setAxes( this, axis[0],axis[1],axis[2], axis1, NULL ); } if ( node[0].body ) { dJointGetHinge2Axis2(this, axis); setAxes( this, axis[0],axis[1],axis[2], NULL, axis2 ); } dVector3 ax1, ax2; getAxisInfo( ax1, ax2, axis, s0, c0 ); makeV1andV2(); makeW1andW2(); }
void dJointSetPUAxis2( dJointID j, dReal x, dReal y, dReal z ) { dxJointPU* joint = ( dxJointPU* ) j; dUASSERT( joint, "bad joint argument" ); checktype( joint, PU ); if ( joint->flags & dJOINT_REVERSE ) setAxes( joint, x, y, z, joint->axis1, NULL ); else setAxes( joint, x, y, z, NULL, joint->axis2 ); joint->computeInitialRelativeRotations(); }
bool SingleCellViewGraphPanelPlotWidget::resetAxes(const bool &pCanReplot) { // Reset our axes by setting their values to either default ones or to some // that allow to see all the graphs QRectF dRect = dataRect(); if (dRect == QRectF()) { return setAxes(QRectF(DefMinAxis, DefMinAxis, DefMaxAxis-DefMinAxis, DefMaxAxis-DefMinAxis), pCanReplot); } else { return setAxes(optimisedRect(dRect), pCanReplot); } }
void dxJointPR::setRelativeValues() { dVector3 anchor; dJointGetPRAnchor(this, anchor); setAnchors( this, anchor[0], anchor[1], anchor[2], offset, anchor2 ); dVector3 axis; dJointGetPRAxis1(this, axis); setAxes( this, axis[0], axis[1], axis[2], axisP1, 0 ); dJointGetPRAxis2(this, axis); setAxes( this, axis[0], axis[1], axis[2], axisR1, axisR2 ); computeInitialRelativeRotation(); }
/** * Copy axes from event */ void InputSequence::copyAxes(GdkEvent* event) { XOJ_CHECK_TYPE(InputSequence); clearAxes(); setAxes((gdouble*)g_memdup(event->motion.axes, sizeof(gdouble) * gdk_device_get_n_axes(device))); }
void dJointSetPRAxis2( dJointID j, dReal x, dReal y, dReal z ) { dxJointPR* joint = ( dxJointPR* ) j; dUASSERT( joint, "bad joint argument" ); checktype( joint, PR ); setAxes( joint, x, y, z, joint->axisR1, joint->axisR2 ); joint->computeInitialRelativeRotation(); }
void dJointSetHingeAxis( dJointID j, dReal x, dReal y, dReal z ) { dxJointHinge* joint = ( dxJointHinge* )j; dUASSERT( joint, "bad joint argument" ); checktype( joint, Hinge ); setAxes( joint, x, y, z, joint->axis1, joint->axis2 ); joint->computeInitialRelativeRotation(); }
bool SingleCellViewGraphPanelPlotWidget::setAxes(const QRectF &pAxesRect, const bool &pCanReplot) { // Set our axes' values return setAxes(pAxesRect.left(), pAxesRect.left()+pAxesRect.width(), pAxesRect.top(), pAxesRect.top()+pAxesRect.height(), pCanReplot); }
BasicGraph::BasicGraph(QString _name, int _range, QWidget *parent ): QWidget(parent), range(_range){ name = _name; setAxes(); gap = 10; step = 5; thickness = 0; }
void LLCoordFrame::setAxes(const LLQuaternion &q ) { LLMatrix3 rotation_matrix(q); setAxes(rotation_matrix); if( !isFinite() ) { reset(); llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; } }
void dJointSetPUAxis3( dJointID j, dReal x, dReal y, dReal z ) { dxJointPU* joint = ( dxJointPU* ) j; dUASSERT( joint, "bad joint argument" ); checktype( joint, PU ); setAxes( joint, x, y, z, joint->axisP1, 0 ); joint->computeInitialRelativeRotations(); }
void dJointSetSliderAxis ( dJointID j, dReal x, dReal y, dReal z ) { dxJointSlider* joint = ( dxJointSlider* ) j; dUASSERT ( joint, "bad joint argument" ); checktype ( joint, Slider ); setAxes ( joint, x, y, z, joint->axis1, 0 ); joint->computeOffset(); joint->computeInitialRelativeRotation(); }
void dxJointScrew::setRelativeValues() { dVector3 vec; dJointGetScrewAnchor(this, vec); setAnchors( this, vec[0], vec[1], vec[2], anchor1, anchor2 ); dJointGetScrewAxis(this, vec); setAxes( this, vec[0], vec[1], vec[2], axis1, axis2 ); computeInitialRelativeRotation(); }
BasicGraph::BasicGraph(QString _name,int _range,int _x,int _y,int w,int h, QWidget *parent ): QWidget(parent), range(_range){ move(_x,_y); setFixedSize(w, h); name = _name; setAxes(); gap = 10; step = 5; thickness = 0; }
bool iAIDA::AIDA_XMLStore::Histo1DTranslator::toXML() { // write name and title appendObjectHeader(m_element,"histogram1d",m_name,m_histo->title(),m_path); appendAnnotation(m_element,m_histo->annotation()); if (!setAxes() ) return false; if (!setStatistics() ) return false; if (!setData () ) return false; return true; }
void SingleCellViewGraphPanelPlotWidget::mouseReleaseEvent(QMouseEvent *pEvent) { // Default handling of the event QwtPlot::mouseReleaseEvent(pEvent); // Check whether we need to carry out a action if (mAction == None) return; // Finish carrying out the action, if needed switch (mAction) { case ZoomRegion: { // Retrieve our zoom region QRect zoomRegionRect = mOverlayWidget->zoomRegion(); // Reset our action resetAction(); // Effectively zoom our region, if possible, by updating our axes QRectF zoomRegion = QRectF(canvasPoint(zoomRegionRect.topLeft(), false), canvasPoint(zoomRegionRect.topLeft()+QPoint(zoomRegionRect.width(), zoomRegionRect.height()), false)); if (zoomRegion.width() && zoomRegion.height()) setAxes(zoomRegion.left(), zoomRegion.left()+zoomRegion.width(), zoomRegion.top()+zoomRegion.height(), zoomRegion.top()); break; } default: // A action that doesn't require anything specific to be done, except to // reset our action resetAction(); } // Show our context menu, if still needed if (mNeedContextMenu) { mOriginPoint = mapFromGlobal(QCursor::pos()); mContextMenu->exec(QCursor::pos()); } }
void dxJointUniversal::setRelativeValues() { dVector3 anchor; dJointGetUniversalAnchor(this, anchor); setAnchors( this, anchor[0], anchor[1], anchor[2], anchor1, anchor2 ); dVector3 ax1,ax2; dJointGetUniversalAxis1(this, ax1); dJointGetUniversalAxis2(this, ax2); if ( flags & dJOINT_REVERSE ) { setAxes( this, ax1[0],ax1[1],ax1[2], NULL, axis2 ); setAxes( this, ax2[0],ax2[1],ax2[2], axis1, NULL ); } else { setAxes( this, ax1[0],ax1[1],ax1[2], axis1, NULL ); setAxes( this, ax2[0],ax2[1],ax2[2], NULL, axis2 ); } computeInitialRelativeRotations(); }
void dJointSetHinge2Axis1( dJointID j, dReal x, dReal y, dReal z ) { dxJointHinge2* joint = ( dxJointHinge2* )j; dUASSERT( joint, "bad joint argument" ); checktype( joint, Hinge2 ); if ( joint->node[0].body ) { setAxes(joint, x, y, z, joint->axis1, NULL); // compute the sin and cos of the angle between axis 1 and axis 2 dVector3 ax1, ax2, ax; joint->getAxisInfo( ax1, ax2, ax, joint->s0, joint->c0 ); } joint->makeV1andV2(); }
void dJointSetScrewAxisOffset( dJointID j, dReal x, dReal y, dReal z, dReal dangle ) { dxJointScrew* joint = ( dxJointScrew* )j; dUASSERT( joint, "bad joint argument" ); checktype( joint, Screw ); setAxes( joint, x, y, z, joint->axis1, joint->axis2 ); joint->computeInitialRelativeRotation(); if ( joint->flags & dJOINT_REVERSE ) dangle = -dangle; dQuaternion qAngle, qOffset; dQFromAxisAndAngle(qAngle, x, y, z, dangle); dQMultiply3(qOffset, qAngle, joint->qrel); joint->qrel[0] = qOffset[0]; joint->qrel[1] = qOffset[1]; joint->qrel[2] = qOffset[2]; joint->qrel[3] = qOffset[3]; }
//-------------------------------------------------------------- void testApp::draw(){ ofSetColor(0xffffff); //vidGrabber.draw(20,20); //videoTexture.draw(20+camWidth,20,camWidth,camHeight); videoImage->draw(20, 20); if (backgroundImage != NULL) { compareImages(videoImage, backgroundImage, imageBW); imageBW->draw(20+camWidth, 20); setAxes(imageBW); char theThresh[255]; sprintf(theThresh, "Threshold: %i", threshold); ofDrawBitmapString(theThresh, 840, 450); ofSetColor(255, 0, 0); // ofCircle(center[0], center[1], 5); ofPushMatrix(); ofTranslate(20+camWidth, 20); ofCircle(center[0], center[1], 5); ofLine(center[0]+(100*cos(major) ), center[1] + (100*sin(major)), center[0]-(100*cos(major) ), center[1] - (100*sin(major))); ofSetColor(0, 255, 0); ofLine(center[0]+(100*sin(minor) ), center[1] + (100*cos(minor)), center[0]-(100*sin(minor) ), center[1] - (100*cos(minor))); ofPopMatrix(); ofSetColor(0, 0, 0); char centroid[255]; sprintf(centroid, "Centroid: x: %i y: %i, Major: %f, Minor: %f", center[0], center[1], major, minor); ofDrawBitmapString(centroid, 840, 460); } }
/* * Function to plot data */ void CQBarChart::plotData() { #ifdef DEBUG_UI qDebug() << "-- in qwt3dPlot.cpp Plot3d::plotData --"; #endif resizeCoordSys(); mpBar = (Bar*)mpPlot->setPlotStyle(Bar(mData.faktor * 0.4, -1, -1)); setPlotTitle(); if (mColorLegend == true) setLegend(); setZoom(); setAxes(); mpPlot->setCoordinateStyle(Qwt3D::FRAME); mpPlot->updateData(); mpPlot->updateGL(); }
void dJointSetSliderAxisDelta ( dJointID j, dReal x, dReal y, dReal z, dReal dx, dReal dy, dReal dz ) { dxJointSlider* joint = ( dxJointSlider* ) j; dUASSERT ( joint, "bad joint argument" ); checktype ( joint, Slider ); setAxes ( joint, x, y, z, joint->axis1, 0 ); joint->computeOffset(); // compute initial relative rotation body1 -> body2, or env -> body1 // also compute center of body1 w.r.t body 2 if ( !(joint->node[1].body) ) { joint->offset[0] += dx; joint->offset[1] += dy; joint->offset[2] += dz; } joint->computeInitialRelativeRotation(); }
// at and up_direction are presumed to be normalized void LLCoordFrame::lookDir(const LLVector3 &at, const LLVector3 &up_direction) { // Make sure 'at' and 'up_direction' are not parallel // and that neither are zero-length vectors LLVector3 left(up_direction % at); if (left.isNull()) { //tweak lookat pos so we don't get a degenerate matrix LLVector3 tempat(at[VX] + 0.01f, at[VY], at[VZ]); tempat.normVec(); left = (up_direction % tempat); } left.normVec(); LLVector3 up = at % left; if (at.isFinite() && left.isFinite() && up.isFinite()) { setAxes(at, left, up); } }
void SingleCellViewGraphPanelPlotWidget::scaleAxes(const QPoint &pPoint, const double &pScalingFactorX, const double &pScalingFactorY) { // Rescale our X axis, but only if zooming in/out is possible on that axis QPointF originPoint = canvasPoint(pPoint); double newMinX = minX(); double newMaxX = maxX(); double newMinY = minY(); double newMaxY = maxY(); bool scaledAxisX = scaleAxis(pScalingFactorX, mCanZoomInX, mCanZoomOutX, originPoint.x(), newMinX, newMaxX); bool scaledAxisY = scaleAxis(pScalingFactorY, mCanZoomInY, mCanZoomOutY, originPoint.y(), newMinY, newMaxY); // Note: we want to make both calls to scaleAxis(), hence they are not part // of the if() statement below... if (scaledAxisX || scaledAxisY) setAxes(newMinX, newMaxX, newMinY, newMaxY); }
void dJointSetUniversalAxis1Offset( dJointID j, dReal x, dReal y, dReal z, dReal offset1, dReal offset2 ) { dxJointUniversal* joint = ( dxJointUniversal* )j; dUASSERT( joint, "bad joint argument" ); checktype( joint, Universal ); if ( joint->flags & dJOINT_REVERSE ) { setAxes( joint, x, y, z, NULL, joint->axis2 ); offset1 = -offset1; offset2 = -offset2; } else setAxes( joint, x, y, z, joint->axis1, NULL ); joint->computeInitialRelativeRotations(); dVector3 ax2; getAxis2( joint, ax2, joint->axis2 ); { dVector3 ax1; joint->getAxes(ax1, ax2); } dQuaternion qAngle; dQFromAxisAndAngle(qAngle, x, y, z, offset1); dMatrix3 R; dRFrom2Axes( R, x, y, z, ax2[0], ax2[1], ax2[2] ); dQuaternion qcross; dRtoQ( R, qcross ); dQuaternion qOffset; dQMultiply0(qOffset, qAngle, qcross); dQMultiply1( joint->qrel1, joint->node[0].body->q, qOffset ); // Calculating the second offset dQFromAxisAndAngle(qAngle, ax2[0], ax2[1], ax2[2], offset2); dRFrom2Axes( R, ax2[0], ax2[1], ax2[2], x, y, z ); dRtoQ( R, qcross ); dQMultiply1(qOffset, qAngle, qcross); if ( joint->node[1].body ) { dQMultiply1( joint->qrel2, joint->node[1].body->q, qOffset ); } else { joint->qrel2[0] = qcross[0]; joint->qrel2[1] = qcross[1]; joint->qrel2[2] = qcross[2]; joint->qrel2[3] = qcross[3]; } }
void SingleCellViewGraphPanelPlotWidget::mouseMoveEvent(QMouseEvent *pEvent) { // Default handling of the event QwtPlot::mouseMoveEvent(pEvent); // Carry out the action switch (mAction) { case Pan: { // Determine the X/Y shifts for our panning QPointF origPoint = canvasPoint(mPoint); QPointF crtPoint = canvasPoint(pEvent->pos()); double shiftX = crtPoint.x()-origPoint.x(); double shiftY = crtPoint.y()-origPoint.y(); mPoint = pEvent->pos(); // Set our axes' new values setAxes(minX()-shiftX, maxX()-shiftX, minY()-shiftY, maxY()-shiftY); break; } case ShowCoordinates: // Update the point of our overlay widget mOverlayWidget->setPoint(pEvent->pos()); break; case Zoom: { // Determine our X/Y delta values QPointF origPoint = canvasPoint(mPoint); QPointF crtPoint = canvasPoint(pEvent->pos()); double deltaX = crtPoint.x()-origPoint.x(); double deltaY = crtPoint.y()-origPoint.y(); mPoint = pEvent->pos(); // Rescale ourselves // Note: this will automatically replot ourselves... scaleAxes(mOriginPoint, deltaX? (deltaX > 0)? ScalingInFactor: ScalingOutFactor: NoScalingFactor, deltaY? (deltaY < 0)? ScalingInFactor: ScalingOutFactor: NoScalingFactor); break; } case ZoomRegion: // Update our zoom region by updating the point of our overlay widget mOverlayWidget->setPoint(pEvent->pos()); break; default: // None ; } // The mouse has moved, so we definitely won't need to show our context menu mNeedContextMenu = false; }
SingleCellViewGraphPanelPlotWidget::SingleCellViewGraphPanelPlotWidget(QWidget *pParent) : QwtPlot(pParent), Core::CommonWidget(pParent), mGui(new Ui::SingleCellViewGraphPanelPlotWidget), mGraphs(QList<SingleCellViewGraphPanelPlotGraph *>()), mAction(None), mOriginPoint(QPoint()), mPoint(QPoint()), mCanZoomInX(true), mCanZoomOutX(true), mCanZoomInY(true), mCanZoomOutY(true), mNeedContextMenu(false) { // Set up the GUI mGui->setupUi(this); // Get ourselves a direct painter mDirectPainter = new QwtPlotDirectPainter(this); // Speedup painting on X11 systems // Note: this can only be done on X11 systems... if (QwtPainter::isX11GraphicsSystem()) canvas()->setAttribute(Qt::WA_PaintOnScreen, true); // Customise ourselves a bit setCanvasBackground(Qt::white); mAxisX = new SingleCellViewGraphPanelPlotScaleDraw(); mAxisY = new SingleCellViewGraphPanelPlotScaleDraw(); setAxisScaleDraw(QwtPlot::xBottom, mAxisX); setAxisScaleDraw(QwtPlot::yLeft, mAxisY); // We don't want a frame around ourselves qobject_cast<QwtPlotCanvas *>(canvas())->setFrameShape(QFrame::NoFrame); // Set our axes' values // Note: we are not all initialised yet, so we don't want to setAxes() to // replot ourselves... setAxes(DefMinAxis, DefMaxAxis, DefMinAxis, DefMaxAxis, false); // Attach a grid to ourselves QwtPlotGrid *grid = new QwtPlotGrid(); grid->setMajorPen(Qt::gray, 0, Qt::DotLine); grid->attach(this); // Create our overlay widget mOverlayWidget = new SingleCellViewGraphPanelPlotOverlayWidget(this); // Create our context menu mContextMenu = new QMenu(this); mContextMenu->addAction(mGui->actionCopyToClipboard); mContextMenu->addSeparator(); mContextMenu->addAction(mGui->actionZoomIn); mContextMenu->addAction(mGui->actionZoomOut); mContextMenu->addSeparator(); mContextMenu->addAction(mGui->actionResetZoom); }
void dJointSetUniversalAxis2Offset( dJointID j, dReal x, dReal y, dReal z, dReal offset1, dReal offset2 ) { dxJointUniversal* joint = ( dxJointUniversal* )j; dUASSERT( joint, "bad joint argument" ); checktype( joint, Universal ); if ( joint->flags & dJOINT_REVERSE ) { setAxes( joint, x, y, z, joint->axis1, NULL ); offset1 = -offset2; offset2 = -offset1; } else setAxes( joint, x, y, z, NULL, joint->axis2 ); joint->computeInitialRelativeRotations(); // It is easier to retreive the 2 axes here since // when there is only one body B2 (the axes switch position) // Doing this way eliminate the need to write the code differently // for both case. dVector3 ax1, ax2; joint->getAxes(ax1, ax2 ); dQuaternion qAngle; dQFromAxisAndAngle(qAngle, ax1[0], ax1[1], ax1[2], offset1); dMatrix3 R; dRFrom2Axes( R, ax1[0], ax1[1], ax1[2], ax2[0], ax2[1], ax2[2]); dQuaternion qcross; dRtoQ( R, qcross ); dQuaternion qOffset; dQMultiply0(qOffset, qAngle, qcross); dQMultiply1( joint->qrel1, joint->node[0].body->q, qOffset ); // Calculating the second offset dQFromAxisAndAngle(qAngle, ax2[0], ax2[1], ax2[2], offset2); dRFrom2Axes( R, ax2[0], ax2[1], ax2[2], ax1[0], ax1[1], ax1[2]); dRtoQ( R, qcross ); dQMultiply1(qOffset, qAngle, qcross); if ( joint->node[1].body ) { dQMultiply1( joint->qrel2, joint->node[1].body->q, qOffset ); } else { joint->qrel2[0] = qcross[0]; joint->qrel2[1] = qcross[1]; joint->qrel2[2] = qcross[2]; joint->qrel2[3] = qcross[3]; } }
void BasicGraph::resizeEvent(QResizeEvent * event){ (void)event; setAxes(); }