How Can a Monotonic Spatial Function Uniquely Map 3D Integer Coordinates?

  • Context: Graduate 
  • Thread starter Thread starter intervoxel
  • Start date Start date
  • Tags Tags
    Function
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 2K views
intervoxel
Messages
192
Reaction score
1
I need an integer function that receives three integer parameters x,y,z and returns a unique value. An additional constraint is that the nearest neighbors points return a value that doesn't exceed a small value. The maximum value for the inputs is N.

Thank you for any help.
 
Mathematics news on Phys.org
How does monotonic figure in here? In different words you want a function f that maps ##\mathbb R^3## to ##\mathbb R##, but using integer values for the inputs.
For a real-value function g of a real variable, g is monotonically increasing provided that ##a < b \Rightarrow g(a) \le g(b)##.

For a function whose input is an ordered triple, (x, y, z) how do you determine that ##(x_1, y_1, z_1) < (x_2, y_2, z_2)## in order to show montonicity?
 
What "doesn't exceed a small value" mean?

##(x,y,z) \to (N+1)^2 x + (N+1) y + z## or something similar can work. If the return value doesn't have to be an integer you have more freedom.
 
mfb said:
What "doesn't exceed a small value" mean?

##(x,y,z) \to (N+1)^2 x + (N+1) y + z## or something similar can work. If the return value doesn't have to be an integer you have more freedom.
Thank you for the answers so far. The above function is indeed monotonic but does not return a unique value for each triplet. I tried
if(y <= z)
r = 3*N*N*x + y+N*z+1;
else
r = 3*N*N*x + 3*N*y-z;
but it generates some duplicates.
 
intervoxel said:
The above function is indeed monotonic but does not return a unique value for each triplet
It does if x,y,z are integers from 0 to N inclusively (or 1 to N, doesn't matter here).

It is a simple numbering, row by row, column by column, layer by layer in 3D space.
 
  • Like
Likes   Reactions: intervoxel
intervoxel said:
Thank you for the answers so far. The above function is indeed monotonic but does not return a unique value for each triplet. I tried
if(y <= z)
r = 3*N*N*x + y+N*z+1;
else
r = 3*N*N*x + 3*N*y-z;
but it generates some duplicates.
You're right. It works. I had tried with
mfb said:
It does if x,y,z are integers from 0 to N inclusively (or 1 to N, doesn't matter here).

It is a simple numbering, row by row, column by column, layer by layer in 3D space.

You're right. It works! I had tried with N instead of N+1 and that failed. Thank you.