Click here to Skip to main content
15,889,867 members
Home / Discussions / Algorithms
   

Algorithms

 
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 
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 
a random point:
pt1=new Point(random(xmin, xmax), random(ymin, ymax));

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

a third point on the same line:
dist=random();
pt3=new Point(pt1.x+dist*(pt2.x-pt1.x), pt1.y+dist*(pt2.y-pt1.y));



----------------------------------------------
I made a few changes so it would compile in c#

On random i was getting:
random' is a 'variable' but is used like a 'method'

so i changed it to:
random.Next(xmin, xmax)

Then i had to define xmin and xmax as int
(i'm still a little unclear on how to use this)


then i changed
(pt1.x+dist*(pt2.x-pt1.x) to ((pt1.x+dist)*(pt2.x-pt1.x)

going back i have no idea why i did this Smile | :) but i changed it back and it works now

I don't want you to think i don't appreciate your help i just am a little lost on how this is working.



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 
Question[Message Deleted] Pin
#12310-May-07 20:05
#12310-May-07 20:05 
JokeRe: Integer Geometry Pin
CPallini11-May-07 4:18
mveCPallini11-May-07 4:18 
GeneralRe: Integer Geometry Pin
CPallini11-May-07 9:40
mveCPallini11-May-07 9:40 
GeneralRe: Integer Geometry Pin
CPallini31-May-07 20:31
mveCPallini31-May-07 20:31 

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.