// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::Inflate(double)
void R3Mesh::
Inflate(RNScalar factor)
{
  // Change every vertex position
  bbox = R3null_box;
  for (int i = 0; i < NVertices(); i++) {
    R3MeshVertex *vertex = Vertex(i);
    RNLength distance = factor * VertexAverageEdgeLength(vertex);
    R3Vector normal_vector = VertexNormal(vertex);
    vertex->position += distance * normal_vector;
    vertex->flags.Remove(R3_MESH_VERTEX_NORMAL_UPTODATE);
    bbox.Union(vertex->position);
  }

  // Mark every edge out of date
  for (int i = 0; i < NEdges(); i++) {
    R3MeshEdge *edge = Edge(i);
    edge->flags.Remove(R3_MESH_EDGE_LENGTH_UPTODATE);
  }

  // Mark every face out of date
  for (int i = 0; i < NFaces(); i++) {
    R3MeshFace *face = Face(i);
    face->flags.Remove(R3_MESH_FACE_PLANE_UPTODATE | R3_MESH_FACE_BBOX_UPTODATE);
  }

  // Invalidate GL buffer objects
  InvalidateGLBufferObjects();
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movsd %xmm0, 0xc8(%rsp)
movq 0xd0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
addq $0xf8, %rdi
leaq 0x15e925(%rip), %rsi    # 0x1787e8
callq 0x37500
movl $0x0, 0xc4(%rsp)
movq 0x40(%rsp), %rdi
movl 0xc4(%rsp), %eax
movl %eax, 0x3c(%rsp)
callq 0x135e0
movl %eax, %ecx
movl 0x3c(%rsp), %eax
cmpl %ecx, %eax
jge 0x1a001
movq 0x40(%rsp), %rdi
movl 0xc4(%rsp), %esi
callq 0x13630
movq 0x40(%rsp), %rdi
movq %rax, 0xb8(%rsp)
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0xb8(%rsp), %rsi
callq 0x16db0
movq 0x40(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0xb0(%rsp)
movq 0xb8(%rsp), %rsi
callq 0x36860
movq %rax, %rsi
leaq 0x98(%rsp), %rdi
callq 0x6fcf0
movsd 0xb0(%rsp), %xmm0
leaq 0x80(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x13800
movq 0xb8(%rsp), %rdi
addq $0x18, %rdi
leaq 0x80(%rsp), %rsi
callq 0x6f290
movq 0xb8(%rsp), %rax
addq $0x78, %rax
movq %rax, 0x30(%rsp)
leaq 0x78(%rsp), %rdi
movl $0x2, %esi
callq 0x13d80
movq 0x30(%rsp), %rdi
movq 0x78(%rsp), %rsi
callq 0x372b0
movq 0x40(%rsp), %rdi
addq $0xf8, %rdi
movq 0xb8(%rsp), %rsi
addq $0x18, %rsi
callq 0x444b0
movl 0xc4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0x19ed3
movl $0x0, 0x74(%rsp)
movq 0x40(%rsp), %rdi
movl 0x74(%rsp), %eax
movl %eax, 0x24(%rsp)
callq 0x135c0
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl %ecx, %eax
jge 0x1a071
movq 0x40(%rsp), %rdi
movl 0x74(%rsp), %esi
callq 0x36930
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
addq $0x38, %rax
movq %rax, 0x18(%rsp)
leaq 0x60(%rsp), %rdi
movl $0x2, %esi
callq 0x13d80
movq 0x18(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x372b0
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x1a009
movl $0x0, 0x5c(%rsp)
movq 0x40(%rsp), %rdi
movl 0x5c(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x135a0
movl %eax, %ecx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jge 0x1a0e3
movq 0x40(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x136d0
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0xa8, %rax
movq %rax, 0x8(%rsp)
leaq 0x48(%rsp), %rdi
movl $0xc, %esi
callq 0x13d80
movq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x372b0
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x1a079
movq 0x40(%rsp), %rdi
movq (%rdi), %rax
callq *0x290(%rax)
addq $0xd8, %rsp
retq
nopl (%rax)