Skip to content

Instantly share code, notes, and snippets.

@Marc-B-Reynolds
Last active August 15, 2016 10:04
Show Gist options
  • Save Marc-B-Reynolds/687c05ea120f7017dd5a5a44e95087d9 to your computer and use it in GitHub Desktop.
Save Marc-B-Reynolds/687c05ea120f7017dd5a5a44e95087d9 to your computer and use it in GitHub Desktop.
Toy thought about: Messy closed path within ball in 3D

WRT: https://twitter.com/marc_b_reynolds/status/765092187960971264

uses stuff from: http://marc-b-reynolds.github.io/quaternions/2016/05/30/QuatHDAngleCayley.html

Given two 2D point sets of 'n' elements both on unit disc, taking a point from each: p0=(x0,y0) and p1=(x1,y1)

map to point 'S' on 3-sphere (4D unit sphere):

  • m = sqrt((1-dot(p0,p0))/dot(p1,p1))
  • S = (x0,y0,m x1,m y1) or alternately S = (m x1,m y1,x0,y0)
  • rename result to (x,y,z,w)

transform to half-sphere (final component positive, quaternion half-angle..aka sqrt):

  • s = 1/sqrt(2+2w)
  • H = s(x,y,z,1+w)
  • rename result to (x,y,z,w)

conformally map the half-sphere to 3D unit ball (quaternion Cayley transform):

  • P = (x,y,z)/(1+w)

Initially thought (without really thinking about the math) that the 2 intial sets on the disc couldn't intersect, but that's wrong. The correct prop for non-intersection paths needs chosen form of S and doing some proper thinking.

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