// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelObjectProperty.cpp
// Function: gaps::R3SurfelObjectProperty::Draw(gaps::RNFlags) const
void R3SurfelObjectProperty::
Draw(RNFlags flags) const
{
  // Draw property based on type
  switch (type) {
  case R3_SURFEL_OBJECT_PCA_PROPERTY: 
    if (noperands == 21) {
      R3Point centroid(operands[0], operands[1], operands[2]);
      R3Vector axis1(operands[3], operands[4], operands[5]);
      R3Vector axis2(operands[6], operands[7], operands[8]);
      R3Vector axis3(operands[9], operands[10], operands[11]);
      RNScalar stddev1 = sqrt(operands[12]);
      RNScalar stddev2 = sqrt(operands[13]);
      RNScalar stddev3 = sqrt(operands[14]);
      RNScalar extent01 = operands[15];
      RNScalar extent02 = operands[16];
      RNScalar extent03 = operands[17];
      RNScalar extent11 = operands[18];
      RNScalar extent12 = operands[19];
      RNScalar extent13 = operands[20];

      // Draw normal
      glLineWidth(5);
      RNGrfxBegin(RN_GRFX_LINES);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 0, 1);
      R3LoadPoint(centroid);
      R3LoadPoint(centroid + extent13*axis3);
      RNGrfxEnd();

      // Draw stddevs
      glLineWidth(2);
      RNGrfxBegin(RN_GRFX_LINES);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(1, 0, 0);
      R3LoadPoint(centroid - stddev1 * axis1);
      R3LoadPoint(centroid + stddev1 * axis1);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 1, 0);
      R3LoadPoint(centroid - stddev2 * axis2);
      R3LoadPoint(centroid + stddev2 * axis2);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 0, 1);
      R3LoadPoint(centroid - stddev3 * axis3);
      R3LoadPoint(centroid + stddev3 * axis3);
      RNGrfxEnd();

      // Draw extents
      glLineWidth(1);
      RNGrfxBegin(RN_GRFX_LINES);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(1, 0, 0);
      R3LoadPoint(centroid + extent01 * axis1);
      R3LoadPoint(centroid + extent11 * axis1);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 1, 0);
      R3LoadPoint(centroid + extent02 * axis2);
      R3LoadPoint(centroid + extent12 * axis2);
      if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(0, 0, 1);
      R3LoadPoint(centroid + extent03 * axis3);
      R3LoadPoint(centroid + extent13 * axis3);
      RNGrfxEnd();
    }
    break; 

  case R3_SURFEL_OBJECT_AMODAL_OBB_PROPERTY: 
    if (noperands == 20) {
      // Parse operands
      R3Point centroid(operands[0], operands[1], operands[2]);
      R3Vector axis1(operands[3], operands[4], operands[5]);
      R3Vector axis2(operands[6], operands[7], operands[8]);
      R3Vector axis3(operands[9], operands[10], operands[11]);
      RNScalar radius1 = operands[12];
      RNScalar radius2 = operands[13];
      RNScalar radius3 = operands[14];
      // RNScalar confidence = operands[15];
      // int originator = (int) (operands[16] + 0.5);

      // Check if should draw nose
      RNBoolean draw_nose = TRUE;
      R3SurfelLabel *label = (object) ? object->CurrentLabel() : NULL;
      if (label && label->Flags()[R3_SURFEL_LABEL_UNORIENTABLE_FLAG]) draw_nose = FALSE;

      // Draw obb
      R3OrientedBox obb(centroid, axis1, axis2, radius1, radius2, radius3);
      obb.Outline();

      // Draw nose
      if (draw_nose) {
        double min_nose_vector_length = 0.5;
        double nose_vector_length = 0.25 * radius1;
        if (nose_vector_length < min_nose_vector_length)
          nose_vector_length = min_nose_vector_length;
        R3Point start = centroid + radius1 * axis1;
        R3Point end = start + nose_vector_length * axis1;
        R3Span(start, end).Draw();
      }
    }
    break; 
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %r14
movl 0x2c(%rdi), %eax
cmpl $0x2, %eax
je 0x3f6ff
cmpl $0x1, %eax
jne 0x3fd76
cmpl $0x15, 0x28(%r14)
jne 0x3fd76
movq %rsi, %rbx
movq 0x20(%r14), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x110(%rsp), %rdi
callq 0x83dc2
movq 0x20(%r14), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
leaq 0xc0(%rsp), %rdi
callq 0x84856
movq 0x20(%r14), %rax
movsd 0x30(%rax), %xmm0
movsd 0x38(%rax), %xmm1
movsd 0x40(%rax), %xmm2
leaq 0x90(%rsp), %rdi
callq 0x84856
movq 0x20(%r14), %rax
movsd 0x48(%rax), %xmm0
movsd 0x50(%rax), %xmm1
movsd 0x58(%rax), %xmm2
leaq 0x50(%rsp), %rdi
callq 0x84856
movq 0x20(%r14), %rax
movsd 0x60(%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3f7d2
sqrtsd %xmm0, %xmm0
jmp 0x3f7db
cmpl $0x14, 0x28(%r14)
jne 0x3fd76
movq 0x20(%r14), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x90(%rsp), %rdi
callq 0x83dc2
movq 0x20(%r14), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
leaq 0x50(%rsp), %rdi
callq 0x84856
movq 0x20(%r14), %rax
movsd 0x30(%rax), %xmm0
movsd 0x38(%rax), %xmm1
movsd 0x40(%rax), %xmm2
leaq 0x18(%rsp), %rdi
callq 0x84856
movq 0x20(%r14), %rax
movsd 0x48(%rax), %xmm0
movsd 0x50(%rax), %xmm1
movsd 0x58(%rax), %xmm2
leaq 0x30(%rsp), %rdi
callq 0x84856
movq 0x18(%r14), %rdi
movq 0x20(%r14), %rax
movsd 0x60(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x68(%rax), %xmm1
movsd 0x70(%rax), %xmm2
testq %rdi, %rdi
je 0x3fc72
movsd %xmm2, (%rsp)
movsd %xmm1, 0x8(%rsp)
callq 0x17872
testq %rax, %rax
je 0x3fc76
movb 0x88(%rax), %bpl
andb $0x2, %bpl
shrb %bpl
jmp 0x3fc78
callq 0x133c0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x48(%rsp)
movq 0x20(%r14), %rax
movsd 0x68(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x3f7f6
sqrtsd %xmm0, %xmm0
jmp 0x3f7fb
callq 0x133c0
movsd %xmm0, (%rsp)
movq 0x20(%r14), %rax
movsd 0x70(%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3f819
sqrtsd %xmm0, %xmm0
jmp 0x3f81e
callq 0x133c0
movsd %xmm0, 0x8(%rsp)
movq 0x20(%r14), %rax
movsd 0x78(%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0x80(%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movsd 0x88(%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0x90(%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movsd 0x98(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0xa0(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movss 0x9ef89(%rip), %xmm0    # 0xde810
callq 0x138f0
movl $0x1, %edi
callq 0x13130
testb $0x1, %bl
je 0x3f8af
movss 0x9ef71(%rip), %xmm2    # 0xde814
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x139e0
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0x13150
leaq 0x30(%rsp), %r15
leaq 0x50(%rsp), %rsi
movq %r15, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x84107
movq %r12, %rdi
callq 0x13150
callq 0x136a0
movss 0x9ef19(%rip), %xmm0    # 0xde818
callq 0x138f0
movl $0x1, %edi
callq 0x13130
testb $0x1, %bl
je 0x3f927
movss 0x9eef9(%rip), %xmm0    # 0xde814
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x48(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x847e3
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x48(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3f9b1
movss 0x9ee6e(%rip), %xmm1    # 0xde814
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0x90(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x847e3
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3fa3a
movss 0x9ede6(%rip), %xmm2    # 0xde814
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x847e3
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r15, %rdi
callq 0x13150
callq 0x136a0
movss 0x9ed5e(%rip), %xmm0    # 0xde814
callq 0x138f0
movl $0x1, %edi
callq 0x13130
testb $0x1, %bl
je 0x3fade
movss 0x9ed42(%rip), %xmm0    # 0xde814
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0xc0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x68(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x70(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3fb68
movss 0x9ecb7(%rip), %xmm1    # 0xde814
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0x139e0
leaq 0x30(%rsp), %r14
leaq 0x90(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movsd 0x78(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r12
leaq 0x110(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r12, %rdi
callq 0x13150
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x80(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x84107
movq %r15, %rdi
callq 0x13150
testb $0x1, %bl
je 0x3fbf6
movss 0x9ec2a(%rip), %xmm2    # 0xde814
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x139e0
leaq 0x30(%rsp), %rbx
leaq 0x50(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movsd 0x88(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r15
leaq 0x110(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x84107
movq %r15, %rdi
callq 0x13150
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x851f2
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x84107
movq %r14, %rdi
callq 0x13150
callq 0x136a0
jmp 0x3fd76
xorl %ebp, %ebp
jmp 0x3fc83
xorl %ebp, %ebp
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm2
leaq 0x110(%rsp), %rbx
leaq 0x90(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x6c008
movl $0x1, %esi
movq %rbx, %rdi
callq 0x6e660
testb %bpl, %bpl
jne 0x3fd69
leaq 0xc0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movsd 0x10(%rsp), %xmm0
callq 0x851f2
leaq 0xa8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x84107
movsd 0x10(%rsp), %xmm1
mulsd 0x9ddec(%rip), %xmm1    # 0xddaf0
movsd 0x9d42c(%rip), %xmm0    # 0xdd138
maxsd %xmm1, %xmm0
leaq 0xc0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x851f2
leaq 0x190(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x84107
leaq 0xc0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x190(%rsp), %rdx
callq 0x83246
leaq 0xc0(%rsp), %rdi
callq 0x43c26
leaq 0x110(%rsp), %rdi
callq 0x6e174
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3fd8e
jmp 0x3fd8e
jmp 0x3fd8e
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x6e174
movq %rbx, %rdi
callq 0x138b0