Random Point on a line
I want to to pick a random X and Y coord on a line genererated with only the info given below. Here are the variables I have
MidPoint of the line (X,Y)
Angle of the line from the mid point (Radians)
Length of the entire line
I want a math algo that will pick a random point on this line with only the info given. Can someone help me? If your wondering it''s for a line emitter in my particle engine.
Horny Farmer (Jolly Rancher)
Well, generate a random number in the range [-Length/2, Length/2]. Use this number as distance from your center point:
Point = c + n * x0
where c is the center point, n is the number and x0 is the unity direction vector of your line (can be calculated from the angle).
Point = c + n * x0
where c is the center point, n is the number and x0 is the unity direction vector of your line (can be calculated from the angle).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement