0

I have some code which updates an elevation grid.

var m_grid=document.getElementById(m_gridID);
var colorGrid=document.getElementById(m_gridColorID);

colorGrid.color = colorStr;
m_grid.setAttribute("xDimension", m_width);
m_grid.setAttribute("zDimension", m_slices);
m_grid.setAttribute("xspacing", 20.25/(m_width-1));
m_grid.setAttribute("zspacing", 6.81/(m_slices-1));
m_grid.setAttribute("height", gridStr);

//reload
var container = m_grid.parentNode;
var content = container.innerHTML;
container.innerHTML = content;

Is it possible to do this more elegantly and/or faster? Is it possible to set height and color as arrays rather than as strings? Is it possible to set height or color for single points? Is it possible not to reload the part of the document with the grid?

user2939415
  • 864
  • 1
  • 11
  • 22
  • 1
    you could use Interpolator nodes to update the field values of your elevation grid. Regarding the reloading of page, normally the scene should auto-reload whenever you update an element within it, but I'm not 100% sure! – Traian Feb 15 '14 at 10:17
  • Using a ROUTE? Is an interpolator better or faster somehow? – user2939415 Feb 15 '14 at 20:12
  • Yes, using ROUTE. I would say it's more elegant to use the field of an interpolator to store elevation grid values (as arrays not as strings). If it's faster, well...it depends: normally it should be faster because you would ROUTE the values from a node to another. A smart Browser/Engine should do the ROUTING at least as fast as assigning values using setAttribute. – Traian Feb 16 '14 at 21:09

0 Answers0