// File: /workspace/github_cpp_makefile_star2_O2/carlos-urena[P]svg-gen/svgobjects.cpp
// Function: Hemisphere::Hemisphere(VectorTempl3<float> const&, float, VectorTempl3<float>, bool)
Hemisphere::Hemisphere( const vec3 & pcenter3D, real pradius3D, vec3 p_view_dir, bool flip_axes )
{


   radius3D = pradius3D ;
   center3D = pcenter3D ;
   view_dir = p_view_dir ;

   const vec3 view_dir_norm = view_dir.normalized(),
              proj_view_dir = vec3( view_dir[0], 0.0, view_dir[2] ),
              axisz         = proj_view_dir.normalized(),
              axisy         = vec3( 0.0, 1.0, 0.0 ),
              axisx         = vec3( -axisz[2], 0.0, axisz[0] ) ;

      auto * contour = new Polygon();

    // add points in the equator
    const int np = 128 ;

    // semicircunference (front side of the equator) (perp. to Y)
    for( int i = 0 ; i < np ; i++ )
    {
       const float angr = M_PI*float(i)/float(np);
       contour->points3D.push_back( center3D + radius3D*( -cos(angr)*axisx + sin(angr)*axisz )  );
    }

    // semicircunference perp. to Z
    const vec3
      axisy_rot = axisx.cross( view_dir_norm ).normalized(); // axisY, but perp. to view dir

    for( int i = 0 ; i < np ; i++ )
    {
       const float angr = M_PI*float(i)/float(np);
       contour->points3D.push_back( center3D + radius3D*(cos(angr)*axisx + sin(angr)*axisy_rot)  );
    }

    contour->style.draw_filled = true ;
    contour->style.use_grad_fill = true ;
    contour->style.grad_fill_name = "hemisphereGradFill" ;

    contour->style.draw_lines  = true ;
    contour->style.lines_width = 0.0035 ;
    contour->style.lines_color = vec3( 0.5, 0.5, 0.5 );
    contour->style.close_lines = true ;


   // back side of the equator (dashed) (perp to Y)

   auto * equator = new Polygon();

   // semicircunference at the equator (perp. to view_dir) (equalt to contour equator)
   for( int i = 0 ; i <= np ; i++ )
   {
      const float angr = M_PI*float(i)/float(np);
      equator->points3D.push_back( center3D + radius3D*( -cos(angr)*axisx - sin(angr)*axisz )  );
   }

   equator->style.draw_filled = false ;
   equator->style.draw_lines  = true ;
   equator->style.dashed_lines = true ; /// dashed!
   equator->style.lines_width = contour->style.lines_width ;
   equator->style.lines_color = contour->style.lines_color;
   equator->style.close_lines = false ;

   // axes

   add( new Axes( 0.005, flip_axes ) );

   // add objects to this object set
   add( equator );
   add( contour );


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %r13d
movss %xmm2, -0x30(%rbp)
movaps %xmm1, -0xd0(%rbp)
movss %xmm0, -0x48(%rbp)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, 0x8(%rdi)
xorps %xmm0, %xmm0
andq $0x0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
leaq 0x8e87(%rip), %rax      # 0xf858
movq %rax, (%rdi)
leaq 0x60(%rdi), %r15
movq %r15, %rdi
callq 0x6332
leaq 0x40(%r14), %r12
leaq 0x4c(%r14), %rdi
movss -0x48(%rbp), %xmm0
movss %xmm0, 0x38(%r14)
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r12)
movq (%rbx), %rax
movq %rax, (%r12)
movaps -0xd0(%rbp), %xmm0
movlps %xmm0, 0x4c(%r14)
movss -0x30(%rbp), %xmm0
movss %xmm0, 0x54(%r14)
callq 0x5372
movss %xmm0, -0xc0(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0xbc(%rbp)
movss %xmm1, -0xb8(%rbp)
movss 0x4c(%r14), %xmm0
leaq -0xec(%rbp), %rdi
movss %xmm0, (%rdi)
andl $0x0, 0x4(%rdi)
movss 0x54(%r14), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x5372
movss %xmm0, -0xb4(%rbp)
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
movss %xmm2, -0xb0(%rbp)
movss %xmm1, -0xac(%rbp)
xorps 0x482b(%rip), %xmm1     # 0xb2b0
movss %xmm1, -0x8c(%rbp)
andl $0x0, -0x88(%rbp)
movss %xmm0, -0x84(%rbp)
movl $0x98, %edi
callq 0x31b0
movl %r13d, -0x9c(%rbp)
movq %r15, -0x80(%rbp)
movq %rax, %rdi
movq %rax, %r15
callq 0x6332
movq %r14, -0x48(%rbp)
addq $0x38, %r14
movq %r15, -0xd0(%rbp)
addq $0x68, %r15
xorl %r13d, %r13d
leaq -0xa8(%rbp), %rbx
cmpl $0x80, %r13d
je 0x6bb6
cvtsi2sd %r13d, %xmm0
mulsd 0x476d(%rip), %xmm0     # 0xb260
mulsd 0x476d(%rip), %xmm0     # 0xb268
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3270
cvtsd2ss %xmm0, %xmm0
xorps 0x4798(%rip), %xmm0     # 0xb2b0
leaq -0x8c(%rbp), %rdi
callq 0x52f1
movlps %xmm0, -0x68(%rbp)
movss %xmm1, -0x60(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x3050
cvtsd2ss %xmm0, %xmm0
leaq -0xb4(%rbp), %rdi
callq 0x52f1
movlps %xmm0, -0x58(%rbp)
movss %xmm1, -0x50(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x988e
movlps %xmm0, -0x78(%rbp)
movss %xmm1, -0x70(%rbp)
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
callq 0x98f3
movlps %xmm0, -0x40(%rbp)
movss %xmm1, -0x38(%rbp)
movq %r12, %rdi
leaq -0x40(%rbp), %rsi
callq 0x988e
movss %xmm0, -0xa8(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0xa4(%rbp)
movss %xmm1, -0xa0(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9f14
incl %r13d
jmp 0x6ad9
leaq -0x8c(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x5398
leaq -0x40(%rbp), %rdi
movlps %xmm0, (%rdi)
movss %xmm1, 0x8(%rdi)
callq 0x5372
leaq -0xa8(%rbp), %rbx
movss %xmm0, (%rbx)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, 0x4(%rbx)
movss %xmm1, 0x8(%rbx)
xorl %r13d, %r13d
cmpl $0x80, %r13d
je 0x6cc9
cvtsi2sd %r13d, %xmm0
mulsd 0x4650(%rip), %xmm0     # 0xb260
mulsd 0x4650(%rip), %xmm0     # 0xb268
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3270
cvtsd2ss %xmm0, %xmm0
leaq -0x8c(%rbp), %rdi
callq 0x52f1
movlps %xmm0, -0x58(%rbp)
movss %xmm1, -0x50(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x3050
cvtsd2ss %xmm0, %xmm0
movq %rbx, %rdi
callq 0x52f1
movlps %xmm0, -0x98(%rbp)
movss %xmm1, -0x90(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x988e
movlps %xmm0, -0x68(%rbp)
movss %xmm1, -0x60(%rbp)
movq %r14, %rdi
leaq -0x68(%rbp), %rsi
callq 0x98f3
movlps %xmm0, -0x78(%rbp)
movss %xmm1, -0x70(%rbp)
movq %r12, %rdi
leaq -0x78(%rbp), %rsi
callq 0x988e
movss %xmm0, -0x40(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0x3c(%rbp)
movss %xmm1, -0x38(%rbp)
movq %r15, %rdi
leaq -0x40(%rbp), %rsi
callq 0x9f14
incl %r13d
jmp 0x6bf6
movb $0x1, %al
movq -0xd0(%rbp), %rbx
movb %al, 0x3a(%rbx)
movb %al, 0x45(%rbx)
leaq 0x48(%rbx), %rdi
leaq 0x4bd7(%rip), %rsi      # 0xb8ba
callq 0x3280
movw $0x101, 0x38(%rbx)      # imm = 0x101
movl $0x3b656042, 0x3c(%rbx) # imm = 0x3B656042
movabsq $0x3f0000003f000000, %rax # imm = 0x3F0000003F000000
movq %rax, 0x20(%rbx)
movl $0x3f000000, 0x28(%rbx) # imm = 0x3F000000
movl $0x98, %edi
callq 0x31b0
movq %rax, %r15
movq %rax, %rdi
callq 0x6332
addq $0x20, %rbx
movq %rbx, -0xd8(%rbp)
movq %r15, -0xe0(%rbp)
movq %r15, %rbx
addq $0x68, %rbx
xorl %r15d, %r15d
leaq -0x40(%rbp), %r13
cmpl $0x81, %r15d
je 0x6e1c
cvtsi2sd %r15d, %xmm0
mulsd 0x4507(%rip), %xmm0     # 0xb260
mulsd 0x4507(%rip), %xmm0     # 0xb268
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x3270
cvtsd2ss %xmm0, %xmm0
xorps 0x4532(%rip), %xmm0     # 0xb2b0
leaq -0x8c(%rbp), %rdi
callq 0x52f1
movlps %xmm0, -0x58(%rbp)
movss %xmm1, -0x50(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x3050
cvtsd2ss %xmm0, %xmm0
leaq -0xb4(%rbp), %rdi
callq 0x52f1
movlps %xmm0, -0x98(%rbp)
movss %xmm1, -0x90(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x530c
movlps %xmm0, -0x68(%rbp)
movss %xmm1, -0x60(%rbp)
movq %r14, %rdi
leaq -0x68(%rbp), %rsi
callq 0x98f3
movlps %xmm0, -0x78(%rbp)
movss %xmm1, -0x70(%rbp)
movq %r12, %rdi
leaq -0x78(%rbp), %rsi
callq 0x988e
movss %xmm0, -0x40(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0x3c(%rbp)
movss %xmm1, -0x38(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x9f14
incl %r15d
jmp 0x6d3f
xorl %eax, %eax
movq -0xe0(%rbp), %r12
movb %al, 0x3a(%r12)
movb $0x1, %cl
movb %cl, 0x38(%r12)
movb %cl, 0x44(%r12)
movq -0xd0(%rbp), %r15
movss 0x3c(%r15), %xmm0
movss %xmm0, 0x3c(%r12)
movq -0xd8(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, 0x20(%r12)
movl 0x8(%rdx), %ecx
movl %ecx, 0x28(%r12)
movb %al, 0x39(%r12)
pushq $0x38
popq %rdi
movq -0x48(%rbp), %rbx
callq 0x31b0
movq %rax, %r14
movzbl -0x9c(%rbp), %esi
movss 0x4480(%rip), %xmm0     # 0xb304
movq %rax, %rdi
callq 0x7ca0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x664c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x664c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x664c
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
jmp 0x6ecd
movq %rax, %rbx
movq %r15, %rdi
callq 0x3190
jmp 0x6f02
jmp 0x6eff
movq %rax, %rbx
movq %r15, %rdi
callq 0x3190
jmp 0x6f06
jmp 0x6ee7
jmp 0x6ee7
movq %rax, %rbx
jmp 0x6f0a
movq %rax, %rbx
jmp 0x6f12
jmp 0x6eff
jmp 0x6eff
jmp 0x6eff
jmp 0x6eff
jmp 0x6eff
jmp 0x6eff
jmp 0x6eff
movq %rax, %rbx
movq -0x48(%rbp), %r14
movq -0x80(%rbp), %r15
movq %r15, %rdi
callq 0x973c
movq %r14, %rdi
callq 0x971e
movq %rbx, %rdi
callq 0x3250