private static float DistanceToPoint(SideDataControl s, Vector2 point) { var p1 = GetPivot(s.getStart()); var p2 = GetPivot(s.getEnd()); return(HandleUtility.DistancePointToLineSegment(point, p1, p2)); }
public override bool doTool() { newSide = trajectory.addSide(startNode.getID(), endNode.getID(), -1); if (newSide != null) { newSideDataControl = new SideDataControl(sceneDataControl, trajectoryDataControl, newSide); trajectoryDataControl.getSides().Add(newSideDataControl); return(true); } return(false); }
private Rect[] GetEditingRects(SideDataControl side) { var p1 = GetPivot(side.getStart()); var p2 = GetPivot(side.getEnd()); lengthContent.text = side.getLength().ToString(); Rect rect = new Rect(); rect.size = GUI.skin.textField.CalcSize(lengthContent); rect.center = (p1 + p2) / 2f; var deleteRect = rect; deleteRect.position += new Vector2(deleteRect.size.x, 0); deleteRect.size = new Vector2(deleteRect.size.y, deleteRect.size.y); return(new Rect[] { rect, deleteRect }); }
private bool IsPairingStartOrEnd(SideDataControl s, NodeDataControl node) { return((s.getStart() == pairing && s.getEnd() == node) || (s.getEnd() == pairing && s.getStart() == node)); }
public DeleteTrajectorySideTool(SideDataControl dataControl, Trajectory trajectory, TrajectoryDataControl trajectoryDataControl) { this.sideDataControl = dataControl; this.trajectory = trajectory; this.trajectoryDataControl = trajectoryDataControl; }