我一直在研究使用C#制作3D散点图的内容。到目前为止,我找到了一个库,有些东西对我来说还算有用。但是它并不像我需要的那样灵活。由于我只需要创建一个固定的3D散点图,是否有其他使用 C# 中的
Point3D
结构或其他不需要引入第三方库的替代方案,并可提供更好的灵活性呢?Point3D
结构或其他不需要引入第三方库的替代方案,并可提供更好的灵活性呢?我已经用ILNumerics创建了一个三维散点图:
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 渲染器,性能不是很出色。
ILNumerics
库相比,它的优点包括:
Point3D
)目前HypnoLog没有内置的3D散点图可视化器,但是您可以轻松创建自己的可视化器。我建议使用plotly 3D Scatter Plots。 HypnoLog将帮助您将数据从C#应用程序发送到您在浏览器中创建的可视化器。请参阅HypnoLog-CSharp库,以便在C#中轻松使用HypnoLog。