Skip to content

Instantly share code, notes, and snippets.

@tom-huntington
Last active February 19, 2024 02:55
Show Gist options
  • Save tom-huntington/00065d3f5c52a900bfa99a6230470956 to your computer and use it in GitHub Desktop.
Save tom-huntington/00065d3f5c52a900bfa99a6230470956 to your computer and use it in GitHub Desktop.

Let $p,v,t$ be the position, velocity and time unknowns such that for all $i$ we have a collision

$$p-p_i - t\times(v-v_i)=0.$$

To eliminate $t$ we wedge (exterior) product with $v-v_i$ to get

$$0=(p-p_i)\wedge (v-v_i)= p\wedge v - p \wedge v_i - p_i \wedge v + p_i \wedge v_i.$$

The nonlinear term $p\wedge v$ is constant for all $i$, so we subtract equations to get a linear equation

$$p \wedge (v_i-v_j) + (p_i - p_j) \wedge v - p_i \wedge v_i + p_j \wedge v_j=0.$$

Then wedge with $p_i - p_j$ to eliminate the $v$ unknowns

$$p \wedge (v_i-v_j) \wedge (p_i - p_j) + p_i \wedge v_i \wedge p_j + p_j \wedge v_j \wedge p_i =0.$$

This is an equation with three unknowns so pick three combinations for $i,j$ and solve the system

@polettix
Copy link

polettix commented Jan 2, 2024

@abroy77 copy the second formula putting j instead of i, then subtract the original one with the i from it.

This is done to get rid of the nonlinear term $p\wedge v$ and land on a linear equation (with respect to $p$ that is what we are looking for).

@abroy77
Copy link

abroy77 commented Feb 17, 2024

Hi! sorry for another question:
Should the first formula be

p - p_i - t x (v_i - v) = 0

Or is the original order correct because of the cross product with 't'. I'm also confused why there's a cross product with 't' since 't' is a scalar?

@tom-huntington
Copy link
Author

@abroy77 I just mean multiplication, it's given the same symbol as the cross product.

Ambivalence like this is an antipattern since you have to know the arguments to deduce the operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment