//-------------------------------------------------- ofPoint ofPolyline::getPointAtIndexInterpolated(float findex) const { if(points.size() < 2) return ofPoint(); int i1, i2; float t; getInterpolationParams(findex, i1, i2, t); ofPoint leftPoint(points[i1]); ofPoint rightPoint(points[i2]); return leftPoint.getInterpolated(rightPoint, t); }
void Storm3D_SpotlightShared::setClipPlanes(const float *cameraView) { D3DXMATRIX m(cameraView); float determinant = D3DXMatrixDeterminant(&m); D3DXMatrixInverse(&m, &determinant, &m); D3DXMatrixTranspose(&m, &m); D3DXVECTOR3 d(direction.x, direction.y, direction.z); VC2 bd(d.x, d.z); bd.Normalize(); D3DXVECTOR3 p1(position.x - 8*bd.x, position.y, position.z - 8*bd.y); //D3DXVECTOR3 p1(position.x - 1*bd.x, position.y, position.z - 1*bd.y); D3DXVECTOR3 p2(p1.x, p1.y + 5.f, p1.z); float angle = D3DXToRadian(fov) * .55f; D3DXPLANE leftPlane; D3DXMATRIX leftTransform; D3DXMatrixRotationY(&leftTransform, -angle); D3DXVECTOR3 leftPoint(direction.x, 0, direction.z); D3DXVECTOR4 leftPoint2; D3DXVec3Transform(&leftPoint2, &leftPoint, &leftTransform); leftPoint = p1; leftPoint.x += leftPoint2.x; leftPoint.z += leftPoint2.z; D3DXPlaneFromPoints(&leftPlane, &p1, &p2, &leftPoint); D3DXPlaneNormalize(&leftPlane, &leftPlane); D3DXPlaneTransform(&leftPlane, &leftPlane, &m); D3DXPLANE rightPlane; D3DXMATRIX rightTransform; D3DXMatrixRotationY(&rightTransform, angle); D3DXVECTOR3 rightPoint(direction.x, 0, direction.z); D3DXVECTOR4 rightPoint2; D3DXVec3Transform(&rightPoint2, &rightPoint, &rightTransform); rightPoint = p1; rightPoint.x += rightPoint2.x; rightPoint.z += rightPoint2.z; D3DXPlaneFromPoints(&rightPlane, &rightPoint, &p2, &p1); D3DXPlaneNormalize(&rightPlane, &rightPlane); D3DXPlaneTransform(&rightPlane, &rightPlane, &m); D3DXPLANE backPlane; D3DXVECTOR3 pb(p1.x, p1.y, p1.z); D3DXPlaneFromPointNormal(&backPlane, &pb, &d); D3DXPlaneNormalize(&backPlane, &backPlane); D3DXPlaneTransform(&backPlane, &backPlane, &m); device.SetClipPlane(0, leftPlane); device.SetClipPlane(1, rightPlane); device.SetClipPlane(2, backPlane); device.SetRenderState(D3DRS_CLIPPLANEENABLE, D3DCLIPPLANE0 | D3DCLIPPLANE1 | D3DCLIPPLANE2); }
Point LineModel::calcRightPoint(const list<Point>* data, double maximumError) { Point rightPoint(-1,0); list<Point>::const_iterator pointIterator; for (pointIterator = data->begin(); pointIterator != data->end(); ++pointIterator) { if (calculateError(&(*pointIterator)) <= maximumError) { if( (*pointIterator).getX() > rightPoint.getX()) { rightPoint = (*pointIterator); } } } return rightPoint; }
void Overlay::editZoneMoved(QRect editZoneRect) { QPoint point = this->mapFromGlobal(QPoint(editZoneRect.x(), editZoneRect.y())); m_editZoneRect.setX(point.x()); m_editZoneRect.setY(point.y()); m_editZoneRect.setWidth(editZoneRect.width()); m_editZoneRect.setHeight(editZoneRect.height()); // hover zones : int hoverZoneSize = m_editZoneRect.height() / 15; QPoint leftPoint(m_editZoneRect.x(), m_editZoneRect.y()); m_leftHoverZone = QRect(leftPoint.x(), leftPoint.y(), - hoverZoneSize, hoverZoneSize); QPoint rightPoint(m_editZoneRect.x() + m_editZoneRect.width(), m_editZoneRect.y()); m_rightHoverZone = QRect(rightPoint.x(), rightPoint.y(), hoverZoneSize, hoverZoneSize); }
void WTFWidget::drawInnerArrow(QPainter& painter) { if(_innerPercent == 0) return; QRect rect = this->contentsRect(); QPoint center = rect.center(); painter.save(); painter.translate(center); painter.rotate(90 * _innerPercent); QColor arrowColor = QColor::fromRgb(0xff,0xff,0xff,0xff * _innerPercent); QPen pen = QPen(arrowColor); pen.setWidth(2); painter.setPen(pen); int left = - CIRCLE_INNER_RADIUS; int top = - CIRCLE_INNER_RADIUS; QRect arcRect = QRect(left,top,CIRCLE_INNER_RADIUS * 2, CIRCLE_INNER_RADIUS * 2); painter.drawArc(arcRect,90 * 16,270 * 16); // start draw arrow qreal arrowBorderLen = 8; QPainterPath path; QPoint topPoint(0, - CIRCLE_INNER_RADIUS - arrowBorderLen/2); path.moveTo(topPoint); qreal distance = (arrowBorderLen / 2) / qTan(qDegreesToRadians((double)30)); QPoint rightPoint(distance,-CIRCLE_INNER_RADIUS); path.lineTo(rightPoint); QPoint bottomPoint(0, - CIRCLE_INNER_RADIUS + arrowBorderLen/2); path.lineTo(bottomPoint); path.closeSubpath(); painter.fillPath(path,QBrush(arrowColor)); painter.translate(-center.x(),-center.y()); painter.restore(); }
JFPoint JTimerObj::outputPoint(int n, JLinkObj& link) { if (!n) return rightPoint(n, link, 0, 1); return bottomPoint(n, link, 1, OUT_LAST-1); }
JFPoint JTNGObj::outputPoint(int n, JLinkObj& link) { return rightPoint(n, link, 0, ogm, 0, 1);}
JFPoint JSampleObj::outputPoint(int n, JLinkObj& link) { return rightPoint(n, link, 0, N, 0, 1);}
JFPoint J1DSliderObj::outputPoint(int n, JLinkObj& link) { if (type == HORIZONTAL) return rightPoint(n, link, 0, 1); return bottomPoint(n, link, 0, 1); }
void CAknNoteAttributes::SetAnimationBackGroundFrameL() { // R_QGN_GRAF_WAIT_BAR_ANIM case is OK without background frame. if (iAnimation && iAnimationID != R_QGN_GRAF_WAIT_BAR_ANIM) { // Not set background frame, if there is only one frame in animation. CBitmapAnimClientData *animClientData = iAnimation->BitmapAnimData(); if (animClientData != NULL && animClientData->FrameArray().Count() <= 1) { return; } const TDisplayMode displayMode( CCoeEnv::Static()->ScreenDevice()->DisplayMode() ); // Create skinned background frame CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; CleanupStack::PushL(bitmap); User::LeaveIfError( bitmap->Create( iAnimation->Rect().Size(), displayMode ) ); CFbsBitmapDevice* doubleBufferDev = CFbsBitmapDevice::NewL( bitmap ); CleanupStack::PushL(doubleBufferDev); CFbsBitGc* doubleBufferGc = 0; User::LeaveIfError( doubleBufferDev->CreateContext( doubleBufferGc ) ); CleanupStack::PushL(doubleBufferGc); MAknsSkinInstance* skin = AknsUtils::SkinInstance(); MAknsControlContext* cc = iBgContext; AknsDrawUtils::DrawBackground( skin, cc, iNoteControl, *doubleBufferGc, TPoint(0,0), iAnimation->Rect(), KAknsDrawParamDefault ); #if 0 // waitbar background border if ( iAnimationID == R_QGN_GRAF_WAIT_BAR_ANIM ) { CFbsBitmap* frameL = NULL; CFbsBitmap* frameCenter = NULL; CFbsBitmap* frameR = NULL; CFbsBitmap* lMask = NULL; CFbsBitmap* centerMask = NULL; CFbsBitmap* rMask = NULL; AknIconUtils::CreateIconLC( frameL, lMask, KAvkonBitmapFile, EMbmAvkonQgn_graf_bar_frame_side_l, EMbmAvkonQgn_graf_bar_frame_side_l_mask ); AknIconUtils::CreateIconLC( frameCenter, centerMask, KAvkonBitmapFile, EMbmAvkonQgn_graf_bar_frame_center, EMbmAvkonQgn_graf_bar_frame_center_mask); AknIconUtils::CreateIconLC( frameR, rMask, KAvkonBitmapFile, EMbmAvkonQgn_graf_bar_frame_side_r, EMbmAvkonQgn_graf_bar_frame_side_r_mask ); TAknLayoutRect frameGraphicLayout; frameGraphicLayout.LayoutRect( iAnimation->Rect(), AknLayoutScalable_Avkon::wait_border_pane_g1() ); User::LeaveIfError( AknIconUtils::SetSize( frameL, frameGraphicLayout.Rect().Size(), EAspectRatioNotPreserved ) ); frameGraphicLayout.LayoutRect( iAnimation->Rect(), AknLayoutScalable_Avkon::wait_border_pane_g2() ); User::LeaveIfError( AknIconUtils::SetSize( frameCenter, frameGraphicLayout.Rect().Size(), EAspectRatioNotPreserved ) ); frameGraphicLayout.LayoutRect( iAnimation->Rect(), AknLayoutScalable_Avkon::wait_border_pane_g3() ); User::LeaveIfError( AknIconUtils::SetSize( frameR, frameGraphicLayout.Rect().Size(), EAspectRatioNotPreserved ) ); TPoint centerPoint( frameL->SizeInPixels().iWidth, 0 ); TPoint rightPoint( centerPoint.iX + frameCenter->SizeInPixels().iWidth, 0 ); doubleBufferGc->BitBltMasked( TPoint( 0, 0), frameL, TRect( TPoint( 0, 0 ), frameL->SizeInPixels() ), lMask, EFalse ); doubleBufferGc->BitBltMasked( centerPoint, frameCenter, TRect( frameCenter->SizeInPixels() ), centerMask, EFalse ); doubleBufferGc->BitBltMasked( rightPoint, frameR, TRect( frameR->SizeInPixels() ), rMask, EFalse ); CleanupStack::PopAndDestroy( 6 ); if ( iAnimation->BitmapAnimData()->PlayMode() == CBitmapAnimClientData::EPlay ) iAnimation->BitmapAnimData()->SetPlayMode(CBitmapAnimClientData::ECycle); } #endif CleanupStack::PopAndDestroy(2); // doubleBufferGc, doubleBufferDev // finally set background frame CBitmapFrameData* data = CBitmapFrameData::NewL(); data->SetBitmapsOwnedExternally( EFalse ); data->SetBitmap( bitmap ); // Set frame to animation iAnimation->BitmapAnimData()->SetBackgroundFrame( data ); // gets ownership CleanupStack::Pop(bitmap); // bitmap } }