void LoLEngine::placeMoveLevelItem(Item itemIndex, int level, int block, int xOffs, int yOffs, int flyingHeight) { calcCoordinates(_itemsInPlay[itemIndex].x, _itemsInPlay[itemIndex].y, block, xOffs, yOffs); if (_itemsInPlay[itemIndex].block) removeLevelItem(itemIndex, _itemsInPlay[itemIndex].block); if (_currentLevel == level) { setItemPosition(itemIndex, _itemsInPlay[itemIndex].x, _itemsInPlay[itemIndex].y, flyingHeight, 1); } else { _itemsInPlay[itemIndex].level = level; _itemsInPlay[itemIndex].block = block; _itemsInPlay[itemIndex].flyingHeight = flyingHeight; _itemsInPlay[itemIndex].shpCurFrame_flg |= 0x4000; } }
Tak::Tak(Knoop *sourceNode, Knoop *destNode, bool directedEdge) { source = sourceNode; dest = destNode; directed = directedEdge; paintRed = false; paintBlue = false; paintPurple = false; calcCoordinates(); pLineEdit = new QLineEdit(""); pLineEdit->setMaxLength(3); //er kunnen maximaal 3 karakters in de text box geplaatst worden pLineEdit->setFixedSize(40, 20); //de grootte van de text box pLineEdit->setValidator(new QIntValidator); pMyProxy = new QGraphicsProxyWidget(this); // the proxy's parent is the 2d object pMyProxy->setWidget(pLineEdit); //voeg de text box toe placeTextBox(); //voeg toe aan adjancency list }
void PlaneWellLog::traverse(osg::NodeVisitor& nv) { WellLog::traverse( nv ); if( !_logPath->size() ) return; if ( nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR ) { if ( _forceReBuild ) { calcFactors(); _colorTableChanged = true; _forceCoordReCalculation = true; } if ( _colorTableChanged ) updateFilledLogColor(); } else if ( nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR ) { osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv); const osg::Vec3 projdir = getPrjDirection(cv); const osg::Vec3 normal = calcNormal(projdir); if ( _forceCoordReCalculation || eyeChanged(projdir) || _logWidthChanged ) { calcCoordinates(normal); _preProjDir = projdir; _logWidthChanged = false; if ( _lineWidth->getWidth() == 0 ) getStateSet()->removeAttribute(_lineWidth); else getStateSet()->setAttributeAndModes(_lineWidth); dirtyBound(); } osg::ref_ptr<osg::MatrixTransform> tr = new osg::MatrixTransform; osg::ref_ptr<osg::RefMatrix> modelViewMatrix = const_cast<osgUtil::CullVisitor*>(cv)->getModelViewMatrix(); if ( getStateSet() ) cv->pushStateSet( getStateSet() ); osg::Matrix repeatTransform; osg::BoundingBox bbox; for ( int idx=0; idx<(int)_repeatNumber; idx++ ) { repeatTransform.setTrans( normal*idx*getRepeatStep() ); osg::Matrix RMV = repeatTransform * (*modelViewMatrix); osg::ref_ptr<osg::RefMatrix> rfMx = new osg::RefMatrix(RMV); const osg::BoundingBox bbtri = _triangleGeometry->getBound() ; const osg::BoundingBox bbline = _lineGeometry->getBound(); bbox.expandBy( bbtri ); bbox.expandBy( bbline ); if ( bbox.radius() == 0 ) return; const float depth = cv->getDistanceFromEyePoint(bbox.center(),false); cv->addDrawableAndDepth( _lineGeometry, rfMx, depth ); cv->addDrawableAndDepth( _triangleGeometry, rfMx, depth ); } if ( _bbox._min != bbox._min || _bbox._max != bbox._max ) { dirtyBound(); _bbox = bbox; } if ( getStateSet() ) cv->popStateSet(); } else { osgUtil::IntersectionVisitor* iv = dynamic_cast<osgUtil::IntersectionVisitor*>(&nv); if ( iv && iv->getModelMatrix() ) { const osg::Vec3 normal = calcNormal( _preProjDir ); osg::Matrix repeatTransform; for ( int idx=0; idx<(int)_repeatNumber; idx++ ) { repeatTransform.setTrans(normal*idx*getRepeatStep()); osg::Matrix mat = repeatTransform * (*iv->getModelMatrix()); osg::ref_ptr<osg::RefMatrix> rfMx = new osg::RefMatrix(mat); iv->pushModelMatrix( rfMx ); osg::ref_ptr<osgUtil::Intersector> intersec = iv->getIntersector()->clone(*iv); if ( intersec.valid() ) { intersec->intersect(*iv, _lineGeometry); intersec->intersect(*iv, _triangleGeometry); } iv->popModelMatrix(); } } osgGeo::ComputeBoundsVisitor* cbv = dynamic_cast<osgGeo::ComputeBoundsVisitor*>(&nv); if ( cbv ) cbv->applyBoundingBox(_bbox); } }
/** getCoordinates() * @return Returns coordinates in point with floats. */ cv::Point2f Car::getCoordinates() { calcCoordinates(); return coor; }
void Gps::update() { float angle = 0.0; /* 4msecごとの車体角度の変化量 (度) */ float radius = 0.0; /* 4msecごとの車体の描く円の半径 */ float el = 0.0; /* 4msec間のエンコーダー値の変化量(left) */ float er = 0.0; /* 4msec間のエンコーダー値の変化量(right) */ float currEl = 0.0; /* 現在のエンコーダー値(left) */ float currEr = 0.0; /* 現在のエンコーダー値(right) */ timeCounter++; /********* 値取得 *********/ /* エンコーダー値を取得 */ motorL.setCount(); motorR.setCount(); currEl = motorL.getCount(); currEr = motorR.getCount(); /* 4msec間のエンコーダー値の変化量を計算 */ el = currEl - prevEl; er = currEr - prevEr; /********* 値取得終了 *********/ /********* 座標計算 ***********/ angle = calcAngle(el, er); /* 曲がった角度を計算 */ radius = calcRadius(el, angle); /* 走行体の描く円の半径を計算 */ calcCoordinates(angle, radius, el); /* 座標の更新 */ calcDirection(angle); /* 現在向いている方向の更新 */ /********* 座標計算終了 *******/ /******* prevEl,Erの更新 ******/ prevEl = currEl; prevEr = currEr; /**** prevEl,Erの更新の終了****/ /************ 座標補正 *****************/ //lcd.clear(); //lcd.putf("d", ); //lcd .disp(); /* if(timeCounter%50 !=0) { xHistory += mXCoordinate; yHistory += mYCoordinate; mDirectionHistory += mDirection; } else { xHistory = (xHistory+mXCoordinate)/timeCounter; yHistory = (yHistory + mYCoordinate)/timeCounter; mDirectionHistory = (mDirectionHistory + mDirection)/timeCounter; if(!gAngleTraceFlag) adjustPosition(xHistory, yHistory, mDirectionHistory); xHistory = 0; yHistory = 0; mDirectionHistory = 0; timeCounter = 0; } */ prevEl = currEl; prevEr = currEr; }