Hot answers tagged

26 votes
Accepted

World coordinates, Normalised device coordinates and device coordinates

World coordinates are at the bedrock of your game world. The 3D positions of all objects are ultimately specified in world space, either directly or through a node hierarchy. The ground, buildings, ...
user avatar
  • 23.7k
13 votes

How to produce simple 2D illustrations to accompany geometry answers?

I use a variety of tools depending on the particular needs of the moment. I have a bias toward free tools, as I don't have access to things like Illustrator or Mathematica. For general vector art ...
user avatar
  • 23.7k
12 votes

How to produce simple 2D illustrations to accompany geometry answers?

Personally my choice of poison is Adobe Illustrator. Other apps such as inkscape, Corel Draw, Xara Designer will also do. In a pinch even PowerPoint will work. Though I do not personally recommend ...
user avatar
  • 8,159
8 votes
Accepted

Understanding Jump Flooding Algorithm (JFA) for Voronoi Diagrams

I think that there is a bit of confusion in terminology. My understanding is that only the initially colored points, before step 1, are called seeds. Maybe this helps clarify the algorithm as well. ...
user avatar
7 votes
Accepted

How to invert an affine matrix with small values?

I found a solution to my specific problem. Instead of computing the determinant and hitting the precision wall, I use the Gauss-Jordan method step by step. In my specific case of affine ...
user avatar
  • 241
7 votes
Accepted

Generate this kind of 2d burst or pulse algorithm?

Rather than using an image, I would suggest doing this kind of effect using a shader. I'm not familiar with Cocos2d-x, but some quick googling suggests that it can work with shaders. You'd use a pixel ...
user avatar
  • 23.7k
7 votes
Accepted

How to calculate matching roundness of two offset rectangles?

What you (probably) want to achieve is something like this: When having a closer look at one of the corners and add a few lines, we see this: The black lines indicate that the center points of the ...
user avatar
  • 1,200
7 votes

Fundamentally, how are 2D bitmaps rendered?

You have to distinguish the text and graphical modes of the graphics board of your machine. In the old days, mostly the text mode was supported. In this mode the board took care of storing the bitmap ...
user avatar
5 votes
Accepted

Different types of Gaussian blur?

From the GIMP docs: IIR IIR stands for “infinite impulse response”. This blur works best for large radius values and for images which are not computer generated. RLE RLE stands for “run-length ...
user avatar
  • 5,872
4 votes

How to produce simple 2D illustrations to accompany geometry answers?

I just use Powerpoint to make such diagrams and it works great as soon as you're comfortable with its basic primitives. It supports all simple operations like rotation, translation, etc. and recent ...
user avatar
  • 1,944
4 votes

How to produce simple 2D illustrations to accompany geometry answers?

PostScript+ps2eps+mogrify For the Affine Transformations answer, I wrote a very small postscript program and then saved several copies under different names and edited each one to do each different ...
user avatar
  • 1,088
4 votes
Accepted

Why map Hammersley 2D set's (u,v) to sphere's (θ, φ) coordinates (and not to (φ, θ) )?

You can of course, as you suggested, map (u, v) to (φ, θ). Unfortunately, it does not solve the problem for 5 points: I've changed Holger Dammertz' code a bit (switched u and v), and you see that the ...
user avatar
  • 2,221
4 votes

Image rotation algorithm

It speed does not matter, I suggest to use a truncated sinc or a Lanczos isotropic kernel: to compute a target pixel, you back-rotate the filter and convolve it with the image. Since it is isotropic, ...
user avatar
4 votes

How to produce simple 2D illustrations to accompany geometry answers?

Not the definitive toolbox you might be looking for, but just an extra tool I use myself: for 3d graphics, Blender might come in handy. Especially if you use the Export_SVG plugin (available from http:...
user avatar
  • 141
4 votes
Accepted

If you can use subdivision surfaces for 2D curves

Subdivision can be used for curves in 2D just as easily as for surfaces in 3D. Usually the subdivision algorithms applied to 2D are called subdivision curves. Subdivision curves do not suffer from the ...
user avatar
  • 967
3 votes

What technique would I use to create fake 3d walls as seen in Realm of the Mad God

What they're using in this game is called an orthographic projection. It is a special type of a projection, which does not bend objects, it does not mean that they are not using 3D. Now, of course ...
user avatar
  • 213
3 votes
Accepted

human visual: relation of Distance and DPI

According to a review by Legge & Bigelow the arc or degrees of visual angle ($\alpha$) is, $$ \alpha = 57.3 \times S/D, $$ where S is height of object and D is distance to object. [1] $S/D$ is ...
user avatar
  • 8,159
3 votes

Skia example code not writing an image

This never writes anything to the output file because you haven't included any code to write to the output file. The only time you touch the file after opening it is in the line ...
user avatar
  • 6,440
3 votes

How to get polygon coordinates in screen space

Edit: This answer is only helpful in 3D If you want to do it geometrically... The inverse of the view-projection matrix, $K^{-1}$ is the matrix you want. Where $K = View * Projection$ If $\vec{v}$ ...
user avatar
3 votes

Calculating intersection of polyline and line

Given that you want to test for intersection against rays with many different starting points and directions, it's worth investigating raytracing-style acceleration structures, such as the bounding ...
user avatar
  • 23.7k
3 votes

Linear independence of three points

Normalize $v_a$ and $v_b$ and your algorithm should no longer depend on the length of the edges, unless you consider numerical stability. As for the "best way", I'm not sure there's a much better ...
user avatar
  • 1,575
3 votes
Accepted

Why is pixel 0,0 at the top left of some formats and bottom left of others?

It comes down to history. The original interfaces for drawing stuff on the screen were for text, not images. Since the people who designed those early computers spoke languages that are read left-to-...
user avatar
  • 6,440
3 votes
Accepted

What is the difference between world coordinate, viewing coordinate and device coordinate in computer graphics?

The 2D pipeline involves ... [coordinate transformation terms] Can someone give me the detail differentiation among these? This is something I very recently learned while trying to understand how ...
user avatar
3 votes
Accepted

Area-light approximation in 2D

Found a solution—it may not be strictly accurate for 2D, but it produces the look that I’m after. “Linear Light Shading with Linearly Transformed Cosines”, in section 1.3, describes a closed-form ...
user avatar
3 votes
Accepted

$P^2$ vs projection plane

In computer graphics the projection plane is most commonly defined as a plane perpendicular to the camera at a specific distance from the camera (the distance is often labeled $g$). It is the plane ...
user avatar
  • 2,074
2 votes

Hardware-accelerated drawing of curved shapes

You can use OpenGl 4.x tessellation shaders to convert Bezier control points into polygons. A google search for "tessellation shader bezier" found this outline describing the tessellation of Bezier ...
user avatar
  • 121
2 votes

Calculate set of rectangles covering pixel diffs?

I would say it’s a weighted set covering problem. In specific, the cost for a set of points is the number of extra pixels in the bounding rectangle of this set. If the number of diff points is small,...
user avatar
  • 46
2 votes

How to prevent moire artifacts in this light casting algorithm?

In principle you avoid using scatter (casting) behavior with GPU. They have offered random output coordinate write out since only shader model 5 as a need for extreme situations. But you should as ...
user avatar
  • 613
2 votes
Accepted

What part of the graphics chain rotates computer displays when in portrait mode?

On typical GPUs today it's option B: monitor rotation is done by the video output hardware ("display engine") during scan-out. In addition to rotating/flipping, the display engine can also scale the ...
user avatar
  • 23.7k
2 votes

Given a composited image, is it possible to find the color and opacity of an overlaid shape?

You can solve the colors by solving a system of linear equations if you make few assumptions: The alpha of the color wheel is constant (i.e. same for all colors in the wheel) The beige background ...
user avatar
  • 3,541

Only top scored, non community-wiki answers of a minimum length are eligible