/// <summary> /// Marks all edges and nodes of this graph and returns the result as an array of Guids /// </summary> /// <returns>The resulting array of Guids</returns> public static Guid[] Mark(CurvesTopology top, Color verticesColor, Color edgesColor, Color diverterColor) { Guid[] dots = new Guid[top.VertexLength + top.EdgeLength]; ObjectAttributes oa = RhinoDoc.ActiveDoc.CreateDefaultAttributes(); oa.ColorSource = ObjectColorSource.ColorFromObject; //Graph vertices color for (int i = 0; i < top.VertexLength; i++) { if (top.NodeAt(i).IsDiverter) { oa.ObjectColor = diverterColor; dots[i] = RhinoDoc.ActiveDoc.Objects.AddTextDot(i.ToString(), top.VertexAt(i), oa); var sette = top.VertexAt(i); } else { oa.ObjectColor = verticesColor; dots[i] = RhinoDoc.ActiveDoc.Objects.AddTextDot(i.ToString(), top.VertexAt(i), oa); var sette = top.VertexAt(i); } } //Graph edges oa.ObjectColor = edgesColor; for (int i = 0; i < top.EdgeLength; i++) { var p = top.CurveAt(i).PointAtNormalizedLength(0.5); dots[i + top.VertexLength] = RhinoDoc.ActiveDoc.Objects.AddTextDot(i.ToString(), p, oa); } RhinoDoc.ActiveDoc.Views.Redraw(); return(dots); }
protected static double HeuristicEstimateDistance(CurvesTopology top, int to, int y) { return(top.VertexAt(y).DistanceTo(top.VertexAt(to))); }