mathgl java_使用C中的MathGL逐点绘制三维散点图(Draw point by point 3D scatter plot with MathGL in C)...

本文探讨如何在C语言而非C++中使用MathGL库,逐点绘制三维散点图来展示粒子模拟中的每个粒子位置。目前找到的示例都是C++的,而需要的是C语言接口。已知一个3D表面图的例子,但其数据结构不直接适用于粒子数组。问题在于如何将粒子结构体数组转换为MathGL所需的格式,并用mgl_dots函数正确绘制。
摘要由CSDN通过智能技术生成

I am building a particle simulation, and I want to display each particle's position as a dot in a 3D scatter plot using MathGL in C (not C++!). I am having trouble with the C interface.

So far I found two interesting examples:

A C++ example that seems to be close to what I want: http://mathgl.sourceforge.net/doc_en/Dots-sample.html (but this is in C++, I have been unable to find the C-equivalent)

This is a piece of C code that constructs a 3D surf plot with dots. #include

int main()

{

HMGL gr = mgl_create_graph(600,400);

HMDT a,x,y;

a = mgl_create_data_size(30,40,1);

x = mgl_create_data_size(30,1,1);

y = mgl_create_data_size(40,1,1);

mgl_data_modify(a,"pi*(1-2*x)*exp(-4*y^2-4*(2*x-1)^2)",0);

mgl_data_fill(x,-1.,1.,'x');

mgl_data_fill(y,0.,1.,'x');

mgl_

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值