How to make a unitized vector a vector? So, I can multiply it with a certain length like with the component ‘amplitude.’
Unitize is a method (does that require parenthesis in Python?) and doesn’t return a unitized vector, but rather unitizes the vector it is called on. In C# this would look like:
var yvector = ypn - plpn; // Assuming ypn and plpn are Point3d yvector.Unitize();
Do you might know how I make a vector length ‘1’ in python?
yvector will be length 1.0 after you invoke Unitize(). Unless yVector was zero-length or unset to begin with, in which case Unitize cannot work.
owwwwwwwwwww, I get it
EDIT: no I do not get it,
when I do ‘Unitize()’ I got only True
EDIT: no, I think I got it, thank you
This confuses me too sometimes. That the result is a boolean.
I think the reason for this is that .Unitize() will modify your vector and not create new unitized one.
You should not assign it to another variable because it modifies the vector.
I actually still do not get it.
I have a vector something like (-1.4123,-2.365,2.877) with a length longer than 1.
Do you might know how I can get it to a length of 1?
It is not everything dividing by 1, right?
I don’t have Rhino opened in front of me but if
vector = (-1.4123,-2.365,2.877)
then simply do:
then the length should be 1.
But, it only gives True, do you might know what I am doing wrong?
dont print the vector, print it’s length
As I said above do not assign it to anything simply do
I need a vector, not a length.
Do I miss something?
you’re missing that you don’t create new vector you modify the existing one
print xvector and not xdirection
haha that looks like a funny print statement
and that will actually work
it doesn’t work it prints
meaning it works,
xvector and not xdirection
I could never understand these AND OR XOR completely
The bad news is that it should have worked the way you expected it to work.
Vector3d is a struct and the general good practice rules for structs is that they should be immutable. Now, Microsoft themselves break this rule with types like
System.Drawing.RectangleF, so it’s not a strong guideline.
These days I try to make my own types immutable as often as possible, and the hallmark of immutable types is that they always return a new instance of the type when you call a ‘modifier’ function.
I find it very inconvenient that methods modify my objects.