Vector Move - Math Error?

Hi all - I just noticed what I think is a bug/error in Grasshopper.

If I use the MOVE component on a vector - say (1,0,0) - by any arbitrary vector, then the result should be the same vector, no? I know it doesn’t sound that useful - why bother moving it since it shouldn’t change, but it took me a while to figure out why I was getting something weird in a chain of moves and rotations.

In my case, if I MOVE the “UNIT(X) = (1,0,0)” vector by (0,0,-100), I get (1,0,-100). I think that’s not mathematically correct. That’s vector addition.

Cheers,

Tom.

Hello
Move is used for moving Geometry, so I think the Vector is auto converted to a Point3d so it become a correct result. If you don’t want to be tricked by Grasshopper auto conversion it is surely better to stay on a more strict path and just use chain of Transforms (Compound component) in order to have a global transform.
And use a C# Python to transform a Vector
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.vector3d/transform#(transform)

transform vector.gh (9.6 KB)

A quick exploit in grasshopper is to use SDL component (Start Direction Length) to create a line starting from zero and then connect your vector to both D and L input.
Then , transform the resulting Line in any way you want.
Finally, directly convert your Line back into a Vector.

Thanks Laurent and Riccardo - what you both propose makes sense.

For my use, I was able to skip the move completely and just do the rotations. I was trying to get a few things (surfaces, lines, and vectors) through a similar pipeline, and I didn’t want to do something specific for the vectors.

I wanted to flag the issue for the McNeel crew, since IMHO this is not correct behavior: If the MOVE operator receives a vector, it should reject it rather than do something unpredictable or mathematically incorrect… Maybe for G2!

Cheers

Tom.

The implicit conversion from vector to point and vice versa is really useful, often you can spare many components thanks to this…

Indeed. Construct Point in particular!

Implicit type conversion is a tricky thing. I dislike it since it can quickly lead to dirty code and unexpected outcome. Its not defensive if you just cast or convert types on the fly. Even if you need less components it will hide important information. Still:

The most efficient way of doing this is simply using the add component. A point + a vector is moved point, whereas a vector + a vector is a composite vector. In any case Rhino is quite a unicorn when it comes to differentiation in between points and vectors. In most applications this is the same and the interpretation is up to the user. Because a point is also a vector of numbers, yet it expresses something different. You could argue that moving a direction vector is illegal, because you cannot “move” a direction vector at all. It has no location in space. Thus, the only correct way would be an exception. I fully agree!