当前位置: 首页>>代码示例>>C++>>正文


C++ Point2i函数代码示例

本文整理汇总了C++中Point2i函数的典型用法代码示例。如果您正苦于以下问题:C++ Point2i函数的具体用法?C++ Point2i怎么用?C++ Point2i使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Point2i函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Particle

BulletParticle::BulletParticle() :
  Particle("bullet_particle")
{
  SetCollisionModel(true, false, false);
  m_rebound_sound = "weapon/m16_cartridge";
  m_left_time_to_live = 1;
  start_to_fade = 0;

  image = ParticleEngine::GetSprite(BULLET_spr);
  image->Scale(1.0,1.0);
  SetSize(Point2i(1, 1));
}
开发者ID:yeKcim,项目名称:warmux,代码行数:12,代码来源:bullet.cpp

示例2: UIElement

    /* Public */
    Camera::Camera(const Point2i &position, const Point2i &dimensions, const Point2i &frameDimensions, const Point2i &textureDimensions) :
        UIElement(position, dimensions)
    {
        this->frameDimensions = frameDimensions;
        
        int px = position.getX();
        int py = position.getY() + dimensions.getY() - CONTROL_BAR_HEIGHT;
        int dx = dimensions.getX() - 125;
        int dy = CONTROL_BAR_HEIGHT;
        
        controls = new CameraControls(Point2i(px, py), Point2i(dx, dy));
        controls->setClickedCallback(MakeDelegate(this, &Camera::controls_Clicked));
        registerEventHandler(controls);
        
        mode = new ModeToggle(Point2i(dx, py), Point2i(125, dy), "switch_slide.png", "switch_rub.png");
        mode->setClickedCallback(MakeDelegate(this, &Camera::mode_Clicked));
        registerEventHandler(mode);
        
        GLfloat data[12] =
		{
			0.0f, 0.0f, 0.0f,
			0.0f, 1.0f, 0.0f,
			1.0f, 0.0f, 0.0f,
			1.0f, 1.0f, 0.0f
		};

        float u0 = 0.0f;
        float u1 = (float)frameDimensions.getX() / (float)textureDimensions.getX();
        float v0 = 0.0f;// 
        float v1 = (float)frameDimensions.getY() / (float)textureDimensions.getY();
        GLfloat textureData[8] =
		{
			u0, v1,
			u1, v1,
			u0, v0,
			u1, v0
		};

        vbo = new GLVbo(GL_TRIANGLE_STRIP, GL_STATIC_DRAW, data, 4, textureData);
    }
开发者ID:jonathanhook,项目名称:PaintingRegistration,代码行数:41,代码来源:Camera.cpp

示例3: Point2i

	void Map::updateSprites()
	{



		for (unsigned int sup = 0; sup < 6; sup++)
		{
			for (unsigned int x = 0; x < _width; x++)
			{
				for (unsigned int y = 0; y < _height; y++)
				{
					_cases[x][y].vertexArray[sup].vertices.clear();
					_cases[x][y].vertexArray[sup].texture = NULL;
				}
			}
		}


		for (unsigned int i = 0; i < _width; i++)
		{
			for (unsigned int j = 0; j < _height; j++)
			{
				for (unsigned int c = 0; c < 5; c++)
				{
					if (_cases[i][j].GetCoucheExist(c))
					{
						Point2i tilesetPosition = _cases[i][j].GetTilesetPos(c);
						unsigned int super = _tileset.GetTilesetCase(tilesetPosition).superpositionPriority;
						if (_cases[i][j].GetTilesetPos(c).y == 0)
						{
							if (_tileset.GetAutotileExist(_cases[i][j].GetTilesetPos(c)))
							{

								_tileset.GetAutotile(tilesetPosition)->GetSprites((_cases[i - 1][j - 1].GetTilesetPos(c) == tilesetPosition), (_cases[i][j - 1].GetTilesetPos(c) == tilesetPosition), (_cases[i + 1][j - 1].GetTilesetPos(c) == tilesetPosition),
									(_cases[i - 1][j].GetTilesetPos(c) == tilesetPosition), (_cases[i + 1][j].GetTilesetPos(c) == tilesetPosition),
									(_cases[i - 1][j + 1].GetTilesetPos(c) == tilesetPosition), (_cases[i][j + 1].GetTilesetPos(c) == tilesetPosition), (_cases[i + 1][j + 1].GetTilesetPos(c) == tilesetPosition),
									Point2i(i, j), _cases[i][j].vertexArray[super].vertices);
								_cases[i][j].vertexArray[super].texture = _tileset.GetAutotile(tilesetPosition)->GetTexture();
							}
						}
						else
						{
							sfUse::Sprite2VertexArray(GetSprite(i, j, c), _cases[i][j].vertexArray[super].vertices);
							_cases[i][j].vertexArray[super].texture = _tileset.GetTexture();
						}
					}
				}
			}
		}


	}
开发者ID:Tassa,项目名称:PokemonGamma,代码行数:52,代码来源:map.cpp

示例4: pFilm

void RealisticCamera::RenderExitPupil(Float sx, Float sy,
                                      const char *filename) const {
    Point3f pFilm(sx, sy, 0);

    const int nSamples = 2048;
    Float *image = new Float[3 * nSamples * nSamples];
    Float *imagep = image;

    for (int y = 0; y < nSamples; ++y) {
        Float fy = (Float)y / (Float)(nSamples - 1);
        Float ly = Lerp(fy, -RearElementRadius(), RearElementRadius());
        for (int x = 0; x < nSamples; ++x) {
            Float fx = (Float)x / (Float)(nSamples - 1);
            Float lx = Lerp(fx, -RearElementRadius(), RearElementRadius());

            Point3f pRear(lx, ly, LensRearZ());

            if (lx * lx + ly * ly > RearElementRadius() * RearElementRadius()) {
                *imagep++ = 1;
                *imagep++ = 1;
                *imagep++ = 1;
            } else if (TraceLensesFromFilm(Ray(pFilm, pRear - pFilm),
                                           nullptr)) {
                *imagep++ = 0.5f;
                *imagep++ = 0.5f;
                *imagep++ = 0.5f;
            } else {
                *imagep++ = 0.f;
                *imagep++ = 0.f;
                *imagep++ = 0.f;
            }
        }
    }

    WriteImage(filename, image,
               Bounds2i(Point2i(0, 0), Point2i(nSamples, nSamples)),
               Point2i(nSamples, nSamples));
    delete[] image;
}
开发者ID:tdapper,项目名称:pbrt-v3,代码行数:39,代码来源:realistic.cpp

示例5: switch

void SplitContainer::_notification(int p_what) {

	switch (p_what) {

		case NOTIFICATION_SORT_CHILDREN: {

			_resort();
		} break;
		case NOTIFICATION_MOUSE_ENTER: {

			mouse_inside = true;
			update();
		} break;
		case NOTIFICATION_MOUSE_EXIT: {

			mouse_inside = false;
			update();
		} break;
		case NOTIFICATION_DRAW: {

			if (!_getch(0) || !_getch(1))
				return;

			if (collapsed || (!mouse_inside && get_constant("autohide")))
				return;

			int sep = dragger_visibility != DRAGGER_HIDDEN_COLLAPSED ? get_constant("separation") : 0;
			Ref<Texture> tex = get_icon("grabber");
			Size2 size = get_size();
			if (dragger_visibility == DRAGGER_VISIBLE) {

				if (vertical)
					draw_texture(tex, Point2i((size.x - tex->get_width()) / 2, middle_sep + (sep - tex->get_height()) / 2));
				else
					draw_texture(tex, Point2i(middle_sep + (sep - tex->get_width()) / 2, (size.y - tex->get_height()) / 2));
			}
		} break;
	}
}
开发者ID:brakhane,项目名称:godot,代码行数:39,代码来源:split_container.cpp

示例6: denoiseModifiedNLMeans

template<typename I, typename O> int denoiseModifiedNLMeans(std::string inputfile, EBitmapType inputtype, std::string outputfile, EBitmapType outputtype, int r = 3, int f = 1, Float k = 0.7, Float sigma = 0.1, bool dump = true) {
	ModifiedNLMeansDenoiser<I, O> *denoiser = new ModifiedNLMeansDenoiser<I, O>(r, f, k, sigma, dump);
	TBitmap<I> *inputA = new TBitmap<I>;
	//BitmapI *inputsppA = new BitmapI;
	TBitmap<I> *inputsppA = new TBitmap<I>;
	TBitmap<I> *inputvarA = new TBitmap<I>;
	TBitmap<I> *inputvarsA = new TBitmap<I>;
	TBitmap<I> *inputB = new TBitmap<I>;
	//BitmapI *inputsppB = new BitmapI;
	TBitmap<I> *inputsppB = new TBitmap<I>;
	TBitmap<I> *inputvarB = new TBitmap<I>;
	TBitmap<I> *inputvarsB = new TBitmap<I>;
	Assert(inputA->loadBitmap(inputfile + "_A", inputtype), "Input bitmap A failed to load!");
	Assert(inputsppA->loadBitmap(inputfile + "_spp_A", inputtype), "Input spp bitmap A failed to load!");
	Assert(inputvarA->loadBitmap(inputfile + "_variance_A", inputtype), "Input variance bitmap A failed to load!");
	Assert(inputvarsA->loadBitmap(inputfile + "_variance_square_A", inputtype), "Input variance square bitmap A failed to load!");
	Assert(inputB->loadBitmap(inputfile + "_B", inputtype), "Input bitmap B failed to load!");
	Assert(inputsppB->loadBitmap(inputfile + "_spp_B", inputtype), "Input spp bitmap B failed to load!");
	Assert(inputvarsB->loadBitmap(inputfile + "_variance_square_B", inputtype), "Input variance square bitmap B failed to load!");
	Assert(inputvarB->loadBitmap(inputfile + "_variance_B", inputtype), "Input variance bitmap B failed to load!");

	DenoiserInput<I> *dInput = new DenoiserInput<I>(outputfile);
	dInput->addImageBlock(new TImageBlock<I>(Point2i(0., 0.), inputA->getSize(), 1, false, inputA, inputsppA, inputvarA, inputvarsA));
	dInput->addImageBlock(new TImageBlock<I>(Point2i(0., 0.), inputB->getSize(), 1, false, inputB, inputsppB, inputvarB, inputvarsB));
	DenoiserOutput<O> *dOutput = denoiser->denoise(dInput);
	LOG(EInfo, "Denoising finished. Time taken = %d seconds", dOutput->getDenoiseDuration());
	dumpMap(dOutput->getDenoisedImage()->getBitmap(), outputfile, outputtype);
	inputA->unloadBitmap();
	inputsppA->unloadBitmap();
	inputvarA->unloadBitmap();
	inputvarsA->unloadBitmap();
	inputB->unloadBitmap();
	inputsppB->unloadBitmap();
	inputvarB->unloadBitmap();
	inputvarsB->unloadBitmap();
	std::cin.get();
	_CrtDumpMemoryLeaks(); // prints mem leaks
	return 0;
}
开发者ID:mssurajkaiga,项目名称:nlmeans,代码行数:39,代码来源:nlmeans.cpp

示例7: Mat

Point2i InputProcessing::getRightEyeCorner(Mat gray, Rect rightEye) {
    Rect rightEyeCorner = rightEye;
    //omit top 1/4 of image
    rightEyeCorner.y += rightEyeCorner.height * .25;
    rightEyeCorner.height /= 2;
    rightEyeCorner.x += .5 * rightEyeCorner.width;
    rightEyeCorner.width *= .5;

    Mat im = Mat(gray, rightEyeCorner);
    vector<Point2i> features;
    //	GaussianBlur(im, im, Size(3, 3), 0, 0);
    goodFeaturesToTrack(im, features, 15, .15, rightEyeCorner.height / 16);


    double minDist = DBL_MAX, minIndex = -1, i = 0;

    for (Point2i p : features) {
        //ydist = distnace from middle of inner edge of leftEye rectangle
        double ydist = (p.y - (rightEye.height / 4));
        double xdist = (p.x - (rightEye.width / 2));
        double dist = xdist * xdist + ydist * ydist * 4;

        if (dist < minDist) {
            minDist = dist;
            minIndex = i;
        }
        i++;
    }

    if (minIndex >= 0) {
        Point2i res = features[minIndex] + Point2i(rightEyeCorner.x, rightEyeCorner.y);
        if (DEBUG_MODE) {
            //circle(drawFrame, Point2i(rightEye.x + rightEye.width, rightEye.y + rightEye.height / 2), 1, Scalar(255, 10, 10));
        }
        return res;
    }

    return Point2i(-1, -1);
}
开发者ID:zteffi,项目名称:Webcamera-Eye-Tracker,代码行数:39,代码来源:inputprocessing.cpp

示例8: Particle

PolecatFart::PolecatFart() :
  Particle("polecat_fart_particle")
{
  m_initial_time_to_live = 50;
  m_left_time_to_live = m_initial_time_to_live;
  m_time_between_scale = 100;
  SetCollisionModel(false, false, false);
  is_active = true;

  image = ParticleEngine::GetSprite(POLECAT_FART_spr);
  image->Scale(1.0,1.0);
  SetSize( Point2i(10, 10) );
}
开发者ID:yeKcim,项目名称:warmux,代码行数:13,代码来源:polecat_fart.cpp

示例9: SDL_EnableKeyRepeat

void Chat::ShowInput()
{
  if (!check_input) {
    check_input = true;

    /* Enable key repeat when chatting :) */
    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
  }

  if (!input) {
    input = new Text("", c_white);
    msg = new Text(_("Say: "), c_red);
  }

  /* FIXME where do those constants come from ?*/
  int ypos = GetMainWindow().GetHeight() - 100;
  msg->DrawLeftTop(Point2i(25, ypos));
  if (input->GetText() != "") {
    input->DrawLeftTop(Point2i(25 + msg->GetWidth() + 5, ypos));
    input->DrawCursor(Point2i(25 + msg->GetWidth() + 5, ypos), cursor_pos);
  }
}
开发者ID:yeKcim,项目名称:warmux,代码行数:22,代码来源:chat.cpp

示例10: Point2i

void CAdvancedAnnotator::EventMouseRelease(int x, int y, int keyFlag)
{
	if(m_bMouseEvent == true)
	{
		m_ptMouseRelease = Point2i(x,y);
		m_rectDrawing = Rect_<int>(m_ptMouseRelease,m_ptMousePress);

		if(m_rectDrawing.area() > RECT_MINIMUM_AREA)
		{
			CGroundTruth tempGT(m_rectDrawing);
			if(m_pvecGTSaved->size() > 0)
				tempGT.Id = m_pvecGTSaved->at(m_pvecGTSaved->size()-1).Id + 1;
			else
				tempGT.Id = 0;
			m_pvecGTSaved->push_back(tempGT);

			m_idxSelectedRect = m_pvecGTSaved->size()-1;
		}
		else
		{
			// 가장 가까운 곳에 위치한 사각형을 선택함
			Rect_<int> rectExpand;
			rectExpand.x = x - RECT_SELECT_DIST;
			rectExpand.y = y - RECT_SELECT_DIST;
			rectExpand.width = RECT_SELECT_DIST * 2;
			rectExpand.height = RECT_SELECT_DIST * 2;

			size_t maxIdx = -1;
			float maxVal = 0;
			for (size_t i=0; i<m_pvecGTSaved->size(); i++)
			{
				int cap = (rectExpand & m_pvecGTSaved->at(i).rectROI).area();
				if(cap == 0) continue;
				else if(m_pvecGTSaved->at(i).eCondition == CGroundTruth::GT_DELETE) continue;

				int cup = (rectExpand | m_pvecGTSaved->at(i).rectROI).area();
				float overlapRatio = (float)cap / (float)cup;
				if(maxVal < overlapRatio)
				{
					maxVal = overlapRatio;
					maxIdx = i;
				}
			}
			m_idxSelectedRect = maxIdx;
		}

		m_rectDrawing = Rect_<int>(-1,-1,0,0);

		m_bMouseEvent = false;
	}
}
开发者ID:blastak,项目名称:avat,代码行数:51,代码来源:AdvancedAnnotator.cpp

示例11: n_pt1

void CControl::Draw_debug(Mat n_img,vector<Point2f> n_linevct,char* n_windowname)
{
  //draw point3f;
  /*
  Mat n_img2;
  // nImgRaw.copyTo(n_img2);
  cout<<n_linevct.size()<<endl;
  for(int i=0;i<n_linevct.size();i++)
    {
      //case1:
      Point2f n_pt1(0,0);
      Point2f n_pt2(nWidth,0);
      Point3f n_lineparam=n_linevct.at(i);
      //    if(n_lineparam.y==0)
      //	continue;
      //    n_pt1.y=-(n_lineparam.z+n_lineparam.x*n_pt1.x)/n_lineparam.y;
      //   n_pt2.y=-(n_lineparam.z+n_lineparam.x*n_pt2.x)/n_lineparam.y;
      //draw line,;
      //   line(n_img,Point2i(n_pt1.x,n_pt1.y),Point2i(n_pt2.x,n_pt2.y),Scalar(255,255,255));
      cout<<"get lines "<<n_lineparam<<endl;    
    }
  imshow("2",n_img);
  waitKey(0);*/

  //draw Point2f
  Mat n_img2;
  n_img.copyTo(n_img2);
  for(int i=0;i<n_linevct.size();i++)
    {
      Point2f n_pt1=n_linevct.at(i++);
      Point2f n_pt2=n_linevct.at(i);
      //   cout<<n_pt1<<' '<<n_pt2<<endl;
      line(n_img2,Point2i(n_pt1.x,n_pt1.y),Point2i(n_pt2.x,n_pt2.y),Scalar(255,255,255));
    }
  imshow(n_windowname,n_img2);
  //imwrite("temp.png",n_img);
  // waitKey(0);
}
开发者ID:junwangcas,项目名称:Taxi,代码行数:38,代码来源:CControl.cpp

示例12: HammersleySampler

	HammersleySampler(Stream *stream, InstanceManager *manager)
	 : Sampler(stream, manager) {
		m_arrayStartDim = stream->readUInt();
		m_arrayEndDim = stream->readUInt();
		m_offset = stream->readULong();
		m_stride = stream->readULong();
		m_scramble = stream->readInt();
		m_logHeight = stream->readUInt();
		m_samplesPerBatch = stream->readSize();
		m_factor = stream->readFloat();
		m_resolution = Vector2i(stream);
		m_pixelPosition = Point2i(0);
		configure();
	}
开发者ID:blckshrk,项目名称:IFT6042,代码行数:14,代码来源:hammersley.cpp

示例13: XineramaQueryExtension

Size2 OS_X11::get_screen_size(int p_screen) const {
	// Using Xinerama Extension
	int event_base, error_base;
	const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
	if( !ext_okay ) return Size2i(0,0);

	int count;
	XineramaScreenInfo* xsi = XineramaQueryScreens(x11_display, &count);
	if( p_screen >= count ) return Size2i(0,0);

	Size2i size = Point2i(xsi[p_screen].width, xsi[p_screen].height);
	XFree(xsi);
	return size;
}
开发者ID:AutonomicStudios,项目名称:godot,代码行数:14,代码来源:os_x11.cpp

示例14: mouseMoved

 void Label::mouseMoveEvent(QMouseEvent* event) {
     if (m_mousePosition) {
         Point2i oldMousePosition = *m_mousePosition;
         *m_mousePosition = Point2i(event->pos().x(), event->pos().y());
         Vector2i displacement = *m_mousePosition - oldMousePosition;
         if (sqrLength(displacement) > 0) {
             emit mouseMoved(*m_mousePosition, displacement);
         }
     } else {
         m_mousePosition = new Point2i(event->pos().x(), event->pos().y());
         emit mouseEntered(*m_mousePosition);
     }
     event->accept();
 }
开发者ID:yuri-kilochek,项目名称:photon_mapping,代码行数:14,代码来源:Label.cpp

示例15: HaltonSampler

	HaltonSampler(Stream *stream, InstanceManager *manager)
	 : Sampler(stream, manager) {
		m_arrayStartDim = stream->readUInt();
		m_arrayEndDim = stream->readUInt();
		m_offset = stream->readULong();
		m_stride = stream->readULong();
		m_multInverse[0] = stream->readULong();
		m_multInverse[1] = stream->readULong();
		m_scramble = stream->readInt();
		m_primePowers = Vector2i(stream);
		m_primeExponents = Vector2i(stream);
		m_pixelPosition = Point2i(0);
		configure();
	}
开发者ID:AdrianJohnston,项目名称:ShapeNetRender,代码行数:14,代码来源:halton.cpp


注:本文中的Point2i函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。