Как получить автоматически пересечение двух линейных координат (X, Y) в текстовом поле ? в visual studio 2012
Я не могу автоматически получить координаты точки пересечения в текстовом поле, но когда я перемещаю курсор рядом с точкой пересечения, он показывает координаты.
Что я уже пробовал:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using ZedGraph; namespace ZedGraphSample { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load( object sender, EventArgs e ) { CreateGraph( zg1 ); SetSize(); } private void CreateGraph( ZedGraphControl zgc ) { GraphPane myPane = zgc.GraphPane; // Set the titles and axis labels myPane.Title.Text = "My Test Graph"; myPane.XAxis.Title.Text = "X Value"; myPane.YAxis.Title.Text = "My Y Axis"; // Make up some data points from the Sine function PointPairList list = new PointPairList(); for ( double x = 0; x < 36; x++ ) { double y = Math.Sin( x * Math.PI / 15.0 ); list.Add( x, y ); } PointPairList list1 = new PointPairList(); for (double x1 = 0; x1 < 36; x1++) { double y1 = Math.Sin(x1 * Math.PI / 15.0); list1.Add(x1+1, y1); } // Generate a blue curve with circle symbols, and "My Curve 2" in the legend LineItem myCurve = myPane.AddCurve( "My Curve", list, Color.Green, SymbolType.Circle ); LineItem myCurve1 = myPane.AddCurve("My Curve1", list1, Color.Black, SymbolType.Circle); //// Fill the area under the curve with a white-red gradient at 45 degrees //myCurve.Line.Fill = new Fill( Color.White, Color.Red, 45F ); //// Make the symbols opaque by filling them with white //myCurve.Symbol.Fill = new Fill( Color.White ); //// Fill the axis background with a color gradient //myPane.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow, 45F ); //// Fill the pane background with a color gradient //myPane.Fill = new Fill( Color.White, Color.FromArgb( 220, 220, 255 ), 45F ); // Calculate the Axis Scale Ranges zgc.AxisChange(); } private void Form1_Resize( object sender, EventArgs e ) { SetSize(); } private void SetSize() { zg1.Location = new Point( 10, 10 ); // Leave a small margin around the outside of the control zg1.Size = new Size( this.ClientRectangle.Width - 20, this.ClientRectangle.Height - 20 ); } private void zg1_Load(object sender, EventArgs e) { } } }
Stefan_Lang
Что вы подразумеваете под "пересечением", "линией" и "координатами"?...
Ладно, теперь я понимаю, что ты имеешь в виду. Вам все равно следует зафиксировать формулировку названия вашей темы в чем-то вроде
"Как получить координаты пересечения линий из графической панели?", потому что именно это вы, судя по вашему коду и описанию, пытаетесь сделать.
Richard Deeming
Это математическая проблема, а не программная.
Вам нужно решить эту проблему:
Sin(x * π / 15) == Sin((x - 1) * π / 15)