AlgoScope

Dot Product

MathematicsintermediateGeometry Primitives

a . b = |a||b| cos theta; the sign tells whether vectors point the same way.

Decision · step 2 of 4Plane Geometry: Points, a vector and a distance
AB

Distance: the segment is the hypotenuse of a right triangle with legs 4 and 3, so the squared length is 4^2 + 3^2 = 25 and the length is sqrt(25), about 5. Comparing squared distances avoids the square root and stays exact in integers.

Open in the player →or start at step 2

What you will see

One vector's shadow on the other.

How plane geometry works →

Cost

SpaceO(1)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Points announce coordinates and role; each step announces the geometric test and its result in words (left turn, intersects).

Reduced motion: Shapes appear in place; the sweep line jumps between events.

Leads to

Topics that need this one first.