"Mirror" script returns point error

Recommended Posts

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;

Is Mirror a function in Vectorscript? It's not on the Developer site...

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).

@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);```

I've never seen "Point" before. How is that different from "Vector"

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.

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).

😉

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.

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.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×