coordinate

Axis coordinates to pixel coordinates? (Matlab)

青春壹個敷衍的年華 提交于 2019-11-27 09:21:07
How can i convert the axis coordinates into pixel coordinates? I have a set of data which include the negative and floating values, i need to put all of the data into the image. But the pixel coordinates are all positive integer. how to solve the negative issue? You can pass vectors of coordinates to scatter . x = [-1.2 -2.4 0.3 7]; y = [2 -1 1 -3]; scatter(x,y,'.'); If you need the image matrix, h = figure(); scatter(x,y); F = getframe(h); img = F.cdata; You can also use print to save the plot to a file (or simply export from figure window), then use imread to read the file. There is also

Row-major order indices

让人想犯罪 __ 提交于 2019-11-26 21:18:24
问题 I'm currently working on project of where 2d terrain maps are saved into a one-dimensional array. Each block in the map is indexed by xy coordinates. So, to save the map into a one-dimensional array, I used the row-major order method (http://en.wikipedia.org/wiki/Row-major_order) to convert the xy coordinates into a single index value (Which let me put the block into an array). Now, my problem is how do I convert it back? I have a unique number which I have to convert back into xy coordinates

How to get object in WebGL 3d space from a mouse click coordinate

南楼画角 提交于 2019-11-26 16:29:06
I'm building a boardgame in WebGL. The board can be rotated/zoomed. I need a way to translate a click on the canvas element (x,y) into the relevant point in 3D space (x, y, z). The ultimate result is that I want to know the (x, y, z) coordinate that contains the point that touches the object closest to the user. For instance, the user clicks a piece, and you imagine a ray traveling through 3D space that goes through both the piece and the game board, but I want the (x, y, z) coord of the piece at the point where it was touched. I feel like this must be a very common problem, but I can't seem

Axis coordinates to pixel coordinates? (Matlab)

一个人想着一个人 提交于 2019-11-26 14:39:37
问题 How can i convert the axis coordinates into pixel coordinates? I have a set of data which include the negative and floating values, i need to put all of the data into the image. But the pixel coordinates are all positive integer. how to solve the negative issue? 回答1: You can pass vectors of coordinates to scatter . x = [-1.2 -2.4 0.3 7]; y = [2 -1 1 -3]; scatter(x,y,'.'); If you need the image matrix, h = figure(); scatter(x,y); F = getframe(h); img = F.cdata; You can also use print to save