# Predicting x,y coordinates together or as multiple fields

Hello!
I’m trying to build a program in which NuPIC would predict the next step of moving a point on a 2D plane. I have a plane that I divided into 16x16 squares, so the current coordinates of the point are two integers, for example (1, 10) or (16, 10). I read the coordinates periodically at regular intervals. I want to get a prediction of the point’s coordinate in the next step, based on the previous point movement. Unfortunately, I did not find the opportunity to get the prediction from two dimensions at once.
NuPIC will be able to predict the coordinates (x,y)? Or should I consider each coordinate separately?

1 Like

Hi there, I would take a look at experiments surrounding the GeospatialCoordinateEncoder, and things like @rhyolight’s experiments with Minecraft? Sorry I can’t provide links at the time of this writing…

Cheers!
David

1 Like

Here’s the Minecraft example:

2 Likes

You could also encode location using grid-cell techniques like this: 3 Likes

@rhyolight

I just can’t get over just how freakin’ cool that is!!! 2 Likes

Does any one port this code of @rhyolight into c++?

@rhyolight: in the function:

`````` parallelogramitize(x, y) {
// Shift every other row to get a pseudo hex grid
let xmod = x
let ymod = y
xmod += y / 2;
// ymod = y - (this.scale - Math.sin(60 * (Math.PI / 180)));
ymod = y - (y * 0.1);
return [xmod, ymod]
}
``````

I think the current Calculation of ymod is not correct. Am I Right?

This puzzled me, too. I thought my trig was right, but the 10% estimate I did made the hex grid look much more natural.

Ok, thank, I can only check it after porting your code into c++. I think the porting will be straighforwards…

well,

``````y - (y * 0.1)
``````

is y*0.9
… which looks ‘natural enough’ since 0.9 is quite close to the exact factor which is sin 60°, aka ~0.8660254

so,

``````ymod = y*0.8660254
``````

and you’re done 2 Likes

@gmirey thanks for explain …