La mejor forma de representar objetos 3D en javascript

I want to represent 3D objects in javascript. Actually, I want to represent objects in a video (which would be x,y, and time, so it's like a 3D object). I will have a set of objects which are defined by boundaries of X,Y and Z (time). There wil be a function getObject(x,y,z) which, given a point (X,Y,Z) will return the object in which that point is contained. There will be no overlapping objects, so each point can be mapped only to one object.

I could use a 3D array, which turns into a very fast getObject function, but then I'd have a huge amount of data, which would be a problem as it's a web application. On the other hand I could do it storing just the x,y and z boundaries for each object, but then the function getObject would be slower is it would have to iterate over all objects.

I am sure this design problem has been faced before by many people.

preguntado el 08 de noviembre de 11 a las 17:11

If you have a "huge amount of data", are you sure JavaScript is the right tool for you? -

Well, I don't know yet if it will be a huge huge amount of data, but I want to be sure I designed it in an optimized way. Javascript is mandatory. thanks -

1 Respuestas

It's hard to say without knowing more specifics about your problem (size/shape of your objects, runtime requirements), but you may be interested in the Octree data structure, which is commonly used 3D scene managers.

respondido 08 nov., 11:21

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.