// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::Reset(gaps::R3Plane const&, gaps::R3Affine const&, int, int, gaps::R2Box const&)
void R3PlanarGrid::
Reset(const R3Plane& plane, 
  const R3Affine& world_to_xyplane, 
  int xres, int yres, const R2Box& xyplane_bbox)
{
  // Update stuff
  this->plane = plane;
  this->transformation = world_to_xyplane;
  this->grid.Resample(xres, yres);
  this->grid.SetWorldToGridTransformation(xyplane_bbox);
  
  // Update world bbox
  bbox = R3null_box;
  R2Box xybox = grid.WorldBox();
  R3Point p00(xybox[0][0], xybox[0][1], 0); p00.InverseTransform(world_to_xyplane); bbox.Union(p00);
  R3Point p01(xybox[0][0], xybox[1][1], 0); p01.InverseTransform(world_to_xyplane); bbox.Union(p01);
  R3Point p10(xybox[1][0], xybox[0][1], 0); p10.InverseTransform(world_to_xyplane); bbox.Union(p10);
  R3Point p11(xybox[1][0], xybox[1][1], 0); p11.InverseTransform(world_to_xyplane); bbox.Union(p11);
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x180(%rsp)
movq %rsi, 0x178(%rsp)
movq %rdx, 0x170(%rsp)
movl %ecx, 0x16c(%rsp)
movl %r8d, 0x168(%rsp)
movq %r9, 0x160(%rsp)
movq 0x180(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
movq 0x178(%rsp), %rsi
callq 0x44240
movq 0xa0(%rsp), %rdi
movq 0x170(%rsp), %rsi
addq $0x20, %rdi
callq 0x30970
movq 0xa0(%rsp), %rdi
addq $0x130, %rdi            # imm = 0x130
movq %rdi, 0xa8(%rsp)
movl 0x16c(%rsp), %esi
movl 0x168(%rsp), %edx
xorl %ecx, %ecx
movl %ecx, 0xbc(%rsp)
callq 0x11b220
movq 0xa8(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x111610
movq 0xa0(%rsp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0x11f86e(%rip), %rsi    # 0x1fd308
callq 0x1bd40
movq 0xa8(%rsp), %rsi
leaq 0x138(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x548f0
movq 0xb0(%rsp), %rdi
movl 0xbc(%rsp), %esi
callq 0xdebf0
movq %rax, 0xc0(%rsp)
jmp 0xddada
movq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0x18820
movq %rax, 0x98(%rsp)
jmp 0xddaf3
movq 0x98(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
leaq 0x138(%rsp), %rdi
xorl %esi, %esi
callq 0xdebf0
movq %rax, 0x90(%rsp)
jmp 0xddb21
movq 0x90(%rsp), %rdi
movl $0x1, %esi
callq 0x18820
movq %rax, 0x80(%rsp)
jmp 0xddb3d
movsd 0x88(%rsp), %xmm0
movq 0x80(%rsp), %rax
movsd (%rax), %xmm1
leaq 0x120(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0xf8350
jmp 0xddb64
movq 0x170(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0xf8ff0
jmp 0xddb7b
movq 0xa0(%rsp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0x120(%rsp), %rsi
callq 0xcb9d0
jmp 0xddb99
leaq 0x138(%rsp), %rdi
xorl %esi, %esi
callq 0xdebf0
movq %rax, 0x78(%rsp)
jmp 0xddbaf
movq 0x78(%rsp), %rdi
xorl %esi, %esi
callq 0x18820
movq %rax, 0x70(%rsp)
jmp 0xddbc2
movq 0x70(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
leaq 0x138(%rsp), %rdi
movl $0x1, %esi
callq 0xdebf0
movq %rax, 0x68(%rsp)
jmp 0xddbea
movq 0x68(%rsp), %rdi
movl $0x1, %esi
callq 0x18820
movq %rax, 0x58(%rsp)
jmp 0xddc00
movsd 0x60(%rsp), %xmm0
movq 0x58(%rsp), %rax
movsd (%rax), %xmm1
leaq 0xf8(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0xf8350
jmp 0xddc21
movq 0x170(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0xf8ff0
jmp 0xddc38
movq 0xa0(%rsp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0xf8(%rsp), %rsi
callq 0xcb9d0
jmp 0xddc56
leaq 0x138(%rsp), %rdi
movl $0x1, %esi
callq 0xdebf0
movq %rax, 0x50(%rsp)
jmp 0xddc6f
movq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x18820
movq %rax, 0x48(%rsp)
jmp 0xddc82
movq 0x48(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0x138(%rsp), %rdi
xorl %esi, %esi
callq 0xdebf0
movq %rax, 0x40(%rsp)
jmp 0xddca7
movq 0x40(%rsp), %rdi
movl $0x1, %esi
callq 0x18820
movq %rax, 0x30(%rsp)
jmp 0xddcbd
movsd 0x38(%rsp), %xmm0
movq 0x30(%rsp), %rax
movsd (%rax), %xmm1
leaq 0xe0(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0xf8350
jmp 0xddcde
movq 0x170(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0xf8ff0
jmp 0xddcf5
movq 0xa0(%rsp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0xe0(%rsp), %rsi
callq 0xcb9d0
jmp 0xddd13
leaq 0x138(%rsp), %rdi
movl $0x1, %esi
callq 0xdebf0
movq %rax, 0x28(%rsp)
jmp 0xddd2c
movq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x18820
movq %rax, 0x20(%rsp)
jmp 0xddd3f
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x138(%rsp), %rdi
movl $0x1, %esi
callq 0xdebf0
movq %rax, 0x18(%rsp)
jmp 0xddd67
movq 0x18(%rsp), %rdi
movl $0x1, %esi
callq 0x18820
movq %rax, 0x8(%rsp)
jmp 0xddd7d
movsd 0x10(%rsp), %xmm0
movq 0x8(%rsp), %rax
movsd (%rax), %xmm1
leaq 0xc8(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0xf8350
jmp 0xddd9e
movq 0x170(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xf8ff0
jmp 0xdddb5
movq 0xa0(%rsp), %rdi
addq $0x200, %rdi            # imm = 0x200
leaq 0xc8(%rsp), %rsi
callq 0xcb9d0
jmp 0xdddd3
leaq 0x138(%rsp), %rdi
callq 0x54990
addq $0x188, %rsp            # imm = 0x188
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x54990
movq 0x118(%rsp), %rdi
callq 0x13970
nopw %cs:(%rax,%rax)