my program is creating random points on the circle. And I want to keep these points in a array respectively. For example, first I choose a random points (for example , let it be p1) and then I will sort them clockwise and I will add in a array.
This my program output example
And also I am sharing my program codes, may be you want to see that.
public void producePoint()
{
double angle;
PointF org = new PointF(250, 250);
float rad = 250;
for (int i = 0; i < Int32.Parse(totalTextBox.Text); i++)
{
points[i] = new Points();
angle = random.Next(0, 360);
points[i].name = "P" + i.ToString();
points[i].coordX = (float)(rad * Math.Cos(angle * Math.PI / 180F)) + org.X + area.X+10;
points[i].coordY = (float)(rad * Math.Sin(angle * Math.PI / 180F)) + org.Y + area.Y+10;
}
}
public void DrawLine(string a , string b)
{
Points point1 = new Points();
Points point2 = new Points();
for (int i = 0; i < Int32.Parse(totalTextBox.Text); i++)
{
if (points[i].name == a)
{
point1 = points[i];
}
if (points[i].name == b)
{
point2 = points[i];
}
if (a == b)
{
point1 = point2;
}
}
private void drawL_Click(object sender, EventArgs e)
{
if (firstPointComboBox.SelectedItem == null || secondPointComboBox.SelectedItem == null)
{
MessageBox.Show("Please,choose points");
}
else
{
DrawLine(firstPointComboBox.SelectedItem.ToString(), secondPointComboBox.SelectedItem.ToString());
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…