Click here to Skip to main content
15,914,111 members
Home / Discussions / Algorithms
   

Algorithms

 
JokeRe: Line through X Pin
Luc Pattyn14-May-07 1:02
sitebuilderLuc Pattyn14-May-07 1:02 
GeneralRe: Line through X Pin
El Corazon14-May-07 7:01
El Corazon14-May-07 7:01 
JokeRe: Line through X Pin
CPallini15-May-07 1:41
mveCPallini15-May-07 1:41 
GeneralRe: Line through X Pin
crash89314-May-07 7:00
crash89314-May-07 7:00 
GeneralRe: Line through X Pin
Luc Pattyn14-May-07 7:11
sitebuilderLuc Pattyn14-May-07 7:11 
GeneralRe: Line through X Pin
crash89314-May-07 7:40
crash89314-May-07 7:40 
GeneralRe: Line through X Pin
crash89314-May-07 7:42
crash89314-May-07 7:42 
GeneralRe: Line through X Pin
crash89314-May-07 12:54
crash89314-May-07 12:54 
private void button2_Click(object sender, EventArgs e)
{
Random random = new Random();
//random.Next(min, max);


int xmin, xmax, ymin,ymax;
xmin = Convert.ToInt16( textBox1.Text);
xmax = Convert.ToInt16(textBox2.Text);
ymin = Convert.ToInt16(textBox1.Text);
ymax = Convert.ToInt16(textBox2.Text);
//a random point:
Point pt1 = new Point(random.Next(xmin, xmax), random.Next(ymin, ymax));

//a second point in random direction, random distance (hence completely random):
Point pt2 = new Point(random.Next(xmin, xmax), random.Next(ymin, ymax));

//a third point on the same line:
int dist = random.Next(xmin, xmax);

Point pt3 = new Point((pt1.X + dist) * (pt2.X - pt1.X), (pt1.Y + dist) * (pt2.Y - pt1.Y));

textBox3.Text = pt3.X.ToString();
textBox4.Text = pt3.Y.ToString();

textBox5.Text = pt1.X.ToString();
textBox6.Text = pt1.Y.ToString();

textBox7.Text = pt2.X.ToString();
textBox8.Text = pt2.Y.ToString();


}


I got to at least compile in c# but as I'm watching it i still think its backwards

how can I define X first.
GeneralRe: Line through X Pin
Luc Pattyn14-May-07 13:02
sitebuilderLuc Pattyn14-May-07 13:02 
GeneralRe: Line through X Pin
crash89314-May-07 13:04
crash89314-May-07 13:04 
GeneralRe: Line through X Pin
Luc Pattyn14-May-07 13:30
sitebuilderLuc Pattyn14-May-07 13:30 
GeneralRe: Line through X Pin
crash89314-May-07 17:00
crash89314-May-07 17:00 
GeneralRe: Line through X Pin
Luc Pattyn14-May-07 20:23
sitebuilderLuc Pattyn14-May-07 20:23 
GeneralRe: Line through X Pin
crash89315-May-07 6:00
crash89315-May-07 6:00 
GeneralRe: Line through X Pin
Luc Pattyn15-May-07 6:59
sitebuilderLuc Pattyn15-May-07 6:59 
GeneralRe: Line through X Pin
crash89315-May-07 7:24
crash89315-May-07 7:24 
Generalnew attempt Pin
crash89315-May-07 12:01
crash89315-May-07 12:01 
GeneralRe: new attempt2 Pin
crash89315-May-07 12:42
crash89315-May-07 12:42 
AnswerRe: Line through X Pin
Michael Sadlon22-May-07 12:01
Michael Sadlon22-May-07 12:01 
GeneralRe: Line through X Pin
crash89322-May-07 16:48
crash89322-May-07 16:48 
GeneralRe: Line through X Pin
crash89322-May-07 16:51
crash89322-May-07 16:51 
GeneralRe: Line through X Pin
cp987622-May-07 17:37
cp987622-May-07 17:37 
GeneralRe: Line through X Pin
crash89322-May-07 19:57
crash89322-May-07 19:57 
GeneralRe: Line through X Pin
cp987622-May-07 20:15
cp987622-May-07 20:15 
GeneralRe: Line through X Pin
crash89329-May-07 15:33
crash89329-May-07 15:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.