rhirno.geometry vector 2d ?
processing -> rhino.geometry
a = random.uniform(0,1)
dir = rg.Vector2d.Zero
dir.X = cos(a)
dir.Y=sin(a)
i want to change the value of the dir.X.
is it possible?
print(dir) -----> (cos(a),sin(a))
rhirno.geometry vector 2d ?
processing -> rhino.geometry
a = random.uniform(0,1)
dir = rg.Vector2d.Zero
dir.X = cos(a)
dir.Y=sin(a)
i want to change the value of the dir.X.
is it possible?
print(dir) -----> (cos(a),sin(a))
Hi,
Wut? Sure?
import math
import random
import Rhino.Geometry as rg
dir = rg.Vector2d.Zero
# The X and Y properties get or set the x- or y-coordinate of the Vector2d
# Also no need to use random.uniform(), since random.random() returns a float between 0 and 1
dir.X = math.cos(random.random())
dir.Y = math.sin(random.random())
print dir # Python 2.7 uses print instead of print()
You can also achieve this in a single line, like so:
dir = rg.Vector2d(math.cos(random.random()), math.sin(random.random()))
print dir
Hm, judging from your code example and print statement, it seems like you also want to change Y?
wow… thank you again
Thank you so much
I’m doing it the way I told you last time.
It really helps.
I am trying again with the answer I received in the last question.
Thanks for your kind answer.