public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append('{');

            WriteName(sb, "V0");
            sb.Append(V0.ToString() + ",");
            WriteName(sb, "V1");
            sb.Append(V1.ToString() + ",");
            WriteName(sb, "V2");
            sb.Append(V2.ToString() + ",");
            WriteName(sb, "V3");
            sb.Append(V3.ToString() + ",");
            WriteName(sb, "V4");
            sb.Append(V4.ToString() + ",");
            WriteName(sb, "V5");
            sb.Append(V5.ToString() + ",");
            WriteName(sb, "V6");
            sb.Append(V6.ToString() + ",");
            WriteName(sb, "V7");
            sb.Append(V7.ToString() + ",");
            WriteName(sb, "V8");
            sb.Append(V8.ToString() + ",");
            WriteName(sb, "V9");
            sb.Append(V9.ToString() + ",");
            sb.Length--;

            sb.Append('}');
            return(sb.ToString());
        }
Exemple #2
0
 /// <summary>
 /// Compare two triangles and return true if equal
 /// </summary>
 /// <param name="tri">the other triangles to compare with</param>
 /// <returns>true if the two triangles equals, false otherwise</returns>
 public bool Equals(Triangle2DF tri)
 {
     return
         ((V0.Equals(tri.V0) || V0.Equals(tri.V1) || V0.Equals(tri.V2)) &&
          (V1.Equals(tri.V0) || V1.Equals(tri.V1) || V1.Equals(tri.V2)) &&
          (V2.Equals(tri.V0) || V2.Equals(tri.V1) || V2.Equals(tri.V2)));
 }
Exemple #3
0
 public Edge(Map map, int id, int v0ID, int v1ID)
 {
     this.map     = map;
     ID           = id;
     V0ID         = v0ID;
     V1ID         = v1ID;
     MST          = false;
     Type         = EdgeType.NONE;
     isDiscovered = false;
     V0.OnEdgeConnected(this);
     V1.OnEdgeConnected(this);
 }
Exemple #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     chart1.Series.Add((++ser).ToString());
     chart1.Series[ser].ChartType   = SeriesChartType.Line;
     chart1.Series[ser].BorderWidth = 3;
     chart1.Series[ser].Name        = "实际速度曲线" + ser.ToString() + " " + V0.ToString();
     fspeed      = V0;
     jiasudu     = hjjsd;
     label7.Text = jiasudu.ToString();
     timer1.Start();
     timer1.Enabled = true;
 }
Exemple #5
0
 public void Dispose()
 {
     if (V0 != null)
     {
         V0.Dispose();
     }
     if (V1 != null)
     {
         V1.Dispose();
     }
     if (_uploader != null)
     {
         _uploader.Dispose();
     }
 }
Exemple #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            hjjsd = Convert.ToInt16(setting.textBox6.Text);
            hjsd  = Convert.ToInt16(setting.textBox3.Text);
            V0    = (float)Convert.ToInt16(setting.chusudu.Text);

            chart1.Series.Add((++ser).ToString());
            chart1.Series[ser].ChartType   = SeriesChartType.Line;
            chart1.Series[ser].BorderWidth = 3;
            chart1.Series[ser].Name        = "实际速度曲线" + ser.ToString() + " " + V0.ToString();

            fspeed = V0;

            jiasudu     = hjjsd;
            label7.Text = jiasudu.ToString();
            timer1.Start();
            timer1.Enabled = true;
        }
        public List <Vector2> CommonEdge(Triangle other)
        {
            List <Vector2> commonPoints = new List <Vector2>();

            if (V0.Equals(other.V0) || V0.Equals(other.V1) || V0.Equals(other.V2))
            {
                commonPoints.Add(V0);
            }

            if (V1.Equals(other.V0) || V1.Equals(other.V1) || V1.Equals(other.V2))
            {
                commonPoints.Add(V1);
            }

            if (V2.Equals(other.V0) || V2.Equals(other.V1) || V2.Equals(other.V2))
            {
                commonPoints.Add(V2);
            }

            return(commonPoints);
        }
Exemple #8
0
        public static void EigenSolve(Matrix4x4 D, out Vector3 S, out Matrix4x4 V)
        {
            // D is symmetric
            // S is a vector whose elements are eigenvalues
            // V is a matrix whose columns are eigenvectors
            S = EigenValues(D);
            Vector3 V0, V1, V2;

            if (S[0] - S[1] > S[1] - S[2])
            {
                V0 = EigenVector(D, S[0]);
                if (S[1] - S[2] < Mathf.Epsilon)
                {
                    V2 = V0.unitOrthogonal();
                }
                else
                {
                    V2 = EigenVector(D, S[2]); V2 -= V0 * Vector3.Dot(V0, V2); V2 = Vector3.Normalize(V2);
                }
                V1 = Vector3.Cross(V2, V0);
            }
            else
            {
                V2 = EigenVector(D, S[2]);
                if (S[0] - S[1] < Mathf.Epsilon)
                {
                    V1 = V2.unitOrthogonal();
                }
                else
                {
                    V1 = EigenVector(D, S[1]); V1 -= V2 * Vector3.Dot(V2, V1); V1 = Vector3.Normalize(V1);
                }
                V0 = Vector3.Cross(V1, V2);
            }

            V = Matrix4x4.identity;
            V.SetColumn(0, V0);
            V.SetColumn(1, V1);
            V.SetColumn(2, V2);
        }
Exemple #9
0
        /******************************************************************************/
        /**@brief Returns the speed at some position x                                */
        /******************************************************************************/
        public override SiSpeed Get(SiDistance x)
        {
            if (x > X.X1)
            {
                throw new ArgumentException();
            }
            if (x < X.X0)
            {
                throw new ArgumentException();
            }

            if (Math.Abs(A.ToUnits()) > 0.0)
            {
                SiDistance dx = x - D0;
                SiSpeed    v  = new SiSpeed(Math.Sqrt((V0.ToUnits() * V0.ToUnits()) + (2.0 * A.ToUnits() * dx.ToUnits())));
                return(v);
            }
            else
            {
                return(V0);
            }
        }
Exemple #10
0
        public static void EigenSolve(float3x3 D, out float3 S, out float3x3 V)
        {
            // D is symmetric
            // S is a vector whose elements are eigenvalues
            // V is a matrix whose columns are eigenvectors
            S = EigenValues(D);
            float3 V0, V1, V2;

            if (S[0] - S[1] > S[1] - S[2])
            {
                V0 = EigenVector(D, S[0]);
                if (S[1] - S[2] < math.FLT_MIN_NORMAL)
                {
                    V2 = V0.unitOrthogonal();
                }
                else
                {
                    V2 = EigenVector(D, S[2]); V2 -= V0 * math.dot(V0, V2); V2 = math.normalize(V2);
                }
                V1 = math.cross(V2, V0);
            }
            else
            {
                V2 = EigenVector(D, S[2]);
                if (S[0] - S[1] < math.FLT_MIN_NORMAL)
                {
                    V1 = V2.unitOrthogonal();
                }
                else
                {
                    V1 = EigenVector(D, S[1]); V1 -= V2 * math.dot(V2, V1); V1 = math.normalize(V1);
                }
                V0 = math.cross(V1, V2);
            }

            V.c0 = V0;
            V.c1 = V1;
            V.c2 = V2;
        }
Exemple #11
0
        public override bool Equals(object obj)
        {
            var other = (Triangle)obj;

            return(V0.Equals(other.V0) && V1.Equals(other.V1) && V2.Equals(other.V2));
        }
Exemple #12
0
 public Vector2[] Download()
 {
     V0.GetData(_velocities);
     return(_velocities);
 }
Exemple #13
0
 public override int GetHashCode()
 {
     return(V0.GetHashCode() ^ V1.GetHashCode());
 }