public void DefineSigns() { int L = nodes.GetLength(0); Vector1[] dir_vector1 = new Vector1[L]; Vector1[] dir_vector2 = new Vector1[L]; Vector1[] dir_vector3 = new Vector1[L]; Vector1[] dir_vector4 = new Vector1[L]; v_sign = new int[L]; v_sign_1 = new int[L]; for (int i = 0; i < L; i++) { //dir_vector1[i] = core_node.position - nodes[i].position;// change this to constant? remember sign if (Math.Abs(nodes[i].position.x) < 1e-10) //redefined direction { dir_vector1[i] = new Vector1(-1.0); } else { dir_vector1[i] = new Vector1(1.0); } dir_vector2[i] = nodes[i].dir_vector; dir_vector3[i] = nodes[i].position - nodes[i].neighbours.Last().position; dir_vector4[i] = nodes[i].neighbours.Last().dir_vector; } for (int i = 0; i < L; i++) { v_sign[i] = Math.Sign(Vector1.Dot(dir_vector1[i], dir_vector2[i])); v_sign_1[i] = Math.Sign(Vector1.Dot(dir_vector3[i], dir_vector4[i])) * v_sign[i]; } }
protected void DefineSigns() { int L = nodes.GetLength(0); Vector1[] dir_vector1 = new Vector1[L]; Vector1[] dir_vector2 = new Vector1[L]; v_sign = new int[L]; for (int i = 0; i < L - 1; i++) { dir_vector1[i] = (nodes[i + 1].position - nodes[i].position); } for (int i = 0; i < L; i++) { nodes[i].defDirVector(); dir_vector2[i] = nodes[i].dir_vector; } if (L > 1) { dir_vector1[L - 1] = nodes[L - 1].position - nodes[L - 2].position; } else { dir_vector1[L - 1] = dir_vector2[L - 1]; } for (int i = 0; i < L; i++) { v_sign[i] = Math.Sign(Vector1.Dot(dir_vector1[i], dir_vector2[i])); } }
protected virtual void DefineSign() { Vector1 dir_vector1 = new Vector1(); Vector1 dir_vector2 = new Vector1(); // Positive direction is outflow from termianl node dir_vector1 = neighbour_node.position - core_node.position; dir_vector2 = core_node.dir_vector; v_sign[0] = Math.Sign(Vector1.Dot(dir_vector1, dir_vector2)); dir_vector2 = neighbour_node.dir_vector; v_sign[1] = Math.Sign(Vector1.Dot(dir_vector1, dir_vector2)); }
protected override void DefineSign() { Vector1 dir_vector1 = new Vector1(); Vector1 dir_vector2 = new Vector1(); dir_vector1 = core_node.position - core_node.neighbours.First().position; dir_vector2 = core_node.dir_vector; v_sign[0] = Math.Sign(Vector1.Dot(dir_vector1, dir_vector2)); dir_vector2 = core_node.neighbours.Last().dir_vector; v_sign[1] = Math.Sign(Vector1.Dot(dir_vector1, dir_vector2)); }