Esempio n. 1
0
void		blurp(t_bunny_pixelarray *pix, int intensit)
{
  t_color	*pixels;
  t_color	*cpy;
  int		i;
  int		j;

  pixels = pix->pixels;
  cpy = alloca(HB * WB * sizeof(t_color));
  while (intensit--)
    {
      i = -1;
      while (++i < WB)
	{
	  j = -1;
	  while (++j < HB)
	    cpy[getxy(i, j, pix)].full = RGBA_C(moy(pix, i, j, 0),
						moy(pix, i, j, 1),
						moy(pix, i, j, 2),
						moy(pix, i, j, 3));
	}
      i = -1;
      while (++i < WB * HB)
	pixels[i].full = cpy[i].full;
    }
}
Esempio n. 2
0
// return true if the polygon is couterclockwise ordered
bool glc::isCounterclockwiseOrdered(const QList<GLC_Point2d>& polygon)
{
	const int size= polygon.size();
	int j0= 0;
	int j1= size - 1;
	// test segment <polygon[i0], polygon[i1]> to see if it is a diagonal
	while (j0 < size)
	{
		GLC_Vector2d perp((polygon[j0] - polygon[j1]).perp());
		int j2= 0;
		int j3= size - 1;
		bool isIntersect= false;
		// Application of perp vector
		GLC_Point2d moy((polygon[j0] + polygon[j1]) * 0.5);
		while (j2 < size && !isIntersect)
		{
			if(j2 != j0 && j3 != j1)
			{
				if (isIntersectedRaySegment(moy, (perp + moy), polygon[j2], polygon[j3]))
					isIntersect= true;
			}
			j3= j2;
			++j2;
		}
		if(!isIntersect) return false;
		j1= j0;
		++j0;
	}

	return true;

}