static float intersectSphereOffset()

in Transform360/Library/VideoFrameTransform.cpp [55:82]


static float intersectSphereOffset(
  float x,
  float y,
  float z,
  float ox,
  float oy,
  float oz) {
  float loc;
  float odot;
  float root;

  loc = x * -ox + y * -oy + z * -oz ;
  odot = ox * ox + oy * oy + oz * oz;

  root = loc * loc - odot + 1.0;

  if ( root <= 0.0f ) {
    return 0.0f;
  }

  root = sqrtf( root );

  if ( root < loc ) {
    return 0.0f;
  }

  return root - loc;
}