+-

我一直在用C#做三维散点图的研究.到目前为止,我已经找到了一个对我有用的 library.但是,不一定像我需要的那样灵活.由于我所需要的只是创建一个固定的三维散点图,在C#中使用Point3D结构或其他任何不需要我引入第三方库并且可能允许更好的灵活性的替代方案还有其他替代方法吗?
最佳答案
我已经设法用 ILNumerics创建一个3D散点图:
var colors
= new[] { Color.Red, Color.Black, Color.Blue, Color.Green /*...*/ };
ILArray<float> data = ILMath.zeros<float>(
3,
colors.Length);
ILArray<float> colorData = ILMath.zeros<float>(
3,
colors.Length);
int index = 0;
foreach (var p in colors)
{
data[0, index] = p.GetHue();
data[1, index] = p.GetSaturation();
data[2, index] = p.GetBrightness();
colorData [0, index] = p.R / 255.0f;
colorData [1, index] = p.G / 255.0f;
colorData [2, index] = p.B / 255.0f;
index++;
}
var points = new ILPoints()
{
Positions = data,
Colors = colorData
};
points.Color = null;
var plot = new ILPlotCube(twoDMode: false)
{
Rotation = Matrix4.Rotation(new Vector3(1, 1, 0.1f), 0.4f),
Projection = Projection.Orthographic,
Children = { points }
};
plot.Axes[0].Label.Text = "Hue";
plot.Axes[1].Label.Text = "Saturation";
plot.Axes[2].Label.Text = "Brightness";
this.ilPanel1.Scene = new ILScene { plot };
相当容易学习和使用,但我的显卡有一些严重的问题(它是英特尔®处理器显卡2000,所以我不怪他们……) – 只有GDI渲染器工作,性能不是非常惊人.
点击查看更多相关文章
转载注明原文:c# – 如何创建3D散点图? - 乐贴网