VectorTransform is not perfect!


#1

Hello !,
It seams that rs.VectorTransform is not making the job properly because it is deleting the 4th dimension of the matrix (the translation part), probably because of a wrong treatment of the missing dimension of the vector (that should be equal to 1 instead of 0), in comparison the Rhino multiply method is doing well.
As a proof for this hypothesis, the following script should create 2 red anf green points at the same location, but it is not: the red point is obviously missing the translation part of the matrix.
To my point of view, this should be fixed !
Best.

Point3 = Rhino.Geometry.Point3d(1,2,3)

RotationMatrix44 = rs.XformRotation2(45,[1,1,1],[5,3,0])

TransformedPoint = RotationMatrix44 * Point3
rs.ObjectColor(rs.AddPoint(TransformedPoint),[0,255,0])

TransformedPoint = rs.VectorTransform(Point3,RotationMatrix44)
rs.ObjectColor(rs.AddPoint(TransformedPoint),[255,0,0])


(Dale Fugier) #2

You cannot “move” a vector because they do not have postion. They only have magnitude and direction. Does this help?


#3

Ok!, I think I’ve understood my problem: you have 2 different types of objects for representing a point (Point3d) and a vector (Vector3d), and the Transform/Vector3d multiply method is not calculating the same way as the Transform/Point3d multiply method because you want to express the difference between the two objects, this is actually very coherent as soon as you accept the idea of using these two representations.
Understanding this, I’ve found the PointTransform rhinoscriptsyntax function that I missed in the first pass and that is doing what I wanted originally, so thank you Dale; your response was very basic, but nevertheless helpfull.
Best