void pointer_constructor()
{
   {
      boost::interprocess::intrusive_ptr<X, VP> px(0);
      BOOST_TEST(px.get() == 0);
   }

   {
      boost::interprocess::intrusive_ptr<X, VP> px(0, false);
      BOOST_TEST(px.get() == 0);
   }

   {
      boost::interprocess::offset_ptr<X> p = new X;
      BOOST_TEST(p->use_count() == 0);

      boost::interprocess::intrusive_ptr<X, VP> px(p);
      BOOST_TEST(px.get() == p);
      BOOST_TEST(px->use_count() == 1);
   }

   {
      boost::interprocess::offset_ptr<X> p = new X;
      BOOST_TEST(p->use_count() == 0);

      intrusive_ptr_add_ref(p.get());
      BOOST_TEST(p->use_count() == 1);

      boost::interprocess::intrusive_ptr<X, VP> px(p, false);
      BOOST_TEST(px.get() == p);
      BOOST_TEST(px->use_count() == 1);
   }
}
Example #2
0
   bool tAoi::overlap( tAoi  const& area_ )const {
      int s0 = area();
      int s1 = area_.area();

      if( s0 > s1 ) {

         int xend = area_.px() + area_.sx();
         int yend = area_.py() + area_.sy();

         for( int y = area_.py(); y < yend; y++ ) {
            for( int x = area_.px(); x < xend; x++ ) {
               if( inside( int32_xy( x, y ) ) != false ) {
                  return true;
               }
            }
         }
      } else {
         int xend = px() + sx();
         int yend = py() + sy();

         for( int y = py(); y < yend; y++ ) {
            for( int x = px(); x < xend; x++ ) {
               if( area_.inside( int32_xy( x, y ) ) != false ) {
                  return true;
               }
            }
         }
      }

      return false;
   }
Example #3
0
int st_setOutputWnd(int x, int y, int w, int h)
{
	cJSON *param = cJSON_CreateObject();
	cJSON_AddItemToObject(param, "x_pos",  px(x));
	cJSON_AddItemToObject(param, "y_pos",  px(y));
	cJSON_AddItemToObject(param, "width",  px(w));
	cJSON_AddItemToObject(param, "height", px(h));
	return st_command(elcmd_setOutputWnd, param);
}
Example #4
0
static inline unsigned int xfmt16 (char *s, char const *key)
{
  register unsigned int j = 0 ;
  j += px((unsigned char)key[0] >> 4) ;
  j += px((unsigned char)key[0] & 15) ;
  j += px((unsigned char)key[1] >> 4) ;
  j += px((unsigned char)key[1] & 15) ;
  return j ? j : (*s = '0', 1) ;
}
float Statistics::calcInformationMeasures1()
{
	float result = 0;
	for (int direction = 0; direction < 4; direction++)
	{
		float** com = 0;
		switch(direction)
		{
			case 0:
				com = this->m_cooc0;
				break;
			case 1:
				com = this->m_cooc1;
				break;
			case 2:
				com = this->m_cooc2;
				break;
			case 3:
				com = this->m_cooc3;
				break;
		}
		//calculate HXY1
		float HXY1 = 0;
		for (int i = 0; i < this->m_numColors; i++)
		{
			for (int j = 0; j < this->m_numColors; j++)
			{
				HXY1 += com[i][j] * log(px(com, i) * py(com, j) + Statistics::epsilon);
			}
		}
		HXY1 *= -1;

		//calculate HX and HY
		float HX = 0, HY = 0;
		for (int i = 0; i < this->m_numColors; i++)
		{
			HX += px(com, i) * log(px(com, i) + Statistics::epsilon);
			HY += py(com, i) * log(py(com, i) + Statistics::epsilon);
		}
		HX *= -1;
		HY *= -1;

		//calculate HXY
		float HXY = calcEntropy(com);

		//calculate  information measures 1
		result += (HXY - HXY1) / max(HX, HY);
	}

	return result / 4;
}
void print(int n) {
    if(n<0) {
        n=-n;
        px('-');
    }
    int i=10;
    char o[10];
    do {
        o[--i] = (n%10) + '0'; n/=10;
    }while(n);
    do {
        px(o[i]);
    }while(++i<10);
}
Example #7
0
   bool tAoi::inside( int32_xy const& p )const {
      bool ret = false;
      int x = p.x();
      int y = p.y();

      if( x >=  px()          &&
            x < static_cast<int>( ( px() + sx() ) )  &&
            y >=  py()          &&
            y < static_cast<int>( ( py() + sy() ) ) ) {
         ret = true;
      }

      return ret;
   }
float Statistics::calcCorrelation()
{
	float result = 0;
	for (int direction = 0; direction < 4; direction++)
	{
		float** com = 0;
		switch(direction)
		{
			case 0:
				com = this->m_cooc0;
				break;
			case 1:
				com = this->m_cooc1;
				break;
			case 2:
				com = this->m_cooc2;
				break;
			case 3:
				com = this->m_cooc3;
				break;
		}
			
		float ux = 0, uy = 0, sx = 0, sy = 0;

		//calculate means of px and py
		for (int i = 0; i < this->m_numColors; i++)
		{
			ux += px(com, i) / this->m_numColors;
			uy += py(com, i) / this->m_numColors;
		}
		//calculate standard deviations of px and py
		for (int i = 0; i < this->m_numColors; i++)
		{
			sx += (px(com, i) - ux) * (px(com, i) - ux);
			sy += (py(com, i) - uy) * (py(com, i) - uy);
		}
		sx = sqrt(sx);
		sy = sqrt(sy);
		//calculate correlation
		for (int i = 0; i < this->m_numColors; i++)
		{
			for (int j = 0; j < this->m_numColors; j++)
			{
				result += (i * j * com[i][j] - ux * uy) / (sx * sy);
			}
		}
	}
	return result / 4;
}
Example #9
0
/* the local maximal Gabor inhibits overlapping Gabors */
void NonMaximumSuppression(int img, int mo, int mx, int my) 
{
   int x, y, orient, x1, y1, orient1, i, here, shift, startx0, endx0, starty0, endy0, trace[2]; 
   float *f, maxResponse, maxResponse1; 
   double *fc; 
   /* inhibit on the SUM1 maps */
   for (orient=0; orient<numOrient; orient++)   
     {
       f = SUM1map[orient*numImage+img];   
       fc = Correlation[mo+orient*numOrient];   
       for (x=MAX(1, mx-2*halfFilterSize); x<=MIN(sizex, mx+2*halfFilterSize); x++)
         for (y=MAX(1, my-2*halfFilterSize); y<=MIN(sizey, my+2*halfFilterSize); y++)
         {
          f[px(x, y, sizex, sizey)] *= 
          fc[px(x-mx+2*halfFilterSize+1, y-my+2*halfFilterSize+1, 4*halfFilterSize+1, 4*halfFilterSize+1)];
         }
      }
   /* update the MAX1 maps */
   startx0 = floor((mx-2*halfFilterSize)/subsample)-locationShiftLimit+1; 
   starty0 = floor((my-2*halfFilterSize)/subsample)-locationShiftLimit+1; 
   endx0 =   floor((mx+2*halfFilterSize)/subsample)+locationShiftLimit; 
   endy0 =   floor((my+2*halfFilterSize)/subsample)+locationShiftLimit; 
   for (orient=0; orient<numOrient; orient++)   
     {
      i = orient*numImage+img; 
      for (x=MAX(startx, startx0); x<=MIN(endx, endx0); x++)
         for (y=MAX(starty, starty0); y<=MIN(endy, endy0); y++)
         { /* go over the locations that may be affected */         
           here = px(x, y, sizexSubsample, sizeySubsample);        
           maxResponse = MAX1map[i][here]; 
           shift = trackMap[i][here];
           orient1 = orientShifted[orient][shift];    
           x1 = x*subsample + xShift[orient][shift]; 
           y1 = y*subsample + yShift[orient][shift];            
           if ((x1-mx>=-2*halfFilterSize)&&(x1-mx<=2*halfFilterSize)&&
               (y1-my>=-2*halfFilterSize)&&(y1-my<=2*halfFilterSize)) 
             { /* if the previous local maximum is within the inhibition range */
              if(Correlation[mo+orient1*numOrient]
                [px(x1-mx+2*halfFilterSize+1,y1-my+2*halfFilterSize+1,4*halfFilterSize+1,4*halfFilterSize+1)]==0.) 
                 {   /* if it is indeed inhibited */
                     maxResponse1 = LocalMaximumPooling(img, orient, x*subsample, y*subsample, trace); 
                     trackMap[i][here] = trace[0];  
                     MAX1map[i][here] = maxResponse1;
                     pooledMax1map[orient][here] += (maxResponse1-maxResponse);                  
                 }
             }         
         }        
      }        
}
Example #10
0
Point3d PlaneDetector::depthCloseToPoint(Point2d p, PointCloud<PointXYZ>& pcl,
        int maxDelta) {
    for (int delta = 0; delta <= maxDelta; delta++) {
        for (int y = p.y - delta; y <= p.y + delta; y++) {
            for (int x = p.x - delta; x <= p.x + delta; x++) {
                if (!isnan(pcl.points[px(x, y)].z)) {
                    Point3d p(pcl.points[px(x, y)].x, pcl.points[px(x, y)].y,
                              pcl.points[px(x, y)].z);
                    return p;
                }
            }
        }
    }
    return Point3d(-1, -1, -1);
}
Example #11
0
    MultiScaleQuadrature()
        :
        super( std::pow(2,ioption("msi.level"))+1  )
    {

        int  gridsize = std::pow(2,ioption("msi.level"));

        // build rules in x and y direction
        weights_type wx( gridsize+1  );
        weights_type px( gridsize+1  );

        double tmp=-1;
        for ( int i = 0; i <=gridsize ; i++ )
        {
            // computes the weight of the k-th node
            this->M_w( i ) = 2./(gridsize+1) ;// wx( i );
            this->M_points( 0, i ) = tmp ;
            tmp+=2./gridsize ;
        }

        boost::shared_ptr<GT_Lagrange<1,1,1, Hypercube,T> > gm( new GT_Lagrange<1, 1, 1, Hypercube, T> );
        boost::shared_ptr<face_quad_type> face_qr( new face_quad_type );
        // construct face quadratures
        this->constructQROnFace( Reference<Hypercube<1, 1>, 1, 1>(), gm, face_qr );

    }
Example #12
0
QPixmap ImageProcessor::drawPiece(int i, int j, const QPainterPath &shape, const Puzzle::Creation::Correction &corr)
{
    QPainter p;
    QPixmap px(_p->descriptor.unitSize.width() + corr.widthCorrection + 1,
               _p->descriptor.unitSize.height() + corr.heightCorrection + 1);
    px.fill(Qt::transparent);

    p.begin(&px);
    p.setRenderHint(QPainter::SmoothPixmapTransform);
    p.setRenderHint(QPainter::Antialiasing);
    p.setRenderHint(QPainter::HighQualityAntialiasing);
    p.setClipping(true);
    p.setClipPath(shape);

    p.drawPixmap(_p->descriptor.tabFull + corr.xCorrection + corr.sxCorrection,
                 _p->descriptor.tabFull + corr.yCorrection + corr.syCorrection,
                 _p->pixmap,
                 i * _p->descriptor.unitSize.width() + corr.sxCorrection,
                 j * _p->descriptor.unitSize.height() + corr.syCorrection,
                 _p->descriptor.unitSize.width() * 2,
                 _p->descriptor.unitSize.height() * 2);

    p.end();
    return px;
}
Example #13
0
/**
 * Fit to a function.
 * @param fun :: A function.
 */
void Chebfun2DSpline::fit( AFunction2D fun )
{
  auto& xv = m_xBase->x;
  auto& yv = m_yBase->x;
  std::vector<double> px(nx() + 1);
  std::vector<double> py(ny() + 1);
  for(size_t ix = 0; ix < m_xFuns.size(); ++ix)
  {
    const double y = m_yLines[ix];
    for( size_t i = 0 ; i < px.size(); ++i)
    {
      px[i] = fun(xv[i], y);
    }
    m_xFuns[ix].setP( px );
  }
  for(size_t iy = 0; iy < m_yFuns.size(); ++iy)
  {
    const double x = m_xLines[iy];
    for( size_t i = 0 ; i < py.size(); ++i)
    {
      py[i] = fun(x, yv[i]);
    }
    m_yFuns[iy].setP( py );
  }
}
Example #14
0
//mark
void DrawElement(float *Template, int mo, int mx, int my, double w) 
{
  int x, y, here; 
  float a;
          
  for (x=mx-halfFilterSize; x<=mx+halfFilterSize; x++)
     for (y=my-halfFilterSize; y<=my+halfFilterSize; y++)
      if ((x>=1)&&(x<=sizex)&&(y>=1)&&(y<=sizey)) 
        {
         a = allSymbol[mo][px(x-mx+halfFilterSize+1, y-my+halfFilterSize+1, 
                              2*halfFilterSize+1, 2*halfFilterSize+1)]*w; 
         here = px(x, y, sizex, sizey); 
         if (Template[here]<a)
             Template[here] = a;
        }
}
Example #15
0
File: gen.cpp Project: herumi/opti
	void gen2()
	{
		const int unit = 64;
		resetGlobalIdx();
		Operand pz(IntPtr, unit);
		Operand px(IntPtr, unit);
		Operand py(IntPtr, unit);
		std::string name = "add128";
		Function f(name, Void, pz, px, py);
		beginFunc(f);
		Operand x = load(px);
		Operand y = load(py);
		x = zext(x, 128);
		y = zext(y, 128);
		x = add(x, y);
		Operand L = trunc(x, 64);
		store(L, pz);
		Operand xH = load(getelementptr(px, makeImm(32, 1)));
		Operand yH = load(getelementptr(py, makeImm(32, 1)));
		x = trunc(lshr(x, 64), 64);
		x = add(x, xH);
		x = add(x, yH);
		store(x, getelementptr(pz, makeImm(32, 1)));
		
		ret(Void);
		endFunc();
	}
Example #16
0
void Screen::draw(Drawable *drawable,bool isflip){
	if(!isflip){
		draw(drawable);
	}
	else{
		vector<Pixel> result;
		//Hitung sumbu vertikal
		vector<Pixel> group_of_point=drawable->getPixels();
		vector<Pixel>::iterator it;
		int vertical_axis=0;
		int numb=0;
		for(it=group_of_point.begin();it!=group_of_point.end();it++){
			vertical_axis+=(it->getPosition()).x;numb++;
		}
		vertical_axis/=numb;

		//transformasi
		for(it=group_of_point.begin();it!=group_of_point.end();it++){
			int temp=(it->getPosition()).x;
			temp=2*vertical_axis-temp;
			Point pt(temp,(it->getPosition()).y);
			Pixel px(pt,it->getColor());
			result.push_back(px);
		}
		for(it=result.begin();it!=result.end();it++)
			drawPixel(*it); 
	}
}
GLuint FileAssociatedTexture::getOrCreateCube(
	const QString & fileNames
,   OpenGLFunctions & gl
,	const GLenum mag_filter
,	const GLenum min_filter)
{
    if (s_texturesByFilePath.contains(fileNames))
        return s_texturesByFilePath[fileNames];

    QString px(fileNames); px.replace("?", "px");
    QString nx(fileNames); nx.replace("?", "nx");
    QString py(fileNames); py.replace("?", "py");
    QString ny(fileNames); ny.replace("?", "ny");
    QString pz(fileNames); pz.replace("?", "pz");
    QString nz(fileNames); nz.replace("?", "nz");

    QStringList files = QStringList() << px << nx << py << ny << pz << nz;
    QStringList absolutes;
    foreach(const QString & file, files)
    {
        QFileInfo fi(file);
        if (!fi.exists())
        {
            qWarning() << file << " does not exist: texture has no associated file.";
            return -1;
        }
        absolutes << fi.absoluteFilePath();
    }
bool SizeParam::fromString(const std::string& str)
{
    if (str.length() < 2)
        return false;

    std::string temp;

    if (str[ 0 ] == 'p')
    {
        temp = str.substr(1, str.length() - 1);

        px(utility::parseInt(temp));
    }
    else if (str[ 0 ] == 'f')
    {
        if (str[ 1 ] == 'f')
            mFlMode = FM_FREE_SPACE;
        else if (str[ 1 ] == 'p')
            mFlMode = FM_PARENT;
        else
            MYGUI_EXCEPT("Second character of float mode in SizeParam is invalid!");

        temp = str.substr(2, str.length() - 2);

        mFl = utility::parseFloat(temp);
    }
    else MYGUI_EXCEPT("First character in SizeParam is invalid!");

    return true;
}
Example #19
0
/* Initialize MAX1 maps */
void InitializeMAX1map()
{
   int img, orient, x, y, here, i, trace[2];  
   /* calculate MAX1 maps and record the shifts */
   pooledMax1map = float_matrix(numOrient, sizexSubsample*sizeySubsample);  
   MAX1map = float_matrix(numImage*numOrient, sizexSubsample*sizeySubsample);  
   trackMap = int_matrix(numImage*numOrient, sizexSubsample*sizeySubsample);   
   startx = floor((halfFilterSize+1)/subsample)+1+locationShiftLimit; 
   endx = floor((sizex-halfFilterSize)/subsample)-1-locationShiftLimit; 
   starty = floor((halfFilterSize+1)/subsample)+1+locationShiftLimit; 
   endy = floor((sizey-halfFilterSize)/subsample)-1-locationShiftLimit; 
   for (x=startx; x<=endx; x++)
      for (y=starty; y<=endy; y++)
       {
        here = px(x, y, sizexSubsample, sizeySubsample); 
        for (orient=0; orient<numOrient; orient++)
           {    
             pooledMax1map[orient][here] = 0.; 
             for (img=0; img<numImage; img++)
             {
                i = orient*numImage+img; 
                MAX1map[i][here] = LocalMaximumPooling(img, orient, x*subsample, y*subsample, trace);    
                trackMap[i][here] = trace[0]; 
                pooledMax1map[orient][here] += MAX1map[i][here];     
              }
            }
       }
}
Example #20
0
void FAMS::saveModeImg(const std::string& filename, bool pruned,
					 const std::vector<multi_img::BandDesc>& ref) {

	size_t n = (pruned ? prunedModes.size() : modes.size());
	if (n < 1)
		return;

	bool full = (n == h_ * w_);
	int h = (full ? h_ : n), w = (full ? w_ : 1);

	multi_img dest(h, w, modes[0].data.size());
	dest.minval = minVal_;
	dest.maxval = maxVal_;
	for (int y = 0; y < h; ++y) {
		for (int x = 0; x < w; ++x) {
			multi_img::Pixel px(dest.size());
			std::vector<unsigned short> &src
					= (pruned ? prunedModes[x*y] : modes[x*y].data);
			for (size_t d = 0; d < src.size(); ++d)
				px[d] = ushort2value(src[d]);
			dest.setPixel(y, x, px);
		}
	}

	dest.meta = ref;
	dest.write_out(filename);
}
Example #21
0
ImageViewer::ImageViewer(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

    connect(lowerSpinBox, SIGNAL(valueChanged(double)),
            SLOT(slotUpdate()));
    connect(upperSpinBox, SIGNAL(valueChanged(double)),
            SLOT(slotUpdate()));
    connect(flipCheckBox, SIGNAL(stateChanged(int)),
            SLOT(slotUpdate()));
    connect(opaqueCheckBox, SIGNAL(stateChanged(int)),
            SLOT(slotUpdate()));

    QPixmap px(32, 32);
    QPainter p(&px);
    p.fillRect(0, 0, 32, 32, Qt::white);
    p.fillRect(0, 0, 16, 16, QColor(193, 193, 193));
    p.fillRect(16, 16, 16, 16, QColor(193, 193, 193));
    p.end();
    QPalette pal = scrollAreaWidgetContents->palette();
    pal.setBrush(QPalette::Background,
                 QBrush(px));
    pal.setBrush(QPalette::Base,
                 QBrush(px));
    scrollAreaWidgetContents->setPalette(pal);
}
Example #22
0
AddressTool::AddressTool(QWidget *parent, int presetValue) :
    QDialog(parent)
  , ui(new Ui::AddressTool)
  , m_dipSwitch(NULL)
{
    ui->setupUi(this);
    QPixmap px(16, 16);

    px.fill(QColor("#E7354A"));
    ui->m_redBtn->setIcon(QIcon(px));

    px.fill(QColor("#0165DF"));
    ui->m_blueBtn->setIcon(QIcon(px));

    px.fill(Qt::black);
    ui->m_blackBtn->setIcon(QIcon(px));

    ui->m_addressSpin->setValue(presetValue);

    m_dipSwitch = new DIPSwitchWidget(this, presetValue);
    ui->m_gridLayout->addWidget(m_dipSwitch, 0, 0, 1, 5);
    m_dipSwitch->setMinimumHeight(80);

    connect(ui->m_addressSpin, SIGNAL(valueChanged(int)),
            m_dipSwitch, SLOT(slotSetValue(int)));
    connect(m_dipSwitch, SIGNAL(valueChanged(int)),
            ui->m_addressSpin, SLOT(setValue(int)));
    connect(ui->m_reverseVertCheck, SIGNAL(toggled(bool)),
            m_dipSwitch, SLOT(slotReverseVertically(bool)));
    connect(ui->m_reverseHorizCheck, SIGNAL(toggled(bool)),
            m_dipSwitch, SLOT(slotReverseHorizontally(bool)));

}
Example #23
0
QPixmap QX11WindowSurface::grabWidget(const QWidget *widget,
                                      const QRect& rect) const
{
    if (!widget || d_ptr->device.isNull())
        return QPixmap();

    QRect srcRect;

    // make sure the rect is inside the widget & clip to widget's rect
    if (!rect.isEmpty())
        srcRect = rect & widget->rect();
    else
        srcRect = widget->rect();

    if (srcRect.isEmpty())
        return QPixmap();

    // If it's a child widget we have to translate the coordinates
    if (widget != window())
        srcRect.translate(widget->mapTo(window(), QPoint(0, 0)));

    QPixmap::x11SetDefaultScreen(widget->x11Info().screen());
    QPixmap px(srcRect.width(), srcRect.height());

    GC tmpGc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0);

    // Copy srcRect from the backing store to the new pixmap
    XSetGraphicsExposures(X11->display, tmpGc, False);
    XCopyArea(X11->display, d_ptr->device.handle(), px.handle(), tmpGc,
              srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height(), 0, 0);

    XFreeGC(X11->display, tmpGc);

    return px;
}
Example #24
0
QSize KsirkChatItem::sizeHint(const QStyleOptionViewItem &option)
{
  unsigned int w = 0;
  QTextDocument fake; // used to allow to compute lines height
  fake.setHtml("gpl");
  fake.setDefaultFont(option.font);
  fake.adjustSize();
  fake.setTextWidth ( -1 );
  
  qreal h = fake.size().height();
  for (int i = 0 ; i < m_order.size(); i++)
  {
    QTextDocument rt;
    rt.setHtml(m_strings[i]);
    rt.adjustSize();
    rt.setTextWidth ( -1 );
    QPixmap px(rt.size().toSize());
    switch (m_order[i])
    {
    case Text:
      w += px.width();
    break;
    case Pixmap:
      if (! m_pixmaps[i].isNull())
      {
        QPixmap scaled = m_pixmaps[i].scaledToHeight((int)h);
         w+= scaled.width();
      }
    break;
    default: ;
    }
  }
//   kDebug() << "KsirkChatItem::sizeHint: " << QSize(w,h) << endl;
  return QSize(w,(int)h);
}
Example #25
0
void CCuboid::GetGripperPositions(std::list<GripData> *list, bool just_for_endof)
{
	gp_Pnt o = m_pos.Location();
	gp_Pnt px(o.XYZ() + m_pos.XDirection().XYZ() * m_x);
	gp_Pnt py(o.XYZ() + m_pos.YDirection().XYZ() * m_y);
	gp_Dir z_dir = m_pos.XDirection() ^ m_pos.YDirection();
	gp_Pnt pz(o.XYZ() + z_dir.XYZ() * m_z);
	gp_Pnt m2(o.XYZ() + m_pos.XDirection().XYZ() * m_x + m_pos.YDirection().XYZ() * m_y/2);
	gp_Pnt m3(o.XYZ() + m_pos.XDirection().XYZ() * m_x/2 + m_pos.YDirection().XYZ() * m_y);
	gp_Pnt m8(o.XYZ() + m_pos.YDirection().XYZ() * m_y/2 + z_dir.XYZ() * m_z);
	gp_Pnt pxy(o.XYZ() + m_pos.XDirection().XYZ() * m_x + m_pos.YDirection().XYZ() * m_y);
	gp_Pnt pxz(o.XYZ() + m_pos.XDirection().XYZ() * m_x + z_dir.XYZ() * m_z);
	gp_Pnt pyz(o.XYZ() + m_pos.YDirection().XYZ() * m_y + z_dir.XYZ() * m_z);
	gp_Pnt pxyz(o.XYZ() + m_pos.XDirection().XYZ() * m_x  + m_pos.YDirection().XYZ() * m_y + z_dir.XYZ() * m_z);
	list->push_back(GripData(GripperTypeTranslate,o.X(),o.Y(),o.Z(),NULL));
	list->push_back(GripData(GripperTypeRotateObject,px.X(),px.Y(),px.Z(),NULL));
	list->push_back(GripData(GripperTypeRotateObject,py.X(),py.Y(),py.Z(),NULL));
	list->push_back(GripData(GripperTypeRotateObject,pz.X(),pz.Y(),pz.Z(),NULL));
	list->push_back(GripData(GripperTypeScale,pxyz.X(),pxyz.Y(),pxyz.Z(),NULL));
	list->push_back(GripData(GripperTypeRotate,pxy.X(),pxy.Y(),pxy.Z(),NULL));
	list->push_back(GripData(GripperTypeRotate,pxz.X(),pxz.Y(),pxz.Z(),NULL));
	list->push_back(GripData(GripperTypeRotate,pyz.X(),pyz.Y(),pyz.Z(),NULL));
	list->push_back(GripData(GripperTypeObjectScaleX,m2.X(),m2.Y(),m2.Z(),NULL));
	list->push_back(GripData(GripperTypeObjectScaleY,m3.X(),m3.Y(),m3.Z(),NULL));
	list->push_back(GripData(GripperTypeObjectScaleZ,m8.X(),m8.Y(),m8.Z(),NULL));
}
Example #26
0
void VCSlider::setClickAndGoWidgetFromLevel(uchar level)
{
    if (m_cngType == ClickAndGoWidget::None || m_cngWidget == NULL)
        return;

    if (m_cngType == ClickAndGoWidget::RGB || m_cngType == ClickAndGoWidget::CMY)
    {
        QPixmap px(42, 42);
        float f = 0;
        if (m_slider)
            f = SCALE(float(level), float(m_slider->minimum()),
                      float(m_slider->maximum()), float(0), float(200));

        if ((uchar)f == 0)
        {
            px.fill(Qt::black);
        }
        else
        {
            QColor modColor = m_cngRGBvalue.lighter((uchar)f);
            px.fill(modColor);
        }
        m_cngButton->setIcon(px);
    }
    else
        m_cngButton->setIcon(QPixmap::fromImage(m_cngWidget->getImageFromValue(level)));
}
Example #27
0
QString SnumPlugin::extractnum(const QString &unicoded, int a)
{
    int pos;
    QString tmp = "";
    QString seriesnum = "";
    QString season = "";
    QString episode = "";

    QRegExp rx("(\\d{1,2})[^\\d]{1}(\\d{1,3})");
    pos = 0;
    pos = rx.indexIn(unicoded, pos);
    if (pos > -1) {
        season += rx.cap(1);
        episode += rx.cap(2);
        pos  += rx.matchedLength();
    } else {
        QRegExp px("(\\d{1,2})[^\\d]{2}(\\d{1,3})");
        pos = 0;
        pos = px.indexIn(unicoded, pos);
        if (pos > -1) {
            season += px.cap(1);
            episode += px.cap(2);
            pos  += px.matchedLength();
        } else {
            QRegExp gx("(\\d{1,2})[^\\d]{0}(\\d{2})");
            pos = 0;
            pos = gx.indexIn(unicoded, pos);
            if (pos > -1) {
                season += gx.cap(1);
                episode += gx.cap(2);
                pos  += gx.matchedLength();
            }
        }
    }

    if (season.length() == 1) {
        tmp = '0' + season;
    } else {
        tmp = season;
    }
    season = tmp;

    if (episode.length() == 1) {
        tmp = '0' + episode;
    } else {
        tmp = episode;
    }
    episode = tmp;

    seriesnum += season + 'e' + episode;

    if (a == 0) {
        return seriesnum;
    } else if (a == 1) {
        return season;
    } else {
        return episode;
    }
}
Example #28
0
int collide(int *a, int *b)
{
	 // sanity checking
	 if (a == 000 || b == 000)
		  return -1; // bad args
	 if (b[0] < 1)
		  return -2; // x at 0
	 if (b[1] < 1)
		  return -3; // y at 0
	 if (b[2] < 1)
		  return -4; // z at 0
	 if (b[0] > xres)
		  return -5; // x at max
	 if (b[0] > yres)
		  return -6; // y at max
	 if (b[0] > zres)
		  return -7; // z at max

	 int vec[3] = {(b[0]-a[0]), (b[1]-a[1]), (b[2]-a[2])}; // vector
	 int result = 0;

	 /* below is a fairly basic algo to keep checking until there is no conflict
	  * may be optimizable
	  */
	 do
	 {
		  result = 0;
		  if (vec[0] > 0)
		  {
				result += px(&b[0]);
		  }
		  if (vec[1] > 0)
		  {
				result += py(&b[1]);
		  }
		  if (vec[2] > 0)
		  {
				result += pz(&b[2]);
		  }
		  if (vec[0] < 0)
		  {
				result += nx(&b[0]);
		  }
		  if (vec[1] < 0)
		  {
				result += ny(&b[1]);
		  }
		  if (vec[2] < 0)
		  {
				result += nz(&b[2]);
		  }
		  vec[0] = (b[0]-a[0]);
		  vec[1] = (b[1]-a[1]);
		  vec[2] = (b[2]-a[2]); // recalc. should eliminate unnecessary checks
	 }
	 while (result != 0);

	 return 0;
}
void ColorButton::setColor(QColor color){
    CurrentColor = color;
    QPixmap px(this->size()-QSize(4, 4));
    px.fill(color);
    setIcon(px);
    emit changed();

}
void MusicLrcArtPhotoLabel::saveImagePath(const QString &path) const
{
    QPixmap px(m_width, m_height);
    QPainter paint(&px);
    paint.drawPixmap(0, 0, m_width, m_height, m_showPix);
    paint.end();
    px.save(path);
}