예제 #1
0
 public void AddSample(Vector3 position, int index)
 {
     if (SamplesList.Count == 0)
     {
         SamplesList.Add(new BSPoint(position));
         Sorted2Indices.Add(index);
     }
     if (SamplesList.Find((a) =>
     {
         return(a.Position == position);
     }) == null)
     {
         SamplesList.Add(new BSPoint(position));
         Sorted2Indices.Add(index);
     }
 }
예제 #2
0
        void Sort()
        {
            List <BSIndexPoint> sortedPoints = new List <BSIndexPoint>();

            for (int i = 0; i < SamplesList.Count; ++i)
            {
                sortedPoints.Add(new BSIndexPoint(SamplesList[i], Sorted2Indices[i]));
            }
            sortedPoints.Sort((A, B) =>
            {
                if (A.Point.Position.X == B.Point.Position.X) // same, then compare Y
                {
                    if (A.Point.Position.Y == B.Point.Position.Y)
                    {
                        return(A.Point.Position.Z < B.Point.Position.Z ? 1 : -1);
                    }
                    else
                    {
                        return(A.Point.Position.Y < B.Point.Position.Y ? 1 : -1);
                    }
                }

                return(A.Point.Position.X < B.Point.Position.X ? 1 : -1);
            });

            Sorted2Indices.Clear();
            for (int i = 0; i < SamplesList.Count; ++i)
            {
                Sorted2Indices.Add(-1);
            }
            for (int sampleIndex = 0; sampleIndex < SamplesList.Count; ++sampleIndex)
            {
                SamplesList[sampleIndex]    = sortedPoints[sampleIndex].Point;
                Sorted2Indices[sampleIndex] = sortedPoints[sampleIndex].OriginalIndex;
            }
        }
예제 #3
0
 public void Reset()
 {
     ClearTriangles();
     ClearSamples();
     Sorted2Indices.Clear();
 }