◀ Back to Note

Tony's Intertwingled Memex • Reference Manual

Computer Graphics & Game Engines (Ray-Traced Laser Sight)

Formulas & Definitions

In a 3D video game engine, a player fires a sniper rifle that projects a straight laser-sight line through space. Concurrently, a thin vertical power cylinder on the map is modeled as a line segment. The game engine maps out the equations of these two lines in local coordinate space as:

  • Laser Sight Line (L1L_1L1​): x=t,y=2−t,z=3+2tx = t, \quad y = 2 - t, \quad z = 3 + 2tx=t,y=2−t,z=3+2t
  • Power Cylinder Axis (L2L_2L2​): x=2+s,y=s,z=7+sx = 2 + s, \quad y = s, \quad z = 7 + sx=2+s,y=s,z=7+s
  1. Classify the geometric relationship between the laser sight line and the cylinder axis line (equal, parallel, intersecting, or skew).
  2. If the lines intersect, determine the exact 3D coordinates (x,y,z)(x, y, z)(x,y,z) where the laser beam strikes the cylinder.