Skip to main content

Questions tagged [2d]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
24 votes
1 answer
24k views

World coordinates, Normalised device coordinates and device coordinates

Can I get to know the difference between the three? A good example would add up too.
Anish Sharma's user avatar
15 votes
6 answers
694 views

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

In my answer about Affine Transformations I made some little illustrations to help the explanation. How do you make an upload-able PNG quickly which expresses a geometrical or mathematical idea? ...
luser droog's user avatar
  • 1,378
12 votes
2 answers
2k views

Hardware-accelerated drawing of curved shapes

How to quickly draw a curved shape? by "quickly" I presume one should use hardware facilities as much as possible by "curved" I mean boundaries defined by either quadratic or cubic Bezier curves by "...
Ecir Hana's user avatar
  • 1,459
11 votes
1 answer
356 views

Choosing width of data for signed distance field texture

A signed distance field texture is a technique where you store the distance from a pixel to the surface of a shape within the color information for that pixel, allowing almost vector graphics quality ...
Alan Wolfe's user avatar
  • 7,801
10 votes
2 answers
2k views

Fundamentally, how are 2D bitmaps rendered?

Suppose we have a 64-bit word-addressable computer and we want to program it to output a 5x7 character stored as a binary image bitmap (such as the one below) to a memory-mapped display. Since we ...
user1735's user avatar
  • 101
9 votes
1 answer
5k views

Understanding Jump Flooding Algorithm (JFA) for Voronoi Diagrams

I'm having trouble understanding the JFA. As far as I understood the algorithm, it walks log(n) times through every pixel (no matter if it is a seed or not) and looks at that pixel's neighbors in $(x+...
Muad's user avatar
  • 165
8 votes
1 answer
863 views

How to invert an affine matrix with small values?

I'm using an affine transformation matrix to transform 2D coordinates from screen (magnitude 10e3) to small parts of fractal sets (magnitude as little as 10e-15). I also need to map the other way ...
solendil's user avatar
  • 251
7 votes
1 answer
1k views

How to calculate matching roundness of two offset rectangles?

I have two rectangles — one with a fill (blue) and one with a stroke (red). The red rectangle is being offset (depending on the stroke width) so that it appears snug and outside the edge of the blue ...
Greg Gunn's user avatar
7 votes
1 answer
1k views

Calculating intersection of polyline and line

I have a convoluted polyline composed of vertices and straight segments and a separate point that is independent of the polyline. I am trying draw a straight new line from the point at a given angle ...
Mike Bannister's user avatar
5 votes
1 answer
595 views

Different types of Gaussian blur?

The Gimp has two different options in how you can perform Gaussian blur: "IIR" and "RLE". What's the difference between them?
Mark's user avatar
  • 1,612
5 votes
1 answer
257 views

How to get polygon coordinates in screen space

I need to be able to click on this polygon in 2d. This polygons set of vertices aren't in the same space as the screen. (Ie: the edge of the screen may be a value of 20 in one space but 1920 in the ...
Andrew Wilson's user avatar
5 votes
1 answer
88 views

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

When the display hardware is physically rotated 90 degrees, your graphics can still be rendered with the correct side up. Where is this rotation accomplished? I can imagine a few possibilities: A) ...
Joakim Rosqvist's user avatar
5 votes
0 answers
136 views

Is there any open-source implementation of n*log(n) visibility graph construction algorithm?

Is there any open-source implementation of n*log(n) visibility graph construction algorithm? I'm trying to understand S. K. GHOSH and D. M. MOUNT sweep line algorithm, but it's known for having very ...
Ibraim Ganiev's user avatar
4 votes
2 answers
883 views

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

As explained in Holger Dammetz page Hammersley Points on the Hemisphere, the 2D coordinates (u,v) are usually mapped to the spherical coordinates (θ, φ). As a result, the coordinate "uniformly ...
wip's user avatar
  • 1,861
4 votes
2 answers
2k views

Unfold a 3D mesh to a 2D plane

I'm trying to unfold a 3D mesh onto a 2D plane. My general idea to do this, would be to cycle through all the faces of the meshes and perform a hierarchical transformation. So I would start at the ...
Anima's user avatar
  • 167
4 votes
1 answer
472 views

How to prevent moire artifacts in this light casting algorithm?

I am writing a 2D light casting algorithm with OpenGL compute shaders. The algorithm is simple: For each light source shoot out light rays from it, the ray begins at the light coordinates, it ends at ...
sydd's user avatar
  • 253
3 votes
1 answer
2k views

Image rotation algorithm

I would like to rotate a raster image by an arbitrary angle. I don't really care for speed: the rotation should be of highest quality possible. Could someone please suggest a suitable algorithm? I'm ...
Ecir Hana's user avatar
  • 1,459
3 votes
1 answer
151 views

human visual: relation of Distance and DPI

I was told that human's visual sharpness is 60 pixels per degree. As such, pixel per inch is approximately given by: PPI = 1/ (Distance * tg((1/60*pi/180) ) Is ...
angel_30's user avatar
  • 229
3 votes
1 answer
134 views

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

I pulled a .zip file from https://www.deviantart.com/clairejones/art/Apophysis-Starter-Flames-V-67029474 and the file I was interested was the .flame file which ...
Mutant Bob's user avatar
3 votes
1 answer
227 views

Algorithms for rendering overlapping (floating) windows in 2D

I'm trying to figure out a solution to a problem that looked simple at first: how to render overlapping windows in a 2D windowing system. Originally I was thinking about implementing a text-based UI ...
LittlePilgrim's user avatar
3 votes
1 answer
398 views

Determining Vanishing Points of edges of Triangle using given Point

Due to perspective foreshortening, the projections of parallel lines (1D geometric objects) meet in their vanishing point (a 0D geometric object). Higher dimensional geometric objects also has higher ...
user2742934's user avatar
3 votes
2 answers
1k views

Finding the nearest neighbor of polygons

I have a set of non-convex polygons and I want to merge them. I am able to find the connection between two polygons. If there are more than two polygons, one connection can intersect another polygon ...
rr84's user avatar
  • 105
3 votes
1 answer
172 views

Remove clearly not visible vertices from a polygon

For a visibility algorithm I want to remove verts of polygon that are guaranteed not visible from a vert S. The idea is to remove pockets that points are on the backside of a plane formed by the ...
rr84's user avatar
  • 105
2 votes
1 answer
375 views

Generate this kind of 2d burst or pulse algorithm?

I'm currently trying to develop a game using Cocos2d-x using C++. I really need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was ...
quinnavery's user avatar
2 votes
2 answers
160 views

drawing ellipse with rotation cause inaccurate result

i'am a junior in computer graphics , currently i learn how to draw ellipses with rotation . when i preform rotation with 90deg or 180deg nothing unusual happened , but when i try to rotate with any ...
0x00001F's user avatar
2 votes
1 answer
274 views

If you can use subdivision surfaces for 2D curves

I've seen how subdivision surfaces are good for 3D curves/modeling, but haven't seen anything on if it's good, or even usable, in 2D. My question is just that, if (a) you can even use subdivision ...
Lance's user avatar
  • 123
2 votes
1 answer
219 views

$P^2$ vs projection plane

I want to explain what I understood of definition of the two things. Projection plane: The general processing steps for modeling and converting a world coordinate description of a scene to device ...
user avatar
2 votes
1 answer
2k views

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

It seems that every image format (jpeg, png, tiff, bmp, jp2000...) doesn't place their origin at the same corner. Do you know where I could find some info about this differences? I can only say that ...
Sandburg's user avatar
  • 123
2 votes
1 answer
2k views

Shader code for putting an atmosphere over a planet

I'm working on a game set in space with procedurally generated planets, and I'm trying to write a shader that puts an atmosphere over a planet given the color of the atmosphere and the strength of the ...
Earlh21's user avatar
  • 21
2 votes
1 answer
168 views

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

Now I know this isn't the way this is normally done so please bear with me. I am doing this this way so I know I have a solid conceptual understanding of everything that goes beyond example code. I ...
J.Doe's user avatar
  • 1,445
2 votes
1 answer
77 views

Calculate set of rectangles covering pixel diffs?

I'd like to develop a system for web animation similar to animated gifs, like this one. I capture a series of screenshots at fixed time intervals, and then I'd like to animate them. I can trivially ...
Colin's user avatar
  • 121
2 votes
1 answer
287 views

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

I have an RGB pixel that I'd like to colorize in my program (I'm using GLSL) very similar to how the GIMP "Colors > Colorize" function works. In my program, I can easily convert between RGB and HSV. ...
carlr's user avatar
  • 21
2 votes
1 answer
771 views

OpenSCAD: Using outline of 2D shape

module initial(letter, size) { linear_extrude(height=size*4, center=true) { text(letter, size=size, halign="center", valign="center", font=font); } } I'm ...
DonGar's user avatar
  • 123
2 votes
1 answer
408 views

3D homogenous coordinates versus 4D homogenous coordinates

We know that any 2D point $(x, y) $which represents as 3D homogeneous coordinates is of the form $(x, y, 1)$ which is the points of projective plane $P^2.$ If I use the same concepts for 3D points $(...
S. M.'s user avatar
  • 211
2 votes
1 answer
147 views

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, where looks at means that ...
GenRincewind's user avatar
2 votes
0 answers
113 views

Constraining a Polyline to Look Smooth

What are the mathematical constraints required for a polyline, i.e., a piecewise linear curve, to appear as a smooth curve to human vision? I've discovered one document that specifies only that the ...
James Ashton's user avatar
1 vote
1 answer
109 views

Area-light approximation in 2D

I’m trying to render a 2D image something like this: …where an arbitrary shape has its border illuminated by a line in a relatively physically accurate way, i.e. with less illumination reaching the ...
Noah Witherspoon's user avatar
1 vote
1 answer
8k views

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

The 2D pipeline involves with the construction of world coordinate scene followed by converting world coordinate to viewing coordinate, then transforming viewing coordinate to normalized coordinate ...
Himanshuman's user avatar
1 vote
1 answer
79 views

Linear independence of three points

What is the best way to prove if three points are linear dependent? This is my current way to do it: $$\mathbf{v_a} = \mathbf{b}-\mathbf{a} \\ \mathbf{v_b} = \mathbf{c}-\mathbf{a} \\ \mathbf{v_c} = \...
rr84's user avatar
  • 105
1 vote
1 answer
583 views

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

Where P is the control point, w is weight. I plan to extrude this 2d representation into 3d. I have a discrete 2D representation (array which has [n_points, 2, 1] for each sample) of an airfoil that ...
sarva's user avatar
  • 13
1 vote
1 answer
2k views

Rotating a Bitmap

I would like to rotate an bitmap image using math. I have two issues with my current implementation: the pixel-by-pixel rotation of the copied bitmap is extremely slow and it is leaving gaps between ...
Dr. Pontchartrain's user avatar
1 vote
1 answer
46 views

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

I have an image that I'm trying to recreate programatically using Pyx in Python. It seems that there's an overlaid circle covering the color wheel. I'm trying to see if there's a way to, given the ...
Mark LeMoine's user avatar
1 vote
1 answer
184 views

What does an algorithm which handles mesh-based image morphing look like?

In recent years, the technology of Live2D has become particularly popular and I have been attempting to find any papers or articles which explain what the mathematics for the mesh-based image morphing ...
MadCreativity's user avatar
1 vote
1 answer
58 views

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

I am trying to learn about 3d graphics from first principles, so i have decided to implement a simple thing, create a circle in 3d space & rotate it along some axis. I understand the basics theory....
anekix's user avatar
  • 123
1 vote
1 answer
137 views

What graphic languages are simpler than SVG for database diagrams? [closed]

This is PNG was exported from Inkscape. I created it manually and used the connector tool to link tables. I find the plain SVG for this diagram more complicated than I was expecting so would like to ...
Dave Kirkby's user avatar
1 vote
0 answers
133 views

Turning colorized comic-art into uncolorized monochrome (line-art-inks-only B&W), not just very-light-grayscale

I'm trying to figure out how to go about removing the "colorization" of comic/cartoon/manga/etc drawn-art inputs where the black-ink strokes ("the line-art") are to be retained ...
Phil S.'s user avatar
  • 11
1 vote
0 answers
425 views

How to plot an ADC value from the Raspberry PI Pico using pythons matplotlib

Being new to Python and this community, I am trying to plot the pulse return from a transducer. The pulse return is 400 uSecs in duration and occurs every 100 milliseconds. So far I can plot the ...
R Bowles's user avatar
1 vote
0 answers
379 views

Combine box shadow with a signed distance field

I'm using 2d signed distance fields in my current project for drawing shapes (example: https://www.shadertoy.com/view/4llXD7) and I want to add drop shadows to them. At first I thought I could exploit ...
weichsem's user avatar
  • 111
1 vote
0 answers
59 views

Rectangle bounds of isometric object to isometric bounds

This might sound confusing, but this is what I'm trying to achieve: project to: I already have an algorithm in my mind, where we simply detect the corners touching the Cartesian rectangle and ...
Test's user avatar
  • 31
0 votes
1 answer
438 views

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

I wanted to make a little demo for a console with Realm of the Mad God esc graphics to brush up my C and SDL skills. One problem I'm running in to is creating the 3D walls. The console I'm ...
Daan's user avatar
  • 1