// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Utils/R3Segmentation.cpp
// Function: gaps::R3Segmentation::UpdatePoints()
int R3Segmentation::
UpdatePoints(void)
{
  // Update normal, tangent, radii, and area from neighbors
  for (int i = 0; i < points.NEntries(); i++) {
    R3SegmentationPoint *point = points.Kth(i);
    if (point->neighbors.NEntries() < 2) continue;
    if (!point->normal.IsZero() && !point->tangent.IsZero() &&
        (point->radius1 > 0) && (point->radius2 > 0)) continue;

    // Create array of neighborhood positions
    RNArray<R3Point *> positions;
    positions.Insert(&point->position);
    for (int j = 0; j < point->neighbors.NEntries(); j++) {
      positions.Insert(&point->neighbors[j]->position);
    }

    // Compute principle axes
    RNScalar variances[3];
    R3Point centroid = R3Centroid(positions);
    R3Triad axes = R3PrincipleAxes(centroid, positions, NULL, variances);
    if (RNIsZero(variances[1])) continue;

    // Update point
    point->normal = axes[2];
    point->tangent = axes[0];
    point->radius1 = sqrt(variances[0]);
    point->radius2 = sqrt(variances[1]);
    point->area = point->radius1 * point->radius2;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
cmpl $0x0, 0xc(%rdi)
jle 0x2cef6
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rsp, %r15
leaq 0x70(%rsp), %r12
movq (%rbx), %rax
movq (%rax,%r14,8), %rbp
cmpl $0x2, 0xbc(%rbp)
jl 0x2cee6
movsd 0x20(%rbp), %xmm0
ucomisd 0xde2f6(%rip), %xmm0    # 0x10b058
jne 0x2cd88
jp 0x2cd88
movsd 0x28(%rbp), %xmm0
ucomisd 0xde2e5(%rip), %xmm0    # 0x10b058
jne 0x2cd88
jp 0x2cd88
movsd 0x30(%rbp), %xmm0
ucomisd 0xde2d4(%rip), %xmm0    # 0x10b058
jne 0x2cd88
jnp 0x2cddd
movsd 0x38(%rbp), %xmm0
ucomisd 0xde2c3(%rip), %xmm0    # 0x10b058
jne 0x2cdbb
jp 0x2cdbb
movsd 0x40(%rbp), %xmm0
ucomisd 0xde2b2(%rip), %xmm0    # 0x10b058
jne 0x2cdbb
jp 0x2cdbb
movsd 0x48(%rbp), %xmm0
ucomisd 0xde2a1(%rip), %xmm0    # 0x10b058
jne 0x2cdbb
jnp 0x2cddd
movsd 0x50(%rbp), %xmm0
ucomisd 0xde290(%rip), %xmm0    # 0x10b058
jbe 0x2cddd
movsd 0x58(%rbp), %xmm0
ucomisd 0xde281(%rip), %xmm0    # 0x10b058
ja 0x2cee6
movq %r15, %rdi
callq 0xc4b50
leaq 0x8(%rbp), %rsi
movl 0xc(%rsp), %edx
movq %r15, %rdi
callq 0xc4be6
cmpl $0x0, 0xbc(%rbp)
jle 0x2ce2b
xorl %r13d, %r13d
movq 0xb0(%rbp), %rax
movq (%rax,%r13,8), %rsi
addq $0x8, %rsi
movl 0xc(%rsp), %edx
movq %r15, %rdi
callq 0xc4be6
incq %r13
movslq 0xbc(%rbp), %rax
cmpq %rax, %r13
jl 0x2ce01
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6d40c
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
leaq 0x10(%rsp), %r8
callq 0x6d4b8
movsd 0x18(%rsp), %xmm0
leaq 0x143efc(%rip), %rax    # 0x170d58
movsd (%rax), %xmm1
movapd %xmm1, %xmm2
xorpd 0xde624(%rip), %xmm2    # 0x10b490
ucomisd %xmm2, %xmm0
jb 0x2ce78
ucomisd %xmm0, %xmm1
jae 0x2cede
leaq 0x20(%rbp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xa0712
leaq 0x38(%rbp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xa0712
movsd 0x10(%rsp), %xmm0
ucomisd 0xde1b6(%rip), %xmm0    # 0x10b058
jb 0x2ceaa
sqrtsd %xmm0, %xmm0
jmp 0x2ceaf
callq 0x154d0
movsd %xmm0, 0x50(%rbp)
movsd 0x18(%rsp), %xmm0
ucomisd 0xde196(%rip), %xmm0    # 0x10b058
jb 0x2ceca
sqrtsd %xmm0, %xmm0
jmp 0x2cecf
callq 0x154d0
movsd %xmm0, 0x58(%rbp)
mulsd 0x50(%rbp), %xmm0
movsd %xmm0, 0x70(%rbp)
movq %r15, %rdi
callq 0xc4bba
incq %r14
movslq 0xc(%rbx), %rax
cmpq %rax, %r14
jl 0x2cd41
movl $0x1, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2cf13
jmp 0x2cf13
jmp 0x2cf13
movq %rax, %rbx
movq %rsp, %rdi
callq 0xc4bba
movq %rbx, %rdi
callq 0x15ae0