public void ReorderConnections() { int num; sConnection[] connectionArray = new sConnection[(this.ConnectionCount - 1) + 1]; double[] numArray = new double[(this.ConnectionCount - 1) + 1]; int num5 = this.ConnectionCount - 1; for (num = 0; num <= num5; num++) { modMath.sXY_int _int; clsGenerateMap.clsPassageNode other = this.Connections[num].GetOther(); _int.X = other.Pos.X - this.Pos.X; _int.Y = other.Pos.Y - this.Pos.Y; double angle = _int.ToDoubles().GetAngle(); int num6 = num - 1; int index = 0; while (index <= num6) { if (angle < numArray[index]) { break; } index++; } int num7 = index; for (int i = num - 1; i >= num7; i += -1) { connectionArray[i + 1] = connectionArray[i]; numArray[i + 1] = numArray[i]; } connectionArray[index] = this.Connections[num]; numArray[index] = angle; } int num8 = this.ConnectionCount - 1; for (num = 0; num <= num8; num++) { this.Connections[num] = connectionArray[num]; if (this.Connections[num].IsB) { this.Connections[num].Connection.PassageNodeB_ConnectionNum = num; } else { this.Connections[num].Connection.PassageNodeA_ConnectionNum = num; } } }
public void ReorderConnections() { int A = 0; int B = 0; int C = 0; sConnection[] NewOrder = new sConnection[ConnectionCount]; double[] AwayAngles = new double[ConnectionCount]; clsPassageNode OtherNode = default(clsPassageNode); sXY_int XY_int = new sXY_int(); double AwayAngle = 0; for ( A = 0; A <= ConnectionCount - 1; A++ ) { OtherNode = Connections[A].GetOther(); XY_int.X = OtherNode.Pos.X - Pos.X; XY_int.Y = OtherNode.Pos.Y - Pos.Y; AwayAngle = XY_int.ToDoubles().GetAngle(); for ( B = 0; B <= A - 1; B++ ) { if ( AwayAngle < AwayAngles[B] ) { break; } } for ( C = A - 1; C >= B; C-- ) { NewOrder[C + 1] = NewOrder[C]; AwayAngles[C + 1] = AwayAngles[C]; } NewOrder[B] = Connections[A]; AwayAngles[B] = AwayAngle; } for ( A = 0; A <= ConnectionCount - 1; A++ ) { Connections[A] = NewOrder[A]; if ( Connections[A].IsB ) { Connections[A].Connection.PassageNodeB_ConnectionNum = A; } else { Connections[A].Connection.PassageNodeA_ConnectionNum = A; } } }
public void Connection_Add(sConnection NewConnection) { if (NewConnection.IsB) { NewConnection.Connection.PassageNodeB_ConnectionNum = this.ConnectionCount; } else { NewConnection.Connection.PassageNodeA_ConnectionNum = this.ConnectionCount; } this.Connections = (sConnection[]) Utils.CopyArray((Array) this.Connections, new sConnection[this.ConnectionCount + 1]); this.Connections[this.ConnectionCount] = NewConnection; this.ConnectionCount++; }
public void Connection_Add(sConnection NewConnection) { if ( NewConnection.IsB ) { NewConnection.Connection.PassageNodeB_ConnectionNum = ConnectionCount; } else { NewConnection.Connection.PassageNodeA_ConnectionNum = ConnectionCount; } Array.Resize(ref Connections, ConnectionCount + 1); Connections[ConnectionCount] = NewConnection; ConnectionCount++; }