如何使用Eclipse在Android中使用jzy3d? [英] How to use jzy3d in android using eclipse?

查看:73
本文介绍了如何使用Eclipse在Android中使用jzy3d?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.我想在Android中创建3dplot图.我想使用jzy3d lib并找到此示例作为开始.

Hi. I want to create a 3dplot graph in android. I want to use jzy3d lib and found this example for beginning.

import org.jzy3d.chart.Chart;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.canvas.Quality;
import org.jzy3d.ui.ChartLauncher;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Mapper mapper = new Mapper() {
        public double f(double x, double y) {
            return 10 * Math.sin(x / 10) * Math.cos(y / 20) * x;
        }
    };

    // Define range and precision for the function to plot
    Range range = new Range(-150, 150);
    int steps = 50;

    // Create a surface drawing that function
    Shape surface = (Shape) Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);
    surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax()));
    surface.setFaceDisplayed(true);
    surface.setWireframeDisplayed(false);
    surface.setWireframeColor(Color.BLACK);

    // Create a chart and add the surface
    Chart chart = new Chart(Quality.Advanced);
    chart.getScene().getGraph().add(surface);
    ChartLauncher.openChart(chart);
}

但是当我要运行它时,会显示以下错误消息:

but when I want to run it it gives this error message:

05-29 20:10:16.685: E/AndroidRuntime(20113): java.lang.NoClassDefFoundError: org.jzy3d.plot3d.rendering.canvas.CanvasAWT     

当然,我将jzy3d,jogl,swt,胶原库添加到我的项目中.

and of course i add jzy3d , jogl , swt , gluegen libs to my project.

推荐答案

Android不支持AWT.此外,您可以使用JOGL 1中的"jogl.jar",而JOGL仅从第二版开始才支持Android.请使用最新版本的Jzy3D,并对JOGL和GlueGen执行相同的操作.据我所知,Jzy3D 0.8不支持Android.

AWT isn't supported under Android. Moreover, you use "jogl.jar" which comes from JOGL 1 whereas JOGL supports Android only since its second version. Please use a more recent version of Jzy3D and do the same for JOGL and GlueGen. As far as I know, Jzy3D 0.8 doesn't support Android.

这篇关于如何使用Eclipse在Android中使用jzy3d?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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