2d

Determining ordering of vertices to form a quadrilateral

孤者浪人 提交于 2019-12-21 02:56:29
问题 Suppose I have 4 vertices in 2D space. Does anything know of an efficient algorithm which will give me an ordering of the vertices which corresponds to a simple quadrilateral? That is, it will label the vertices 1, 2, 3, 4 so that if I follow 1-2, 2-3, 3-4 I will have traced a simple (i.e. non-intersecting) quadrilateral. Just providing the name of a standard algorithm which I can google would be fine. 回答1: You may be interested in methods of convex hull computing, such as Graham scan. 回答2:

Fast way to implement 2D convolution in C

我只是一个虾纸丫 提交于 2019-12-21 02:31:10
问题 I am trying to implement a vision algorithm, which includes a prefiltering stage with a 9x9 Laplacian-of-Gaussian filter. Can you point to a document which explains fast filter implementations briefly? I think I should make use of FFT for most efficient filtering. 回答1: Are you sure you want to use FFT? That will be a whole-array transform, which will be expensive. If you've already decided on a 9x9 convolution filter, you don't need any FFT. Generally, the cheapest way to do convolution in C

Understanding Android's Canvas.saveLayer(…)

坚强是说给别人听的谎言 提交于 2019-12-20 20:43:33
问题 I am hoping the saveLayer methods will allow me to do draw onto different "layers" and then once the drawing has finished, merge the layers with the canvas in whichever order i choose. The obvious question is "why dont you just rearrange your drawing operations instead?" The answer is I can't: I have a Path that I need to draw onto a Canvas. In the background/lowest z-index I want to draw the path closed and with a few additional points using a fill style. Then on top of that, I want to draw

Graphics Library for C++

谁都会走 提交于 2019-12-20 14:56:43
问题 I am working on a simulation project in C++ and I need to output some information graphically. I searched about it and found some libraries, but most of them just do plotting or something. There are also libraries like EasyBMP, which can be used to create bitmap images or similar image formats. There are also some libraries like OpenGL, DirectX and SDL which allow hardware-accelerated real time graphics. My problem is that I need a library for real time, hardware accelerated graphics. As a

wpf 2d high performance graphics

痞子三分冷 提交于 2019-12-20 14:14:37
问题 Basically, I want GDI-type functionality in WPF, where I can write pixels to a bitmap and update and display that bitmap through WPF. Note, I need to be able to animate the bitmap on the fly by updating pixels in response to mouse movements. I've read that InteropBitmap is perfect for this, as you can write to pixels in memory and copy the memory location to the bitmap--but I don't have any good examples to go by. Does anyone know of any good resources, tutorials, or blogs for using the

What is the best practice to render sprites in DirectX 11?

亡梦爱人 提交于 2019-12-20 10:23:38
问题 I am currently trying to get used to the DirectX API and I am wondering what is the usual approach to render a sprite in DirectX 11 (e.g. for a tetris clone). Is there a simmilar interface as ID3DX10Sprite , and if not, which would be the usual method to draw sprites in DirectX 11? Edit: Here is the HLSL code that worked for me (the computation of the projection coordinate could be done better): struct SpriteData { float2 position; float2 size; float4 color; }; struct VSOut { float4 position

Curvilinear perspective: Convert 3D to 2D

寵の児 提交于 2019-12-20 09:37:41
问题 I'm looking for the mathematical expression converting a 3D coordinate (x0,y0,z0) to a 2D (x1,y1) coordinate in a curvilinear perspective of radius R where the values of x1 and y1 are the angles of views {-90° .. +90°} of the original point. (source: ntua.gr) (image via http://www.ntua.gr/arch/geometry/mbk/histor.htm ) Thanks ! 回答1: About one year later , the solution was really simple. For a point having the coordinates: (x1,y1,z1) Then, to transform this point in a curvilinear drawing of

Homing Missiles, How Do They Work?

南楼画角 提交于 2019-12-20 07:58:38
问题 What I am trying to create An object that will launch a missile towards the player, if it collides with player, player dies. The Problem How does the missile move towards the player. How do I make the missile move so that it does not instantly move directly towards the player(to slowly move on an angle). I have a formula for the mouse to be the "Player" and the missile to go towards it. mouse = Mouse.GetState(); mousePosition = new Vector2(mouse.X, mouse.Y); A = (mouse.X - Position.X); B =

Yet another KeyListener/KeyBinding Issue

妖精的绣舞 提交于 2019-12-20 07:46:35
问题 Ugh, I'm sorry MadProgrammer but I just couldn't get the KeyBinding to work the way I wanted it to :(. But I'll keep looking at some more tutorials till I figure it out. For now though I've stuck to a KeyListener and it works. But now I'm having an issue where p.move(); doesn't actually move the player. All other code I've put in works fine except p.move(); . I probably shouldn't be asking this many questions, so if you want me to stop just say so, but the whole SO community is really nice.

convert an 2d array from rows to blocks

情到浓时终转凉″ 提交于 2019-12-20 05:22:08
问题 I am trying to work in this code for weeks. I need to convert rows and columns in a 2d array to blocks. it should work on any matrix in size n*n. (that I have been given the size of the array) for example: this: int[][] input = {{1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}, {1,2,3,4,5,6,7,8,9}} ; this is need to be the output: {{1,2,3,1,2,3,1,2,3} {4,5,6,4,5,6,4,5,6} {7,8