Toggle search
Search
Toggle menu
Toggle personal menu
Editing
Behavioral Location Math
(section)
From Desynced Wiki
Read
Edit
Edit source
View history
Page
Discussion
More actions
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Location Math == To do math on location data and get usable location results both inputs need to be location data. Math functions work as you would think but only applying the math function from X to X and Y to Y in location data. === Locations as a X, Y Plane === All the Locations possible on the world map combine to the equivalent to a X,Y plane in math with certain locations equivalent to the origin and X and Y axes on a plane. [[File:Loction Plane Origin Axis.png]] Red: The Origin<br> Green & Red: The X axis<br> Yellow & Red: The Y axis ==== Special Property: Reflection ==== A useful aspect of math on locations with multiplication in that it allows you to manipulate x,y values in relation to the axes of the x,y plane. Reflection is easy to understand if you think of the axes as mirrors. If you wanted to see where the location reflection is across that mirror you would multiply by -1 to the opposite term for X 1,-1 for Y -1,1 and for both (across the Origin) by -1,-1 [[File:Loction Plane Reflection.png]] X and Y reflections by themselves are easy to visualize doing both can be harder to visualize but if you draw a line from the location through the Origin (0,0) and go past the Origin for the same length traveled to it, you will arrive at the correct location. A simpler but two step process is to reflect One axis then using that result reflect the other. === Reflecting Outside of the Axes and Origin === Multiplication alone will limit how useful reflection can be as you can only reflect across the Axes in the world with it alone. You can however reflect location data you are going to use for addition on any location and you can then get the reflections around any point in the world. For example if you wanted to build four buildings in a square with a set location in the center you could hard code four separate sets of location data or choose one and reflect it 3 times to get the other corners then add all 4 values to the unit/location you want set to the center giving you a square of locations around any location you choose. Here is an example program doing this: <code>DSCJZ2gFsiG0tMgkl2R0T0q2og9lI1E9VBB1uV7Hz1BwoZv42XrCz1VlimS1KWMNn2sdC4700X1VQ1pne7T1dRPGc31BuDR2pSPpk3mJKce2kZDc90Gc4Gb1JDH0t11dtIj0bjcaO2GwABA141CaR1Ovx6R0q6zey4Id5KV1SwcSR22V1zd2npAmY2CZcTq0Llza93ettl84GqCKy3JiIJm1AKfbO0U6Qt61lgGkY2y9pnB3TAhJr0YqNSX3eiGhp1p1a5g1YIVFb01hD9h4GSMeO2U8qRd0XjYSu1aonUZ2SK7d12oyTIW4HzyXK0yWCkI3JvEB93vD6d00df33J43ALxM4HRMQS3KPge43a4LfN2HJpRa4GlWkc2zcoDi4LNHU72chgXJ1omFqW3Z9YDr3wCUVF34pmBh25HsPh4OpYls3a4HDp0vH73K0TkTI03DHG8Q0qae8012eLdZ2uZdLW0opS0p0ZEsCA4HVzRt2zvCPb2Y4eKL0Lb9fV0pvC80</code>
Summary:
Please note that all contributions to Desynced Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Desynced Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)