// File: tomfunkhouser[P]gaps/apps/confview/confview.cpp
// Function: ResetViewer()
static void
ResetViewer(void)
{
  // Get bounding box
  R3Box bbox = configuration.WorldBBox();

  // Restrict bounding box only to surfaces, if there are any
  if (configuration.NSurfaces() > 0) {
    bbox = R3null_box;
    for (int i = 0; i < configuration.NSurfaces(); i++) {
      RGBDSurface *surface = configuration.Surface(i);
      bbox.Union(surface->WorldBBox());
    }
  }

  // Initialize viewing center
  center = bbox.Centroid();

  // Initialize viewer
  RNLength r = bbox.DiagonalRadius();
  if (r < 10) r = 10;
  R3Point eye = center - R3negz_vector * (2.5 * r);
  R3Camera camera(eye, R3negz_vector, R3posy_vector, 0.4, 0.4, 0.01 * r, 100.0 * r);
  R2Viewport viewport(0, 0, GLUTwindow_width, GLUTwindow_height);
  viewer.SetViewport(viewport);
  viewer.SetCamera(camera);
}

// Assembly:
subq $0x1a8, %rsp            # imm = 0x1A8
leaq 0x20fbc2(%rip), %rsi    # 0x23bbe0
movq %rsi, 0x20(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x2f490
movq 0x20(%rsp), %rdi
callq 0x2ecd0
movl %eax, 0x2c(%rsp)
jmp 0x2c040
movl 0x2c(%rsp), %eax
cmpl $0x0, %eax
jle 0x2c154
leaq 0x212974(%rip), %rsi    # 0x23e9c8
leaq 0x170(%rsp), %rdi
callq 0x2f4f0
jmp 0x2c063
movl $0x0, 0x160(%rsp)
movl 0x160(%rsp), %eax
movl %eax, 0x18(%rsp)
leaq 0x20fb60(%rip), %rdi    # 0x23bbe0
callq 0x2ecd0
movl %eax, 0x1c(%rsp)
jmp 0x2c08b
movl 0x18(%rsp), %eax
movl 0x1c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x2c152
movl 0x160(%rsp), %esi
leaq 0x20fb37(%rip), %rdi    # 0x23bbe0
callq 0x2f050
movq %rax, 0x10(%rsp)
jmp 0x2c0b5
movq 0x10(%rsp), %rax
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x2f550
jmp 0x2c0d9
leaq 0x170(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0xd9a70
jmp 0x2c0f0
leaq 0x120(%rsp), %rdi
callq 0x2f5f0
movl 0x160(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x160(%rsp)
jmp 0x2c06e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
jmp 0x2c2bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x168(%rsp)
movl %eax, 0x164(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x2f5f0
jmp 0x2c2bb
jmp 0x2c154
leaq 0x108(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xd95c0
jmp 0x2c16b
leaq 0x20fb56(%rip), %rdi    # 0x23bcc8
leaq 0x108(%rsp), %rsi
callq 0xed840
jmp 0x2c181
leaq 0x170(%rsp), %rdi
callq 0x2f600
movsd %xmm0, 0x8(%rsp)
jmp 0x2c196
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x100(%rsp)
movsd 0x19aebb(%rip), %xmm0   # 0x1c7068
ucomisd 0x100(%rsp), %xmm0
jbe 0x2c1c9
movsd 0x19aea8(%rip), %xmm0   # 0x1c7068
movsd %xmm0, 0x100(%rsp)
movsd 0x100(%rsp), %xmm0
movsd 0x19ae96(%rip), %xmm1   # 0x1c7070
mulsd %xmm1, %xmm0
leaq 0x2132f3(%rip), %rsi    # 0x23f4d8
leaq 0xd0(%rsp), %rdi
callq 0xef1e0
jmp 0x2c1f4
leaq 0x20facd(%rip), %rsi    # 0x23bcc8
leaq 0xe8(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0xee110
jmp 0x2c212
movsd 0x100(%rsp), %xmm3
movsd 0x19ae55(%rip), %xmm0   # 0x1c7078
movaps %xmm3, %xmm2
mulsd %xmm0, %xmm2
movsd 0x19ade6(%rip), %xmm0   # 0x1c7018
mulsd %xmm0, %xmm3
leaq 0x21329b(%rip), %rdx    # 0x23f4d8
leaq 0x213234(%rip), %rcx    # 0x23f478
leaq 0x40(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
movsd 0x19ade7(%rip), %xmm1   # 0x1c7040
movaps %xmm1, %xmm0
callq 0x4e2f0
jmp 0x2c263
movl 0x209873(%rip), %ecx    # 0x235adc
movl 0x209870(%rip), %r8d    # 0x235ae0
leaq 0x30(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x4f900
jmp 0x2c280
leaq 0x20fa59(%rip), %rdi    # 0x23bce0
leaq 0x30(%rsp), %rsi
callq 0x4adb0
jmp 0x2c293
leaq 0x20fa46(%rip), %rdi    # 0x23bce0
leaq 0x40(%rsp), %rsi
callq 0x4ad00
jmp 0x2c2a6
leaq 0x170(%rsp), %rdi
callq 0x2f5f0
addq $0x1a8, %rsp            # imm = 0x1A8
retq
leaq 0x170(%rsp), %rdi
callq 0x2f5f0
movq 0x168(%rsp), %rdi
callq 0x252b0
nopw %cs:(%rax,%rax)