示例#1
0
        int IComparable.CompareTo(object obj)
        {
            ThreeDPolygon ptest = (ThreeDPolygon)obj; // unbox
            float         sum1  = GetZSum(this);
            float         sum2  = GetZSum(ptest);

            if (sum1 > sum2)
            {
                return(1);
            }

            if (sum1 == sum2)
            {
                sum1 = GetXSum(this);
                sum2 = GetXSum(ptest);
                if (sum1 > sum2)
                {
                    return(1);
                }
            }

            if (sum1 == sum2)
            {
                sum1 = GetYSum(this);
                sum2 = GetYSum(ptest);
                if (sum1 > sum2)
                {
                    return(1);
                }
            }


            return(-1);
        }
示例#2
0
        object ICloneable.Clone()
        {
            ThreeDPolygon copyObject = new ThreeDPolygon();

            for (int i = 0; i < Vertices.Count; i++)
            {
                copyObject.Vertices.Add(((ICloneable)Vertices[i]).Clone());
            }

            return(copyObject);
        }
示例#3
0
        float GetYSum(ThreeDPolygon p)
        {
            float sum = 0.0f;

            for (int i = 0; i < Vertices.Count; i++)
            {
                sum += ((ThreeDPoint)p.Vertices[i]).Y;
            }

            return(sum);
        }
示例#4
0
 public void AddPolygon(ThreeDPolygon aPolygon)
 {
     Polygons.Add(aPolygon);
 }