WhoCanDo Posted July 11, 2019 Share Posted July 11, 2019 hTmp := Mirror (hTmp, True, P1x, P1y, P2x, P2y); Can someone suggest why VS returns the error "Expected a point" at the first comma after the P1x please? I have var P1x, P1y, P2x, P2y : real; Quote Link to comment
Julian Carr Posted July 11, 2019 Share Posted July 11, 2019 Is Mirror a function in Vectorscript? It's not on the Developer site... Quote Link to comment
WhoCanDo Posted July 11, 2019 Author Share Posted July 11, 2019 Ahh, You are correct. However, it is in the ScriptFunctionReference.html Mirror VectorScript Declaration: FUNCTION Mirror ( h :HANDLE; dup :BOOLEAN; VAR p1X :REAL; VAR p1Y :REAL; VAR p2X :REAL; VAR p2Y :REAL ) :HANDLE ; Python: def vs.Mirror(h, dup, p1, p2): return HANDLE Description: Reflect an object across an axis. For a 2D reflection, the axis is a line containing arbitrary point p and extending along vector v. Parameters: h The object to reflect dup If false, transform the original object to the new position. If true, create a new object p1 An arbitrary point on the mirror axis p2 A second arbitrary point on the mirror axis Result: The reflected object (this will be the same as the input object if dup is false). Quote Link to comment
Pat Stanford Posted July 11, 2019 Share Posted July 11, 2019 @Julian Carr That was the first think I checked also. As @WhoCanDo says, it is in the VW2019 downloadable reference. But it appears the reference is wrong. The function does not take 4 reals for the x/y coordinate, rather it takes two Points. The following works. Procedure Test; Var H1:Handle; PT1,PT2:Point; Begin PT1.x:=0; PT1.y:=4; PT2.x:=0; PT2.y:=0; H1:=Mirror(FSActLayer,True,PT1,PT2); End; Run(Test); 1 Quote Link to comment
WhoCanDo Posted July 11, 2019 Author Share Posted July 11, 2019 I've never seen "Point" before. How is that different from "Vector" Quote Link to comment
Pat Stanford Posted July 11, 2019 Share Posted July 11, 2019 Points and 2D Vectors are the same. 3D Points and 3D Vectors are the same. My understanding is the have been given both names so as to not confuse people who are using them for different purposes. Someone who is trying to specify a point in space would think about using points. Someone who is trying to descriptor the motion of an object through space would use a vector. They both are just a combination of real values along the X/Y/Z axis. Quote Link to comment
WhoCanDo Posted July 11, 2019 Author Share Posted July 11, 2019 Thanks Pat, Since I didn't know about "Point", I tried defining the variable as "Vector", but it didn't work (note for anyone else reading this). 😉 Quote Link to comment
Pat Stanford Posted July 11, 2019 Share Posted July 11, 2019 It appears that Vectors are 3D as are Point3D. I think those are interchangeable. Point only has X and Y and is what is required in this case. Check out the Vectorscript Language Guide for more information. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.