创建Android上的交互式轮廓图 [英] Creating interactive contour plots on Android

查看:345
本文介绍了创建Android上的交互式轮廓图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有强度的2D阵列应该在等高线图绘制的形式的数据。最终它应该看起来像用等高线像下面的图片地形图:

I have data in the form of a 2D array of intensities that should be plotted in a contour plot. In the end it should look like a topographic map with contour lines like the following image:

这个想法是典型的多点触控手势(捏缩放,拖动四处移动)可用于导航等高线图。数据的最大尺寸应为约4K * 4k点,每4个字节的大

The idea is that the typical multitouch gestures (pinch for zooming, dragging for moving around) can be used to navigate the contour plot. The maximum size of the data should be around 4k*4k points, each 4 bytes big.

有没有我可以使用一些绘图库,或我必须从头开始?是否有一个容易实现的算法是什么?

Is there some plotting library that I can use, or do I have to start from scratch? Is there an easily implemented algorithm for that?

推荐答案

我不知道为Android(或Java为此事)任何绘图库,但我确实知道,一般策划一两件事:

I don't know of any plotting libraries for Android (or Java for that matter), but I do know a thing or two about plotting in general:

这是简单的算法,用于创建轮廓将行军广场的。踏着广场创建从数据数组多边形。应该有大量的(尝试<一个用Java这种算法的例子href=\"http://www.google.com/$c$csearch?hl=en&lr=&q=marching+squares+lang%3ajava&sbtn=Search\"相对=nofollow>谷歌code搜索,但阅读许可使用之前)。

An easy algorithm for creating contours would be Marching Squares. Marching squares creates polygons from your array of data. There should be plenty of examples of this algorithm in Java (try Google Code Search, but read licenses before you use).

如果你想放大到你可能想创建的贝塞尔曲线的这些多边形它们理顺,一个例子算法(code,它应该很容易移植到Java)即可发现这里

If you want to zoom in far you probably want to create bezier curves from these polygons to smooth them out, an example algorithm (with code that should be easily ported to Java) can be found here.

请注意:如果你想使用一种颜色填充的轮廓,你应该考虑使用一个片段着色器,而不是创建多边形。将数据发送到所述着色器作为纹理和使用强度来分配一种颜色给每个像素。对于这个你应该知道一些的OpenGL。

Note: If you want to fill the contours with a color you should consider using a fragment shader instead of creating polygons. Send the data to the shader as a texture and use the intensity to assign a color to each pixel. For this you should know some OpenGL.

这篇关于创建Android上的交互式轮廓图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆