private void AddPath(object e) { ComboBox cb = (ComboBox)e; if (cb.SelectedIndex == -1) { return; } AddPath(UtilityStuff.IndexInGraph(selectedNode, graph), cb.SelectedIndex, isPathTwoWay, UtilityStuff.Dist(graph.TheGraph[UtilityStuff.IndexInGraph(selectedNode, graph)], Graph[cb.SelectedIndex])); }
private static double Heuristic(Node current, Node end, bool useActualLen) { if (useActualLen) { return(UtilityStuff.Dist(current, end)); } else { return(1); } }
private void TransformSelectedElementsRot(double rot) { Vector2 p; foreach (var shape in selectedElements) { Debug.WriteLine(shape.Name + " angl offset: " + UtilityStuff.GetAngleFromOrbit(new Vector2(selectedElement.X, selectedElement.Y), new Vector2(shape.X, shape.Y))); p = UtilityStuff.GetOrbitPos(rot + UtilityStuff.GetAngleFromOrbit(new Vector2(selectedElement.X, selectedElement.Y), new Vector2(shape.X, shape.Y)), UtilityStuff.Vector2Dist(new Vector2(selectedElement.X, selectedElement.Y), new Vector2(shape.X, shape.Y))); shape.X = selectedElement.X + p.X; shape.Y = selectedElement.Y + p.Y; Debug.WriteLine(shape.X.ToString() + " / " + shape.Y.ToString()); } }
private void SelectMultipleElements(ListBox listBox) { Debug.WriteLine(listBox.SelectedItems.Count); selectedElements = new List <VectorShapeModel>(); foreach (VectorShapeModel shape in listBox.SelectedItems) { selectedElements.Add(shape); } if (selectedElements == null || selectedElements.Count == 0) { Debug.WriteLine("selected elementS is null"); return; } Debug.WriteLine("Selected elements count: " + selectedElements.Count); System.Drawing.Point avg = UtilityStuff.GetAveragePosOfShapes(selectedElements); selectedElement = new VectorShapeModel(avg.X, avg.Y, 0, Color.FromRgb(255, 0, 0), layers[0]); multipleSelectedElements = true; OnPropetyChangedSelectedElement(); transformVisibility = Visibility.Visible; OnPropertyChanged("TransformVisibility"); }
private static void CalculateScore(Node node, Node end) { Debug.WriteLine(node.Name + " dist|weight " + UtilityStuff.Dist(end, node) * 0.8f + " | " + (node.Weight * 0.6f)); score[node.Name] = UtilityStuff.Dist(end, node) * 0.8f + (node.Weight * 0.6f); }