// File: tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::R3SurfelImage(char const*)
R3SurfelImage::
R3SurfelImage(const char *name)
  : scene(NULL),
    scene_index(-1),
    scan(NULL),
    channels(),
    pose(R3Point(0,0,0), R3Triad(R3Vector(0,0,0), R3Vector(0,0,0))),
    timestamp(0),
    image_width(0), 
    image_height(0),
    image_center(0,0),
    xfocal(0),
    yfocal(0),
    distortion_type(R3_SURFEL_NO_DISTORTION),
    name((name) ? RNStrdup(name) : NULL),
    flags(0),
    data(NULL)
{
  // Intialize distortion parameters
  radial_distortion[0] = 0;
  radial_distortion[1] = 0;
  radial_distortion[2] = 0;
  tangential_distortion[0] = 0;
  tangential_distortion[1] = 0;

  // Initialize rolling shutter pose parameters
  rolling_shutter_poses[0] = pose;
  rolling_shutter_poses[1] = pose;
  rolling_shutter_timestamps[0] = timestamp;
  rolling_shutter_timestamps[1] = timestamp;
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movq 0xf0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
leaq 0x187b95(%rip), %rax    # 0x1eec70
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movl $0xffffffff, 0x10(%rdi) # imm = 0xFFFFFFFF
movq $0x0, 0x18(%rdi)
addq $0x20, %rdi
movq %rdi, 0x30(%rsp)
callq 0x6b820
movq 0x38(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x40(%rsp)
leaq 0xd0(%rsp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xf8350
jmp 0x67129
leaq 0x60(%rsp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xf94b0
jmp 0x6713e
leaq 0x48(%rsp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xf94b0
jmp 0x67153
leaq 0x78(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xd5d60
jmp 0x67169
movq 0x40(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0xd5570
jmp 0x67182
movq 0x38(%rsp), %rdi
movq $0x0, 0x90(%rdi)
movl $0x0, 0x98(%rdi)
movl $0x0, 0x9c(%rdi)
addq $0xa0, %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x133960
jmp 0x671ba
movq 0x38(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0xb0(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0xb8(%rax)
movl $0x0, 0xc0(%rax)
addq $0xf0, %rax
movq %rax, %rcx
addq $0xc0, %rcx
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xd5500
jmp 0x6720a
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rax
addq $0x60, %rax
cmpq %rcx, %rax
movq %rax, 0x28(%rsp)
jne 0x671f9
movq 0x38(%rsp), %rax
addq $0x1c0, %rax            # imm = 0x1C0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0xe8(%rsp)
je 0x6725c
movq 0xe8(%rsp), %rdi
callq 0x1461b0
movq %rax, 0x8(%rsp)
jmp 0x67251
movq 0x8(%rsp), %rax
movq %rax, (%rsp)
jmp 0x67264
xorl %eax, %eax
movq %rax, (%rsp)
jmp 0x67264
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, (%rax)
addq $0x1c8, %rdi            # imm = 0x1C8
xorl %eax, %eax
movl %eax, %esi
callq 0x1b970
jmp 0x67287
movq 0x38(%rsp), %rdi
movq $0x0, 0x1d0(%rdi)
movq $0x0, 0xc8(%rdi)
movq $0x0, 0xd0(%rdi)
movq $0x0, 0xd8(%rdi)
movq $0x0, 0xe0(%rdi)
movq $0x0, 0xe8(%rdi)
movq %rdi, %rsi
addq $0x30, %rsi
addq $0xf0, %rdi
callq 0x457f0
jmp 0x672e3
movq 0x38(%rsp), %rdi
movq %rdi, %rsi
addq $0x30, %rsi
addq $0x150, %rdi            # imm = 0x150
callq 0x457f0
jmp 0x672fd
movq 0x38(%rsp), %rax
movsd 0x90(%rax), %xmm0
movsd %xmm0, 0x1b0(%rax)
movsd 0x90(%rax), %xmm0
movsd %xmm0, 0x1b8(%rax)
addq $0xf8, %rsp
retq
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
callq 0x6b830
movq 0xc8(%rsp), %rdi
callq 0x13970
nopw %cs:(%rax,%rax)