See more:
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
Posted 19 May '12 - 12:30
Makbg494

## Solution 3

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; }
}```

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[^]

## Solution 1

Why not just store them in a three dimensional matrix[^]: Multidimensional Arrays (C# Programming Guide)[^].

Regards,

Manfred

## Solution 4

Thanks everyone,
I solved this by using an IList of MyPoint and MyPoint is a class that I made which holds 3 coordinates(x,y,z)

## Solution 2

1. Solution one

// 1) Create Coordinate class. However, you may make a struct as well.
public class Coordinate
{
public int x;
public int y;
public int z;

public Coordinate()
{

}

public int X
{
get { return x; }
set { this.x = value; }
}

public int Y
{
get { return y; }
set { this.y = value; }
}

public int Z
{
get { return z; }
set { this.z = value; }
}
}

// 2 Create instance of Coordinate List
List<coordinate> xyz = new List<coordinate>(); // see System.Collections.Generic namespace

// Create instance of coordinate object
Coordinate cor = new Coordinate();

// Then, add the points to the coordinate object
cor.X = 12;
cor.Y = 24;
cor.Z = 32;
// ......// Repeat this as many times

// 3) Now you hold many points in the list

2. Solution Two

You mentioned that you are getting these points (x, y, z) from a depth image. In general,
for example, if you have an image with size of 1024 x 1024, you may have many many points. In this case the solution above is not working or not working efficiently. The best way is: you may create an image with 3 layers (or three dimensional array), just like RGB images. Each layer (or band) of the RGB image holds x, y, or z points, respectively. However, we need to know the dinamic ranges of your values. You may use "PixelFormat.Format48bppRgb" image to hold these points. This image has value ranges from 0 to 65535.
You may find some usefull DLL from here:
http://www.artuxsoft.com/[^]

 Interested Ignored

 0 Sergey Alexandrovich Kryukov 518 1 Arun Vasu 315 2 Maciej Los 218 3 OriginalGriff 205 4 Aarti Meswania 170
 0 Sergey Alexandrovich Kryukov 9,670 1 OriginalGriff 7,409 2 CPallini 3,968 3 Rohan Leuva 3,352 4 Maciej Los 2,861

Web02 | 2.6.130523.1 | Last Updated 25 May 2012