Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.8 KB

README.md

File metadata and controls

60 lines (44 loc) · 1.8 KB

disk collision simulation

Context object

This object type is used in many places

type Vec = {
  x: number;
  y: number;
};

type DiskDynamics = {
  entities: number[];
  position: Map<number, Vec>;
  velocity: Map<number, Vec>;
  size: Map<number, { w: number; h: number }>;
  mass: Map<number, number>;
};

type SimulationCtx = {
  iteration: number;
};

type CollisionQueryCtx = {
  collideNormal: Map<number, Vec>;
  distanceUntilCollision: Map<number, number>;
  timeUntilCollision: Map<number, number>;
  collideWith: Map<number, number>;
};

type RendererCtx = {
  domTableDisk: Map<number, jQuery>;
  domTableVelocityPointer: Map<number, jQuery>;
};

type Context = SimulationCtx & CollisionQueryCtx & RendererCtx & DiskDynamics;

notes

how to copy a directory from a git repo and make it a new repo while preserving relevant commit history

  1. Create a new git repo, git init
  2. Set original repo as a remote, git remote add hmwk file://path/to/original/repo
  3. Download history from original repo, git remote update
  4. List commits that change this directory, git log -- day2009-bouncing-discs. Or use helper in IDE.
  5. Cherry-pick commits from remote, git cherry-pick f1a6884d^..5dfa0336 if commits are consecutive. Or cherry-pick them one by one.

Cherry-pick will throw fatal error if specified hash range contains merge commit. And commits from another branch will be "merged" to HEAD which is a very undesirable behaviour.

Subtree merging approach preserves merge commits and full commit history, see this link

TODO: this note should be made into a blog post.

Reference: