Vector3d -> Point3d ?
-
Hi all, another simple question.
I would like to define a point by another point + a vector. However, in my Ruby, pt + vec returns another vec object, rather than a pt. So, is there a simple way to convert this returning vec to pt, cos I guess they all belong to array right? Thanks!
-Max
-
point3D.offset(Vector3D) ?
(thank you Didier !! ) -
NICE
! Thank you all! 
-
Adding a Vector3d to a Point3d should return a Point3d, however the converse is not true. Are you sure of the types of the objects you are "adding"?
@unknownuser said:
cos I guess they all belong to array right?
No! Point3d's and Vector3d's are distinct classes and not related to Arrays. However, SketchUp does add a few methods of "convenience" to the Array class, so that (in some cases) you can use an Array "as if" it were a Point3d or Vector3d.
pt = Geom;;Point3d.new v = Geom;;Vector3d.new (1, 0,0) pt + v ==> Point3d(1, 0, 0) v + pt ==> Error; #<ArgumentError; (eval);45;in `+'; Cannot convert argument to Sketchup;;Vector3d> v + [1,2,3] ==> Vector3d(2, 2, 3)In this example, the Array ([ 1, 2, 3] ) is made into a Vector3d before the '+' operation.
-
Thank you Jim!

BTW, how can I change my profile? I have no picture nor description for myself. -
-
That does. I guess I misunderstood '+' from the start. Thanks again.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement