Questions tagged [2d-graphics]

46 questions
6
votes
2 answers

Converting cartesian pixels to polar pixels

(I've largely revamped this entire question, though the motivation remains the same.) revised question I want to convert a raster of cartesian pixels into polar pixels. Is there a sensible algorithm for doing this? For example, how do I compute…
5
votes
3 answers

Rounding corners of polygon given vertices of its corners

Given a polygon (regular or irregular, convex or concave), I want to round its corner, with a given radius; let's say 'x'. I have the code to draw an arc given 2 points, but how can I find the start and end points of the arc? All I have is a list of…
user3453636
  • 105
  • 4
5
votes
1 answer

Explanation of the Marching Squares saddle points resolution

I was reading the Wikipedia entry on Marching Squares, and was confused by the explanation of the saddle point disambiguation: Ambiguous Case: Basically, given the saddle points, the ambiguity is resolved by using the average data value for the…
user6750
4
votes
2 answers

2D metaballs with marching squares and linear interpolation

I struggle do understand how linear interpolation works in the marching square rendering algorithm context. I created simple example in GDScript (Godot) of random floating metaballs to demonstrate the problem: extends Node2D class Blob: var…
Arsenius
  • 141
  • 3
3
votes
1 answer

Douglas-Peuker and equal distances

I have a polyline and I want to simplify it with Douglas-Peucker. It's an easy algorithm, but what if there are points with the same distance. What point should I select? Is there a reasonable solution?
rr84
  • 105
  • 4
3
votes
1 answer

How to apply wire texture for realistic rendering of embroidery?

I am building an algorithm which takes a bitmap image as input and render the image as an embroidery design. The different steps are : Vectorize the image, I keep only 5 colors (Done) Generate stitches lines (Done) Apply wire embroidery…
pensfute
  • 131
  • 1
3
votes
1 answer

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 dimensional vanishing objects. I am interested in…
3
votes
0 answers

Can draw.io type flowcharts be programmed?

I made this flowchart with draw.io: It was the first chart I made so it took me a while to make it. I need to be able to dynamically generate variations of this diagram programmatically. I wold need to do things like change the colours of the human…
3
votes
1 answer

What if we don't mention Modelview and projection matrix?

So I've been learning opengl for some weeks now and managed to understand all the viewing pipelines. As far my understanding goes we need to bring the object to world space and then the world space to view space. After that the clipping is done by…
Broskiee
  • 133
  • 3
3
votes
2 answers

Line segments overlapping

I have implemented line segments intersetion test and at the very same test I want to include the fact that if two line segments overlap each other partially or fully , it will be flagged as no intersection. Some hint to it would be great to have!
sajis997
  • 1,209
  • 1
  • 9
  • 13
3
votes
1 answer

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 system, something like twin; not to reinvent the…
3
votes
0 answers

Generate polygons after marching squares in parallel

I've implemented the marching squares algorithm following Wikipedia's https://en.wikipedia.org/wiki/Marching_squares. The output I got is a set of edges, to which each contouring cell contributes 0, 1, or 4 edges. How do I modify or post-process…
Huy Le
  • 31
  • 1
2
votes
0 answers

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 change of direction at each vertex must be less…
2
votes
1 answer

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 am trying to create a simple 2D game with sprites…
J.Doe
  • 1,445
  • 11
  • 22
2
votes
0 answers

Transforming arcs and perspective change

I have a SVG with group of independent arcs that move around common origin. On user event those arcs can change both their radii and start/end angles. On other user event the user can change view from 2d to fake 3d (orthographic?) via following css…
mtx
  • 121
  • 2
1
2 3 4