Ejemplo n.º 1
0
        //public Vector3 GetPointInZ(float z)
        //{
        //    // Slow linear search. Khalas.
        //    int i = 0;
        //    for (; i < Positions.Length - 1; ++i)
        //    {
        //        // One point above, one below.
        //        if ((Positions[i].Z - z) * (Positions[i + 1].Z - z) <= 0)
        //            break;
        //    }
        //    if (i == Length - 2)
        //        return float.MaxValue;

        //    Vector3 p0 = Positions[i];
        //    Vector3 p1 = Positions[i + 1];
        //    float t = (position.Z - p0.Z) / (p1.Z - p0.Z);
        //    Vector3 zNearest = (1 - t) * p0 + t * p1;
        //    Debug.Assert(Math.Abs(position.Z - zNearest.Z) < 0.00000001f);

        //    return (position - zNearest).Length();
        //}
        public Line(Line cpy)
        {
            Positions = new Vector3[cpy.Length];
            Array.Copy(cpy.Positions, Positions, cpy.Length);
            if (cpy.Attribute != null)
            {
                Attribute = new float[cpy.Length];
                Array.Copy(cpy.Attribute, Attribute, cpy.Length);
            }
            Status     = cpy.Status;
            LineLength = cpy.LineLength;
        }
Ejemplo n.º 2
0
 //public Vector3 GetPointInZ(float z)
 //{
 //    // Slow linear search. Khalas.
 //    int i = 0;
 //    for (; i < Positions.Length - 1; ++i)
 //    {
 //        // One point above, one below.
 //        if ((Positions[i].Z - z) * (Positions[i + 1].Z - z) <= 0)
 //            break;
 //    }
 //    if (i == Length - 2)
 //        return float.MaxValue;
 //    Vector3 p0 = Positions[i];
 //    Vector3 p1 = Positions[i + 1];
 //    float t = (position.Z - p0.Z) / (p1.Z - p0.Z);
 //    Vector3 zNearest = (1 - t) * p0 + t * p1;
 //    Debug.Assert(Math.Abs(position.Z - zNearest.Z) < 0.00000001f);
 //    return (position - zNearest).Length();
 //}
 public Line(Line cpy)
 {
     Positions = new Vector3[cpy.Length];
     Array.Copy(cpy.Positions, Positions, cpy.Length);
     if(cpy.Attribute != null)
     {
         Attribute = new float[cpy.Length];
         Array.Copy(cpy.Attribute, Attribute, cpy.Length);
     }
     Status = cpy.Status;
     LineLength = cpy.LineLength;
 }