I guess there are none of the method exist in Ruby API that you are referring to. You maybe wanted to mention e.g. Vector3d#transform -instance_method â€¦

Most probably Iâ€™m not the best to explain, but there is what I recognised:

#initialize(x, y, z) â‡’ Geom::Vector3d vs #initialize(x, y, z) â‡’ Geom::Vector3d Parameters: x (Numeric) y (Numeric) z (Numeric)
OR: #initialize(array3d) â‡’ Geom::Point3d vs #initialize(array3d) â‡’ Geom::Vector3d Parameters: array3d (Array(Numeric, Numeric, Numeric))

pt1 = Geom::Point3d.new(100,200,300)
vec1 = Geom::Vector3d.new(100,200,300)
pt2 = [100,200,300] #only the context will tell what it is
vec2 = [100,200,300] #only the context will tell what it is

â€¦you should not surprise about the similarity of matrix operations.

I hope there will come another real expert who will explain betterâ€¦

Um, yeah. It was a long night last night fighting with the APIâ€¦ Iâ€™ve updated the question.

The issue is that transformations using vectors are like when multiplying transformation matrix times a vector matrix (TV), but transformations using points are like when multiplying a point by a transformation matrix (PT). I would have expected they would be both like the latter, not different. That, or that the order could be controlled by a clearer idiom, such as to have a Vector3d#*(transformation)/Point3d#*(transformation) for VT/PT and Transformation#*(vector)/Transformation#*(point) for TV/TP and all vector/point transformations through a member function called transform being VT/PT.

Iâ€™m not even sure what the point of multiplying a transformation matrix to a vector/point would even get you (but then again, my matrix algebra is pretty rusty).

For future reference and use with the Ruby language:

It is customary to refer to only module or class methods using the :: scope operator as the method prefix. Ie â€¦ Sketchup::active_model()

â€¦ and to use # in place of a dot or scope operator only for instance methods. Ie â€¦ Geom::Vector3d#transform()

This way we know immediately what kind of method is being discussed. And we can go to the proper section in the documentation for the class to find the method definition. (Class methods are usually listed above instance methods.)

What dezmo is getting at is with the SketchUp API, they wrote many of the methods in the classes to use Arrays, Vectors, Points and Transforms interchangeably. Often a simple literal array is used to represent a vector for a translational transform, and the API methods accept this. Ex:

# Where old_pt is a Geom::Point3d object:
new_pt = old_pt.transform([0,0,23.7])

ADD: The result is a newGeom::Point3d object that is 23.7 inches above (Z-wise) the old one.

This code might clear things up a little (or not).

pt1 = Geom::Point3d.new(100,200,300)
vc1 = Geom::Vector3d.new(100,200,300)
offset = Geom::Point3d.new(10,20,30)
# create a translating Transformation
puts "\nTransformation Matrix"
tr = Geom::Transformation.new(offset)
tr.to_a.each_slice(4) {|a| p a}
# translate the Point3d object by the Transformation and by an Array
puts "\nPoint operations"
puts pt1.transform(tr)
puts pt1.transform(offset.to_a)
puts pt1 + offset.to_a
# The Vector3d class is used to represent vectors in a 3 dimensional space.
# Vectors in SketchUp have a direction and a length, but not a starting point.
# https://ruby.sketchup.com/Geom/Vector3d.html#%2B-instance_method
#
# The implication here is that if you translate a vector via the tranform method
# you get back the vector unchanged, but, you can add an array to a vector to
# get the expected result as shown in the last example
# translate the vector3d object by
puts "\nVector operations"
puts vc1.transform(tr)
puts vc1.transform(offset.to_a)
puts vc1 + offset.to_a
nil

Yes because a line can be represented as either an Array of a point and a vector, as â€śdefaultâ€ť. (â€śdefaultâ€ť is Not written in documentation, you have to discover it yourselfâ€¦ )

Since both variable above (point1 , point2) are currently an Array the context here will interpret the second â€śpoint2â€ť as vector. The line will cross a point1 and the direction is a 45Â° vector.

But a â€śsecond formâ€ť is as an Array of two points.

Can an array be used in all places a Geom::Transformation object is expected? Or is this specific to Geom::Point3d#transform? Iâ€™ve noticed that arrays can be used in certain contexts to mean a point or vector, but in others it causes an error, making the use inconsistent, at least (perhaps) at first glance? Itâ€™s definitely not fully documented.

Iâ€™ve not seen lines yet used in the API. Iâ€™ll keep this in mind, even though this isnâ€™t exactly pertaining to my question.

Anyway. Looks like what Iâ€™m actually asking is just flying over everyoneâ€™s head. I understand these transforms via my matrix algebra that I took many moons ago. To transform a point, you would have the point/vector as a row matrix and multiply it against the transformation matrix. Thus PT, where P is the point in row form, and the T is the transformation matrix. However, matrix multiplication is not transitive, thus PT != TP.

The way the SU lib is designed, Geom::Transformation#* is specified in such a way as to make one think you are multiplying the transformation matrix against the point, which isnâ€™t the case (youâ€™re multiplying the point against the transformation). You are, however, actually multiplying a transformation against a vector, which is a further surprise. Coming from a CS and Math background, Iâ€™m surprised at how this API was constructed. Contextually, this API is a bit all over the place.

Now, given what I just said, please reread what I said in my other posts with this as context and maybe youâ€™ll see what I am getting at.

The SketchUp Array class adds additional methods to the standard Ruby Array class. Specifically, it contains methods allowing an array to behave just as a Geom::Vector3d or Geom::Point3d object (which can be thought of as arrays of 3 coordinate values). Therefore, you can use the Array class in place of a Geom::Point3d or Geom::Vector3d as a way to pass coordinate values.

Okay? Now many of the API method docs will list Point3ds, Vector3ds and Array as options. But it is not a hard and fast rule that the API team will do so in the documentation.(More about that later.)

When we find a method that expects a point or a vector, but will not take an array, we open an issue in the API Issue Tracker and usually it will get fixed.

I can say that it can be used other places â€¦such as:

NOW, all that said, the method docs for all these methods do not specifically mention the variable argument types (ie, overloads.)

I asked that this be done in some way, recently in the official API tracker, but was met with resistance. Ie, they said it way too much work to doc all the overloads. I think I then asked that at least put a note in the overview for the Geom::Transformation class similar to the Overview blurb for Array. Ie, â€¦ speaking to the interchangeability between transforms, arrays, vectors and points.

Anyway, I canâ€™t find the exact issue where we discussed this. All I remember was (I think it was about a month ago,) and the idea did not go over well.

They are abstract (ie, no actual class.) The description is in the Geom module Overview.
Donâ€™t overlook that module level. There are some nifty module methods there.

I havenâ€™t talked specific to that as Iâ€™ve not run into an issue.

Hmmmmâ€¦ I think SketchUp transformation matrices may be in column major order.

Seems like a good time for you to install ThomThomâ€™s Transformation Inspector plugin: