Ejemplo n.º 1
0
        private void CountPoint(PointF3 p)
        {
            for (int i = -5; i < 5; i++)
            {
                if (Math.Round(p.X / cellDelta) == i)
                {
                    xFreq[i + 5]++;
                }

                if (Math.Round(p.Y / cellDelta) == i)
                {
                    yFreq[-i + 4]++;
                }

                if (Math.Round(p.X / cellDelta) == i)
                {
                    for (int y = -5; y < 5; y++)
                    {
                        if (Math.Round(p.Y / cellDelta) == y)
                        {
                            for (int z = -5; z < 5; z++)
                            {
                                if (Math.Round(p.Z / cellDelta) == z)
                                {
                                    voxelFreq[i + 5, y + 5, z + 5]++;
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadPoints(object sender, EventArgs e)
        {
            var backup = points;

            points.Clear();

            try
            {
                using (StreamReader reader = new StreamReader("data.csv"))
                {
                    var message = reader.ReadToEnd();

                    var read_lines = message.Split(new[] { "; " }, StringSplitOptions.RemoveEmptyEntries);

                    foreach (var line in read_lines)
                    {
                        var arr = line.Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries).Select(float.Parse).ToArray();
                        var v   = new PointF3(arr[0], arr[1], arr[2]);

                        points.Add(v);
                    }
                }

                loadedFlag = true;
            }
            catch (IOException ex)
            {
                MessageBox.Show("Reader has done an oopsie!" + ex.Message);
                points = backup;
            }
        }
Ejemplo n.º 3
0
        private void Generate_Point()
        {
            var v = new PointF3((float)Math.Round(r.NextDouble(), 2),
                                (float)Math.Round(r.NextDouble(), 2),
                                (float)Math.Round(r.NextDouble(), 2));

            for (int _ = 0; _ < 3; _++)
            {
                switch (r.Next(0, 3))
                {
                case 0:
                    v.X *= -1;
                    break;

                case 1:
                    v.Y *= -1;
                    break;

                case 2:
                    v.Z *= -1;
                    break;
                }
            }

            points.Add(v);
        }