Questions tagged [2d]

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models.

Flat perspective, having no three-dimensional geometry. Including two-dimensional space and 2D geometric models, or two-dimensional images having only height, and width with no depth.

7489 questions
8
votes
3 answers

What are the Issues with a vector-of-vectors?

I've read that a vector-of-vectors is bad given a fixed 2nd dimension, but I cannot find a clear explanation of the problems on http://www.stackoverflow.com. Could someone give an explanation of why using 2D indexing on a single vector is preferable…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
8
votes
1 answer

Getting text position while parsing pdf with Quartz 2D

another question regarding pdf parsing... Just read PDF Reference version 1.7 "5.3.1 Text-Positioning Operators" and I am a little bit confused. I wrote some code to get transformation matrix and initial text position. …
Koteg
  • 497
  • 7
  • 16
8
votes
2 answers

Footprint finding algorithm

I'm trying to come up with an algorithm to optimize the shape of a polygon (or multiple polygons) to maximize the value contained within that shape. I have data with 3 columns: X: the location on the x axis Y: the location on the y axis Value:…
gtwebb
  • 2,981
  • 3
  • 13
  • 22
8
votes
1 answer

How to make a wave warp effect in shader?

I want to make a wave warp effect like this: But I can only create the normal sine wave. Here is my fragment shader: precision mediump float; varying vec2 v_texCoord; uniform sampler2D s_baseMap; vec2 SineWave( vec2 p ){ float pi = 3.14159; …
thrillerist
  • 111
  • 1
  • 2
  • 6
8
votes
1 answer

What is the algorithm behind the PDF cloud annotation?

I've noticed that several PDF Annotation applications (Adobe Acrobat, Bluebeam, etc) have an algorithm for creating a cloud pattern around a polygon: When you drag the vertices of this polygon, the cloud pattern is recalculated: Notice how the…
Laith
  • 6,071
  • 1
  • 33
  • 60
8
votes
5 answers

WPF: Resizing a circle, keeping the center point instead of TopLeft?

I'd like to resize a circle on my canvas with the help of a slider. This circle can be moved around on the canvas by some drag&drop stuff I did in code behind, so its position is not fixed. I have bound the slider's value to an ellipse's height and…
Jan
  • 683
  • 10
  • 18
8
votes
3 answers

Need Help With N Queens Program ( checking diagonals )

I'm working on an N Queens program that will allow the user to enter a Queen configuration as a String. For example, when prompted, the user might enter something like Q....Q.....Q..Q. which when displayed as a board would look like: Q . . . . Q .…
Codebug
  • 801
  • 2
  • 8
  • 6
8
votes
2 answers

Java 8 Lambda to convert Number[][] to double[][]

Number[][] intArray = new Integer[][]{ {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; double[][] doubleArray = Arrays.stream(intArray) .forEach(pArray -> Arrays.stream(pArray) …
Nikhil
  • 345
  • 2
  • 13
8
votes
1 answer

Convert plane given by xyz to xy coordinates in R (3D to 2D)

My problem is simple! How can I transform points xyz coordinates (all belong to a single plane) to only xy coordinates. I can not find any R function or R solution. Source data: # cube with plain library(scatterplot3d) my.plain <- data.frame(ID =…
Ladislav Naďo
  • 822
  • 12
  • 27
8
votes
1 answer

Find world space coordinate for pixel in OpenCV

I need to find the world coordinate of a pixel using OpenCV. So when I take pixel (0,0) in my image (that's the upper-left corner), I want to know to what 3D world space coordinate this pixel corresponds to on my image plane. I know that a single…
Wouter92
  • 193
  • 1
  • 3
  • 9
8
votes
2 answers

Drawing with Transparent Paint on Android

When I use Paint with Color.TRANSPARENT on a normal 2D canvas in Android, I don't get any results and my intention was to get rid of some of the contents on the canvas. I mean the contents that I want to dispose of don't disappear. This is the code…
ax1mx2
  • 654
  • 1
  • 11
  • 23
8
votes
2 answers

What is an infinite scaleless quadtree called?

2D spatial indexing question: What do you call a data structure that is essentially an infinite* quadtree whose nodes contain neither absolute coordinates nor absolute scales -- in which the coordinate system of each node has been normalized to the…
8
votes
3 answers

Clipping a Rectangle in JavaScript

I'm trying to write a function that takes two overlapping rectangles and returns an array of rectangles that cover the area of rectangle A, but exclude area of rectangle B. I'm having a hard time figuring out what this algorithm looks like as the…
Robert Hurst
  • 8,902
  • 5
  • 42
  • 66
8
votes
1 answer

How to “flatten” or “collapse” a 2D data frame into a 1D data frame in R?

I have a two dimensional table with distances in a data.frame in R (imported from csv): CP000036 CP001063 CP001368 CP000036 0 a b CP001063 a 0 c CP001368 b c …
saladi
  • 3,103
  • 6
  • 36
  • 61
8
votes
4 answers

Find largest area in 2d array in c++

I need to write recursive function in c++ that finds largest area of number '1' in 2d array that contains only 1 or 0. Example: int Arr[5][8] = { { 0, 0, 0, 0, 1, 1, 0, 0, }, { 1, 0, 0, 1, 1, 1, 0, 0, }, { 1, 1, 0, 1, 0, 1, 1, 0, }, { 0, 0, 0, 1, 1,…
user1449504
  • 115
  • 1
  • 6