• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Point2i函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: assert

bool
HaloRefImage::resize(uint w, uint h, CNDCvec& v)
{
   // returns true if size changes
   bool ret = RefImage::resize(w,h,v);

   // handle scratch texture now too
   assert(_scratch_tex);
   const Image& img = _scratch_tex->image();
   if (Point2i(w,h) != img.dims()) {
      _scratch_tex->image().resize(w,h);
   }
   return ret;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:14,代码来源:halo_ref_image.cpp


示例17: virtualToAbsoluteVec

void NodeGraphDisplay::drawGraph(GlInterface &gl)
{
	AVec	graph_step = virtualToAbsoluteVec(BASE_GRAPH_STEP),
			inv_graph_step = AVec(1.0f/graph_step.x, 1.0f/graph_step.y),
			dist_to_origin = virtualToAbsolutePoint(APoint(0, 0)),
			dist_after_origin = size - dist_to_origin;
	
	APoint	first_offset = APoint(fmod(dist_to_origin.x, graph_step.x), fmod(dist_to_origin.y, graph_step.y)),
			last_offset = APoint(fmod(dist_after_origin.x, graph_step.x), fmod(dist_after_origin.y, graph_step.y));
	Point2i lines_before_origin = Point2i(floor(dist_to_origin.x*inv_graph_step.x), floor(dist_to_origin.y*inv_graph_step.y)),
			lines_after_origin = Point2i(floor(dist_after_origin.x*inv_graph_step.x), floor(dist_after_origin.y*inv_graph_step.y)),
			num_lines = lines_before_origin + Vec2i(1, 1) + lines_after_origin;

	std::vector<TVertex> points;
	points.reserve(2*(num_lines.x + num_lines.y));

	//Add vertical lines
	int i = 0;
	for(float x = first_offset.x; x < size.x; x += graph_step.x, i++)
	{
		Color c = (i != lines_before_origin.x ? Color(0.0f, 0.0f, 0.0f, 1.0f) : Color(1.0f, 0.0f, 0.0f, 1.0f));
		points.push_back(TVertex(APoint(x, 0.0f), c));
		points.push_back(TVertex(APoint(x, size.y), c));
	}

	//Add horizontal lines
	i = 0;
	for(float y = first_offset.y; y < size.y; y += graph_step.y, i++)
	{
		Color c = (i != lines_before_origin.y ? Color(0.0f, 0.0f, 0.0f, 1.0f) : Color(1.0f, 0.0f, 0.0f, 1.0f));
		points.push_back(TVertex(APoint(0.0f, y), c));
		points.push_back(TVertex(APoint(size.x, y), c));
	}

	//Draw lines
	gl.drawShape(GL_LINES, points);
}
开发者ID:skothr,项目名称:SoundSandbox,代码行数:37,代码来源:NodeGraphDisplay.cpp


示例18: line

/**
 * Plots the axes in the ploter
 *
 * @param plot A pointer to the image. If set to NULL in outputs the
 *             coordinates in seperate window
 */
void WorldPlotter::plotAxes(cv::Mat &plot) {
    int marker_x,
        marker_y;

    line(plot, cvPoint(plot_size_x / 2, 0),
         cvPoint(plot_size_x / 2, plot_size_y), x_color);
    line(plot, cvPoint(0, plot_size_y / 2),
         cvPoint(plot_size_x, plot_size_y / 2), y_color);

    for(int i = -real_size_x / 2; i < real_size_x / 2; ++i) {
        marker_x = i / real_size_x * plot_size_x + plot_size_x / 2;
        marker_y = plot_size_y / 2;

        line(plot, Point(marker_x, marker_y - marker_size),
             Point(marker_x, marker_y + marker_size), x_color);

        stringstream sstr;
        sstr << i;

        putText(plot, sstr.str(), Point2i(marker_x, marker_y - marker_size * 1.5),
                FONT_HERSHEY_PLAIN, font_scale, x_color);
    }

    for(int i = -real_size_y / 2; i < real_size_y / 2; ++i) {
        marker_y = i / real_size_y * plot_size_y + plot_size_y / 2;
        marker_x = plot_size_x / 2;

        line(plot, Point(marker_x, marker_y - marker_size),
             Point(marker_x, marker_y + marker_size), y_color);

        stringstream sstr;
        sstr << i;

        putText(plot, sstr.str(), Point2i(marker_x + marker_size * 1.5, marker_y),
                FONT_HERSHEY_PLAIN, font_scale, y_color);
    }
}
开发者ID:dvduvix,项目名称:cvl11,代码行数:43,代码来源:WorldPlotter.cpp


示例19: rRec

void SamplingIntegrator::renderBlock(const Scene *scene,
		const Sensor *sensor, Sampler *sampler, ImageBlock *block,
		const bool &stop, const std::vector< TPoint2<uint8_t> > &points) const {

	Float diffScaleFactor = 1.0f /
		std::sqrt((Float) sampler->getSampleCount());

	bool needsApertureSample = sensor->needsApertureSample();
	bool needsTimeSample = sensor->needsTimeSample();

	RadianceQueryRecord rRec(scene, sampler);
	Point2 apertureSample(0.5f);
	Float timeSample = 0.5f;
	RayDifferential sensorRay;

	block->clear();

	uint32_t queryType = RadianceQueryRecord::ESensorRay;

	if (!sensor->getFilm()->hasAlpha()) /* Don't compute an alpha channel if we don't have to */
		queryType &= ~RadianceQueryRecord::EOpacity;

	for (size_t i = 0; i<points.size(); ++i) {
		Point2i offset = Point2i(points[i]) + Vector2i(block->getOffset());
		if (stop)
			break;

		sampler->generate(offset);

		for (size_t j = 0; j<sampler->getSampleCount(); j++) {
			rRec.newQuery(queryType, sensor->getMedium());
			Point2 samplePos(Point2(offset) + Vector2(rRec.nextSample2D()));

			if (needsApertureSample)
				apertureSample = rRec.nextSample2D();
			if (needsTimeSample)
				timeSample = rRec.nextSample1D();

			Spectrum spec = sensor->sampleRayDifferential(
				sensorRay, samplePos, apertureSample, timeSample);

			sensorRay.scaleDifferential(diffScaleFactor);

			spec *= Li(sensorRay, rRec);
			block->put(samplePos, spec, rRec.alpha);
			sampler->advance();
		}
	}
}
开发者ID:dkoerner,项目名称:mitsuba,代码行数:49,代码来源:integrator.cpp


示例20: CheckOverlapping

void PhysicalObj::SetXY(const Point2d &position)
{
  CheckOverlapping();

  // Don't use METER_PER_PIXEL here: bad truncation occurs
  if (IsOutsideWorldXY(Point2i(position.x, position.y)) && can_be_ghost) {
    SetPhysXY(position / PIXEL_PER_METER);
    Ghost();
    SignalOutOfMap();
  } else {
    SetPhysXY(position / PIXEL_PER_METER);
    if (FootsInVacuum())
      StartMoving();
  }
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:15,代码来源:physical_obj.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Point3函数代码示例发布时间:2022-05-30
下一篇:
C++ Point2d函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap