List:General Discussion« Previous MessageNext Message »
From:Brandon Ooi Date:February 7 2006 8:25pm
Subject:Re: Spatial Extensions in MySQL: Multidimensional Points?
View as plain text  
Use 3d pythagorean theorem.

the distance d between point1 (x1,y1,z1) and point2 (x2,y2,z2) is...

d = sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2)

as for building an index for this? i have no idea. but that is how you 
find the distance between two 3D points.

b

Jose Antonio wrote:
> MySQL offers Spacial Extensions to operate with points in a 2 dimensional
> space.
>
> For a project I'm working on, I need to work with points in an N dimensional
> space and measure the distance among them. Is there a clever do to solve the
> following problem?:
>
> Let's say I have 4 3D point (X,Y,Z):
>
> (0,0,0), (1,1,1), (4,4,2), (-2,30,18)
>
> And for a new point (3, -1, 1.5), I need to know which of my other points
> are closer and what the distance is.
>
> Any clues?
>
> Thank you in advance,
> Jose.
>
>   
Thread
Spatial Extensions in MySQL: Multidimensional Points?Jose Antonio7 Feb
  • Re: Spatial Extensions in MySQL: Multidimensional Points?Gleb Paharenko7 Feb
  • Re: Spatial Extensions in MySQL: Multidimensional Points?Brandon Ooi7 Feb