@tt_su said:
But you cannot return a single world position for a vertex unless you have some extra info.
RIGHT.. I gotcha'
We would need to let Ruby know the parent instance's transform. (Not automatic unless in user edit mode.)
I guess we can do this now. We just create a copy of the instance's transformation, call it **t**:
world_pt = edge.start.position.transform(t)
I guess I was pondering how to automatically call #transform(t) upon all newly created Geom::Point3d instances, within a code block scope.
So, yes I suppose an optional "tranform" class argument for Vertex#position would be handy. (It could be a Geom::Transformation instance, a Geom::Vector3d in world context, OR either an Array or Geom::Point3d offset from ORIGIN.) So it could look like:
world_pt = edge.start.position(t)
(2) So lets say you have collected a series of vertices (in an array verts.) And you want their world co-ordinates:
world_pts = verts.map {|v| v.postion(t) }
We have to use map, because the API's Array#tranform() and Array#tranform!() methods, refuse to apply a transform to an array with anything other than than 3 numerics.
Even though each individual element has a transform method.
Example, you have an array of Geom::Point3d objects, and you want to transform ALL elements the same.
The Array class transform methods should do this IF the the elements are not numeric, and they respond_to?(:transform). (Add: Any element that does not "respond_to" is returned unchanged.))
💭