Previous | Next --- Slide 6 of 36
Back to Lecture Thumbnails
ceviri

Is that middle picture some sort of Voronoi diagram?

idontknow

If I had to guess, we choose to represent images as a square grid because it's probably easiest to manufacture a computer monitor as a square grid of pixels rather than another shape like hexagons or pentagons

Sybil

There's also the possibility of the picture not being 2D if we are using other shapes (not carefully)

bcagan

It would also make incrementing through the pixel coordinates a lot more complicated, as integer coordinates might not work as well, or have the same meaning.

keenan

@idontknow It's a bit of a chicken and egg situation. One thing that makes square pixels cheap to manufacture is that people buy a lot of square-pixel displays. The reason people buy a lot of square-pixel displays is that they're cheap to manufacture. But if we had started out from the beginning making hexagonal pixel displays (which do have some clear advantages), they might be just as cheap by now. Technology has as much to do with market forces as it does with physical forces.

keenan

@bcagan Addressing a grid of regular hexagons is actually not so much different from addressing a grid of squares. (See some of the old exams! ;-))

graphicstar11

also wouldn't it be difficult to make hexagonal pixels like hardware wise? And I feel like a lot of the mathematics behind computer graphics is all Cartesian coordinates so grids work better that way.

bcagan

@keenan Oh okay

keenan

@graphicsstar11 Sampling onto a hexagonal pixel grid doesn't really interfere with using Cartesian coordinates to perform calculations. For instance, think about rasterizing a triangle. What do you need to check? For each sample coordinate $(x,y)$ you need to test if it's inside or outside three half-spaces. The center of each hexagonal pixel has a well-defined $(x,y)$ coordinate, and it's trivial to cook up these coordinates as you loop over the grid. In short: just because your pixels are hexagonal, doesn't mean you don't have access to Cartesian coordinates! :-)

0x484884

It seems like a square grid is nice since it has a more natural correspondence to 2d arrays.

Also would it be more efficient to use a square grid than hexagonal or triangular when working in base 2? It seems like you would have to work with thirds and sixths more often with triangular and hexagonal grids and those would be easier to represent in base 3 or 6 than in base 2.

xiaol3

I think it because choose square grid to correspond the image into a euclidean coordinate system. This will the math becomes easier.

keenan

0x484884 Logically addressing a hexagonal (or triangular) grid is actually not much different from addressing a square grid. E.g., to get the ith entry in the jth row, I might use the address j*w+i, where w is the width. If you want to look up the cell containing a given point (x,y), then yes you have to do a little bit of extra arithmetic (an add or two here). But this probably isn't your bottleneck: compute is cheap; bandwidth is expensive.