Algorithm 5 Generate Random Point on Line |
-
1:
function GenerateRandomPointOnLine(point_a, point_b, randomness)
-
2:
Random number between 0 and 1
-
3:
-
4:
-
5:
Calculate the directional difference , between and
-
6:
Determine perpendicular direction ,
-
7:
Normalize the perpendicular direction
-
8:
Calculate based on
-
9:
Adjust x, y coordinates by applying in the perpendicular direction
-
10:
return
x, y
-
11:
end function
|