How do I find a coordinate using cartesian coordinate system with just an index?
By : Zwee
Date : March 29 2020, 07:55 AM
I hope this helps . What you're loking for is what's known as a pairing function, where (x, y) maps to a certain integer N and viceversa (the function is onetoone and onto). Keith's first answer (for finite ranges) is close, but requires you to know the maximum size of the square, in effect adding another parameter to the pairing function. His screenshot in Excel (for infinite ranges) shows how it's done, but I'd like to add some explanation to it. Given a value N that you want to map to a coordinate (x, y): code :
1 2 5 10 > '1 2 3 4
4 3 6 11 > 2 '2 3 4
9 8 7 12 > 3 3 '3 4
16 15 14 13 > 4 4 4 '4
layer = math.floor(math.sqrt(N  1)) + 1
diagonal = (layer^2)  layer + 1
if (N < diagonal):
x = layer
y = N  ((layer1)^2) + 1
elif (N == diagonal):
x = layer
y = layer
else:
x = (layer^2)  N + 1
y = layer

openGL move forward with rotation works for 0 degrees, backwards for 90 degrees
By : Jose Luis Jimenez Gu
Date : March 29 2020, 07:55 AM
This might help you I am trying to move my world in reference to a character. It works if the degree is zero (the player goes forward) but messes up everywhere else. When it is 90 degrees, the player goes backwards instead of forwards. I feel like I am on the right track and I just messed up something small. , The formula is incorrect. Here is the correct one: code :
def moveForward():
global angle, angle_speed, world_loc, maxSize
rad = (angle+90) * (pi/180)
world_loc = (world_loc[0]  speed * cos(rad), world_loc[1], world_loc[2]  speed * sin(rad))

MATLAB: Applying multiple values to each (x,y) coordinate point in a 2D Cartesian coordinate system
By : charmen
Date : March 29 2020, 07:55 AM
With these it helps Same number of values everywhere If you want to assign the same number of values to each grid point, it is best to create a 5xXxY matrix, for example code :
xy_vals = rand([5 nx ny]);
test_vals = xy_vals(:,xx,yy);
xy_cell = cell([nx ny]);
for ix = 1:nx
for iy = 1:ny
xy_cell{ix,iy} = randi([1 randi(10)]);
end
end
test_vals = xy_cell{xx,yy};

Android canvas rotation: need to rotate *by* x degrees not *to* x degrees
By : Buntuu
Date : March 29 2020, 07:55 AM
Does that help One simple approach would be to store the last rotation as a variable and +/ next rotation to it  watching of course you don't go beyond 360.

How do I convert a coordinate in one 3d Cartesian coordinate system to another 3d Cartesian coordinate system
By : L_H
Date : March 29 2020, 07:55 AM
will help you Answering the pared down version of the question (see the comments): A point expressed in a coordinate system given by an origin point O1, with axis vectors X1, Y1 and Z1 has coordinates P=(x1, y1, z1) in that coordinate system. Similarly, in a second coordinate with origin O2 and axis vectors X2, Y2 and Z2, the same point is expressed P=(x2, y2, z2). (Note the lower case for coordinates, upper case for points and vectors).

