Coordinate Transformations
When a player enters one portal and exits another, their position and direction are transformed by rotation, translation, and coordinate-frame changes.
Mathematics • Games • Systems Thinking
This project explores how portal-style games can be understood through coordinate transformations, momentum conservation, graph search, and mathematical modeling.
Core Idea
When a player enters one portal and exits another, their position and direction are transformed by rotation, translation, and coordinate-frame changes.
A moving object keeps its speed through a portal, but its direction changes according to the exit portal’s orientation.
A puzzle can be modeled as a graph of states and actions. Algorithms such as BFS or A* can search for a valid solution path.
Portals connect distant locations as if space were folded, suggesting ideas from topology and non-Euclidean geometry.
Interactive Demo
Change the entry position, entry velocity, and exit portal angle. The simulation shows how a vector is transformed when it exits the portal.
p' = Rθ · p + tv' = Rθ · v
Mathematical Structure
A portal can rotate a vector from the entry frame into the exit frame. In two dimensions, this can be modeled using a rotation matrix:
[ x' ] [ cosθ -sinθ ] [ x ]
[ y' ] = [ sinθ cosθ ] [ y ]
After rotation, the object is placed near the exit portal. This is modeled by adding a translation
vector t.
p' = Rθp + t
Speed is preserved in the simplified model, but direction changes according to the portal rotation:
v' = Rθv
A puzzle can be modeled as states connected by actions. A shortest solution can be searched using BFS:
start → place portal → move cube → press button → exit
Research Notes
This project began with a simple question: why do portal-based puzzles feel so mathematically strange? The answer is that the game mechanic combines several deep ideas: transformations from linear algebra, conservation principles from physics, state-space search from computer science, and spatial identification from topology.
Instead of treating a game as only entertainment, this project uses it as a modeling environment. The goal is to make invisible mathematical structures visible through interactive simulations.
Future versions could add 3D transformations, real puzzle maps, a graph-based puzzle solver, and a more formal explanation of how portals resemble topological gluing operations.