public static void ComputeBoundingBox(ITurtleMesh m, out ITurtleVertex min, out ITurtleVertex max)
        {
            var minV = new TurtleVertex(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
            var maxV = new TurtleVertex(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);

            for (int i = 0; i < m.VertexCount; i++)
            {
                var v = m.VertexAt(i);

                if (minV.X > v.X)
                {
                    minV.X = v.X;
                }
                if (minV.Y > v.Y)
                {
                    minV.Y = v.Y;
                }
                if (minV.Z > v.Z)
                {
                    minV.Z = v.Z;
                }

                if (maxV.X < v.X)
                {
                    maxV.X = v.X;
                }
                if (maxV.Y < v.Y)
                {
                    maxV.Y = v.Y;
                }
                if (maxV.Z < v.Z)
                {
                    maxV.Z = v.Z;
                }
            }

            min = minV;
            max = maxV;
        }
Example #2
0
 public TurtleVertex(ITurtleVertex other)
     : this(other.X, other.Y, other.Z)
 {
 }
 public TurtleVertex(ITurtleVertex other) : this(other.X, other.Y, other.Z)
 {
 }