public void IterateEllipseGrid(ViewportAxis xAxis, ViewportAxis yAxis, Action <double, double, double, double> drawGridAction, bool major) { if (xAxis == null || yAxis == null) { return; } var xInterval = ToViewInterval(xAxis); var yInterval = ToViewInterval(yAxis); var minStep = major ? MinMajorStep : MinStep; var xmstep = AxisHelper.GetStep(xAxis, minStep); var ymstep = AxisHelper.GetStep(yAxis, minStep); var x0 = ToClient(xAxis, 0); var y0 = ToClient(yAxis, 0); var xmax = Math.Max(Math.Abs(xInterval.Start), Math.Abs(xInterval.End)); var ymax = Math.Max(Math.Abs(yInterval.Start), Math.Abs(yInterval.End)); var rmax = Math.Sqrt(xmax * xmax + ymax * ymax); for (double x = xmstep, y = ymstep; x <= rmax || y <= rmax; x += xmstep, y += ymstep) { var cx = Math.Abs(ToClient(xAxis, x) - x0); var cy = Math.Abs(ToClient(yAxis, y) - y0); drawGridAction.Invoke(x0, y0, cx, cy); } }
public void IterateRadiusGrid(ViewportAxis xAxis, ViewportAxis yAxis, Action <double, double, double, double> drawGridAction, bool major) { if (xAxis == null || yAxis == null) { return; } var xInterval = ToViewInterval(xAxis); var yInterval = ToViewInterval(yAxis); var x0 = ToClient(xAxis, 0); var y0 = ToClient(yAxis, 0); var xmax = Math.Max(Math.Abs(xInterval.Start), Math.Abs(xInterval.End)); var ymax = Math.Max(Math.Abs(yInterval.Start), Math.Abs(yInterval.End)); var rmax = Math.Sqrt(xmax * xmax + ymax * ymax); double angleStep; if (major) { angleStep = Math.PI * 40 / 180; } else { angleStep = Math.PI * 10 / 180; } for (double angle = 0; angle < 2 * Math.PI; angle += angleStep) { var cx = ToClient(xAxis, rmax * Math.Cos(angle)); var cy = ToClient(yAxis, rmax * Math.Sin(angle)); drawGridAction.Invoke(x0, y0, cx, cy); } }
private void RealignViewports() { if (this.mount != null) { this.mount.AlignViewports(this.me.Settings.ViewportAxis); } this.settingsViewportAxis = this.me.Settings.ViewportAxis; }
protected static Interval ToViewInterval(ViewportAxis axis) { var v = axis.View; var s = v.Start; var e = v.End; return(new Interval(Math.Min(s, e), Math.Max(s, e))); }
private void InitalizeSpChart(ChartControl chart, ViewportAxis xAxis) { chart.VerticalAxis = new Log10Axis { IsReversed = true }; chart.HorizontalAxis = xAxis; chart.LeftAxis.MarkProvider = new Log10MarkProvider(); chart.BottomAxis.MarkProvider = new Log10MarkProvider(); chart.Canvas.LeftMarkProvider = chart.LeftAxis.MarkProvider; chart.Canvas.BottomMarkProvider = chart.BottomAxis.MarkProvider; chart.TopAxis.Visibility = Visibility.Hidden; chart.RightAxis.Visibility = Visibility.Hidden; chart.ToolCollection.Add(new PanTool()); chart.ToolCollection.Add(new ZoomTool()); }
public static double GetStep(ViewportAxis axis, double minStep) { var mstep = Math.Abs(ToValue(axis, minStep) - ToValue(axis, 0)); var pow = Math.Floor(Math.Log10(mstep)); //степень шага if (mstep <= 2 * Math.Pow(10, pow)) { //если модельный шаг в диапазоне (1; 2] * 10^"степень шага" - округляем до шага 2 mstep = 2 * Math.Pow(10, pow); } else if (mstep <= 5 * Math.Pow(10, pow)) { //если в диапазоне от (2, 5] * 10^"степень шага" - округляем с шагом 5 mstep = 5 * Math.Pow(10, pow); } else //если (5, 10] * 10^"степень шага" - с шагом 10 { mstep = 10 * Math.Pow(10, pow); } return(mstep); }
public void AlignViewports(ViewportAxis axis) { ProjectorEmitter[] ordered = GetOrdered(); float steps = 1f / ordered.Length; switch (axis) { case ViewportAxis.X: for (int i = 0; i < ordered.Length; ++i) { ordered[i].GetComponent <Camera>().rect = new Rect(steps * i, 0f, steps, 1f); } break; case ViewportAxis.Y: for (int i = 0; i < ordered.Length; ++i) { ordered[i].GetComponent <Camera>().rect = new Rect(0f, steps * i, 1f, steps); } break; } }
public static void AlignViewports(ProjectorEmitter[] emitters, ViewportAxis axis) { float steps = 1f / emitters.Length; float offset = 0f; switch (axis) { case ViewportAxis.X: for (int i = 0; i < emitters.Length; ++i) { emitters[i].GetComponent <Camera>().rect = new Rect(offset, 0f, steps, 1f); offset += steps; } break; case ViewportAxis.Y: for (int i = 0; i < emitters.Length; ++i) { emitters[i].GetComponent <Camera>().rect = new Rect(0f, offset, 1f, steps); offset += steps; } break; } }
protected static double ToValue(ViewportAxis axis, double client) { return(axis.ClientToView(client)); }
protected static double ToClient(ViewportAxis axis, double value) { return(axis.ViewToClient(value)); }
public void IterateMarks(ViewportAxis xAxis, ViewportAxis yAxis, DrawingContext dc, Action <DrawingContext, double, string> action) { }
private static double ToClient(ViewportAxis axis, double value) { return(axis.ViewToClient(value)); }