存储一组3维点 [英] Storing a set of 3 dimensional points
问题描述
大家好,
我正在为我的大学做一个项目,但我有点迷茫.我想按顺序存储一组点,每个点都有3个坐标(x,y,z).我是从kinect给出的深度图像中获取这些坐标的,无论如何,我的问题是:在c#和wpf中存储这些坐标的最佳方法是什么?我曾想过制作一系列结构,但找不到正确的方法,所以请快速帮我
在此先感谢
Hello everyone,
I''m doing a project for my university and I''m a little lost. I want to store a set of points in order, each point has 3 coordinates (x,y,z) . I''m getting these coordinates from the depth image given by the kinect, anyway my question is: What is the best way to store these coordinates in c# and wpf ? I thought of making an array of structs but couldn''t find the right way to do that so please help me fast
Thanks in advance
推荐答案
首先,我不会使用类,而会使用结构.这不必包含任何字符串,因此不需要使用堆:
First of all I would not use a class, I would use a struct. This does not have to contain any strings so does not need to use the heap:
public struct Point3
{
public Point3(double x, double y, double z)
{
X = x; Y = y; Z = z;
}
public double X { get; set; }
public double Y { get; set; }
public double Z { get; set; }
}
您还可以使用Microsoft.XNA.Framework Vector3,它将包含所有其他方法.请参阅 http://msdn.microsoft.com/en-us/library/microsoft .xna.framework.vector3_members.aspx [ ^ ]
You could also use the Microsoft.XNA.Framework Vector3 which will include all the extra methods. See http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.vector3_members.aspx[^]
为什么不将它们存储在三个维度 al 矩阵 [多维数组(C#编程指南) [
Why not just store them in a three dimensional matrix[^]: Multidimensional Arrays (C# Programming Guide)[^].
Regards,
Manfred
谢谢大家,
我通过使用IList< mypoint>解决了此问题. MyPoint和MyPoint是我制作的一个类,它包含3个坐标(x,y,z)
Thanks everyone,
I solved this by using an IList<mypoint> of MyPoint and MyPoint is a class that I made which holds 3 coordinates(x,y,z)
这篇关于存储一组3维点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!