I want to randomly "scatter" sticks of length 1 like shown in the diagram.
I also want to count the sticks that touched the red lines.
My approach was to create normalized vectors that are oriented randomly in space.
The problem is that they are all at the origin and I am also not sure how to identify and count those who touch the red lines
a = [randn(), randn()];
line = a/norm(a) # Normalized vector in random direction
Aucun commentaire:
Enregistrer un commentaire