From eda1a524b455af4aed5929571a40521ebbf39c12 Mon Sep 17 00:00:00 2001 From: bi0qaw Date: Sat, 25 Nov 2017 16:09:27 +0100 Subject: [PATCH] Created Reflect (markdown) --- Reflect.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Reflect.md diff --git a/Reflect.md b/Reflect.md new file mode 100644 index 0000000..3d3be9a --- /dev/null +++ b/Reflect.md @@ -0,0 +1,70 @@ +## 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. Let's show this with 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. +![](https://i.imgur.com/r0U5R7d.png) + +*** + +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): +![](https://i.imgur.com/ntJhTs8.png) + +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 in the next section shows how the direction vector will affect your reflection. + +*** + +## Table showing effect of direction vector on reflection + +Transformation|Direction Vector +---|--- +none|-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 + + + + +