5 Reflect
bi0qaw edited this page 2017-11-25 16:35:06 +01:00

Vectors

vectors %vectors% reflected at %vector% [in direction of %vector%]

Locations

%locations% reflected at %location% [in direction of %vector%]

Reflects locations or vectors in another location or vector.


Effect of the direction vector on reflection

Transformation Direction Vector
no reflection -1, -1, -1
reflection 1, 1, 1
x-axis reflection -1, 1, 1
y-axis reflection 1, -1, 1
z-axis reflection 1, 1, -1
x/z-plane reflection -1, 1, -1
y/z-plane reflection 1, -1, -1
x/y-plane reflection -1, -1, 1
scaling by 2 -2, -2, -2
reflection and scaling by 2 2, 2, 2
reflection and scaling of x-axis by 2 2, 1, 1
reflection and scaling of y-axis by 2 1, 2, 1
reflection and scaling of z-axis by 2 1, 1, 2
move all points to the center 0, 0, 0
set values of x-axis to x-value of center 0, -1, -1
set values of y-axis to y-value of center -1, 0, -1
set values of z-axis to z-value of center -1, -1, 0

Let's show some examples. First a simple reflection in the origin:

set {_line::*} to vector line from vector 0, 0, 0 to vector 1, 0, 0 and density 5
set {_reflected::*} to vectors {_line::*} reflected at vector 0, 0, 0

And with locations:

set {_line::*} to line from player to location 1 in front of player with density 5
set {_reflected::*} to {_line::*} reflected at player

The following image shows both the original line (green particles) and the reflected line (flame particles). We can see that the reflection just changed the direction of the line, which is basically everything a reflection does.


The whole thing becomes more interesting if we add a direction vector. This will scale the x-, y- and z-axis reflections with the x-, y- and z-values of the vector. Let's show this with another example:

set {_line::*} to vector line from vector 0, 0, 0 to vector 1, 0, 1 and density 5
set {_reflected::*} to vectors {_line::*} reflected at vector 0, 0, 0 in direction of vector 1, 1, -1

And with locations:

set {_line::*} to line from player to location 1 in front and 1 right of player with density 5
set {_reflected::*} to {_line::*} reflected at player

And the resulting image (green particles = before, flame particles = after):

We see that the line was mirrored along the z-axis. This is because the z-value of the direction vector was set to -1. The table at the top shows an overview of the effect of the direction vector on the reflection.