Skip to main content
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. ...
StinkySkunk's user avatar
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 ...
Nathan Reed's user avatar
  • 25.1k
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, ...
Fabrice NEYRET's user avatar
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 ...
Reynolds's user avatar
  • 1,283
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-...
Dan Hulme's user avatar
  • 6,840
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 ...
RoboticForest's user avatar
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 ...
Olivier's user avatar
  • 1,585
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 ...
Dan Hulme's user avatar
  • 6,840
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 ...
unknown's user avatar
  • 223
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 ...
joojaa's user avatar
  • 8,437
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 ...
Noah Witherspoon's 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 ...
pmw1234's user avatar
  • 3,239
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 ...
JarkkoL's user avatar
  • 3,636
2 votes
Accepted

OpenSCAD: Using outline of 2D shape

(5 years, 3 months later) You might like https://github.com/openscad/openscad/pull/4348 which adds a fill() builtin to do just this ... it just got merged :-)
NickZoic's user avatar
  • 136
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,...
mushin's 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 ...
v.oddou's user avatar
  • 623
2 votes

How can I implement GIMP's "Colorize" function?

It appears to me that in the image, the saturation of the original image is 0 since it is grayscale. (Unless I've misunderstood the question.) When the saturation is 0, the hue is undefined, but it ...
user1118321's user avatar
  • 3,421
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 ...
Nathan Reed's user avatar
  • 25.1k
2 votes

Shader code for putting an atmosphere over a planet

I believe that Space Engine as a base algorithm still uses Precomputed Atmospheric Scattering by E. Bruneton. It is released on github. So it is good starting point if you want to implement ...
mdkdy's user avatar
  • 2,169
2 votes
Accepted

Unfold a 3D mesh to a 2D plane

When performing the unfolding the way you want, after you have unfolded one triangle in the plane, the next one should be one of the three triangles, adjacent to the unfolded one, i.e. the next ...
Futurologist's user avatar
2 votes
Accepted

My 2D translation matrix causes the box to be off screen when it shouldnt be

The mistake was in the multiplication order during the composition of the matrices. Since the OP was working with column vectors the correct order for transformations should have been $TRSA∗v$. The ...
gallickgunner's user avatar
2 votes

Problems with Subdivision Surfaces

Both T-splines and subdivision surfaces are capable of handling an arbitrary topology input mesh, whereas NURBS can only handle meshes with regular topology. Complex NURBS objects are therefore made ...
Reynolds's user avatar
  • 1,283
2 votes

How do I interpret the format of the .flame files used by apophysis?

There is some information about the XML file format used for .flame files. There are a number of forks of this program written in different languages, the original site is by definition the place to ...
Rob's user avatar
  • 256
2 votes

Rotate a Bitmap with Shearing

as paulHK said: One fundamental issue here is you're rotating in destination space rather than source space (e.g. apply the shear on source coordinates and output a rectangle). This way you can ...
John Heikens's user avatar
2 votes

Rotating a Bitmap

You have to loop over destination pixels instead of source ones (gaps are the result of looping over source). For each destination pixel you can calculate position in source data, your code for pixel ...
Sergio's user avatar
  • 71
2 votes
Accepted

How do I extrude a 2D Bezier curve representation into a 3D solid using Python?

You can't create a solid by extruding a single curve or set of curves. Even if they are closed. Think about a circle on on the XY plane. If you extrude the circle along the Z axis you have an uncapped ...
Joshua Kennedy's user avatar
2 votes
Accepted

Raycasting wall slice height issue

You've made a classic mistake, not primarily in your raycasting, but in how you compute the rays. You wrote: ...
Kevin Reid's user avatar
  • 1,206
1 vote

projecting 3d onto 2d plane is not showing up correctly

Your translate_coords_to_center(0,0) function should be done after you have done the projection from 3d to 2d. e.g. ...
PaulHK's user avatar
  • 2,322
1 vote

Calculate the position and rotation needed to have a camera look at a certain region

I have a 2D region defined by 4 points in 3D space. I want to position my camera so that it looks at the region, with a settable variable determining which side it looks at,... The first thing you ...
wychmaster's user avatar
  • 1,251

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