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

Algorithms

 
GeneralRe: Password security Algorithm needed Pin
cmk22-May-07 20:21
cmk22-May-07 20:21 
AnswerRe: Password security Algorithm needed Pin
ekynox29-May-07 17:09
ekynox29-May-07 17:09 
QuestionIntel MKL Pin
spin vector15-May-07 12:45
spin vector15-May-07 12:45 
AnswerRe: Intel MKL Pin
djlove17-May-07 0:11
djlove17-May-07 0:11 
GeneralRe: Intel MKL Pin
spin vector17-May-07 15:51
spin vector17-May-07 15:51 
AnswerRe: Intel MKL Pin
Trevor Misfeldt4-Jun-09 18:01
Trevor Misfeldt4-Jun-09 18:01 
QuestionLine through X Pin
crash89313-May-07 23:35
crash89313-May-07 23:35 
AnswerRe: Line through X [modified] Pin
Luc Pattyn14-May-07 0:28
sitebuilderLuc Pattyn14-May-07 0:28 
Hi,

you want 3 points, and you have 5 degrees of freedom, since the only restriction is
the points must be colinear. So we call a "random" function 5 times:

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));

BTW you may want to limit the range of dist so pt3 also falls within the borders.

Smile | :)

-- modified at 6:59 Monday 14th May, 2007

Luc Pattyn

[My Articles]

JokeRe: Line through X Pin
CPallini14-May-07 0:44
mveCPallini14-May-07 0:44 
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 
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 

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.