如何将Math.max或Math.min转换成伪代码?

How to convert Math.max or Math.min into pseudocode?

我需要将其转换为伪代码。但我不知道如何处理 math.min、math.max 和 math.sqrt。

function intersect(sphere, box) 
  float x = Math.max(box.minX, Math.min(sphere.x, box.maxX))
  float y = Math.max(box.minY, Math.min(sphere.y, box.maxY))
  float z = Math.max(box.minZ, Math.min(sphere.z, box.maxZ))


  float distance = Math.sqrt((x - sphere.x) * (x - sphere.x) +
                           (y - sphere.y) * (y - sphere.y) +
                           (z - sphere.z) * (z - sphere.z))

  return distance < sphere.radius
end function

来自@Andrew Morton 的回答: .数学