// File: /workspace/github_cpp_makefile_star2_O1/IsaacLaw12[P]RayTracer/./src/WaveObject.cpp
// Function: WaveObject::get_wave_direction(double)
Eigen::Vector3d WaveObject::get_wave_direction(double angle){
    /*
    Use Rodrigue's rotation formula to rotate an orthognal unit vector around
    the normal of the wave surface.  The result is a unit vector that aims in a
    direction defined by angle on the wave plane.
    */
    Eigen::Vector3d v = direction_one;
    Eigen::Vector3d k = surface_normal;
    k = k.normalized();
    Eigen::Vector3d rotated_vector = v * cos(angle) + (k.cross(v)) * sin(angle)
                                     + k * (k.dot(v)) * (1 - cos(angle));
    return rotated_vector;
}

// Assembly:
pushq %rbx
subq $0xa0, %rsp
movaps %xmm0, %xmm4
movq %rdi, %rbx
movups 0x210(%rsi), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x220(%rsi), %xmm0
movaps %xmm0, 0x40(%rsp)
movupd 0x240(%rsi), %xmm3
movsd 0x250(%rsi), %xmm2
movapd %xmm3, %xmm0
mulpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x138c7
movq %xmm0, %xmm0            # xmm0 = xmm0[0],zero
sqrtpd %xmm0, %xmm0
divsd %xmm0, %xmm2
movapd %xmm2, 0x20(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm3
jmp 0x138cd
movapd %xmm2, 0x20(%rsp)
movapd %xmm3, (%rsp)
movaps %xmm4, %xmm0
movsd %xmm4, 0x18(%rsp)
callq 0x34f0
movaps %xmm0, 0x80(%rsp)
movapd (%rsp), %xmm6
movapd %xmm6, %xmm0
unpckhpd %xmm6, %xmm0            # xmm0 = xmm0[1],xmm6[1]
movapd 0x30(%rsp), %xmm7
movapd %xmm7, %xmm4
unpckhpd %xmm7, %xmm4            # xmm4 = xmm4[1],xmm7[1]
movapd 0x20(%rsp), %xmm3
movapd %xmm3, %xmm1
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
movapd %xmm7, %xmm2
movapd 0x40(%rsp), %xmm5
shufpd $0x1, %xmm5, %xmm2      # xmm2 = xmm2[1],xmm5[0]
mulpd %xmm1, %xmm2
movapd %xmm6, %xmm1
movapd %xmm6, (%rsp)
shufpd $0x1, %xmm7, %xmm1      # xmm1 = xmm1[1],xmm7[0]
movapd %xmm7, %xmm8
movapd %xmm5, %xmm7
unpcklpd %xmm3, %xmm7            # xmm7 = xmm7[0],xmm3[0]
mulpd %xmm1, %xmm7
subpd %xmm2, %xmm7
movapd %xmm7, 0x70(%rsp)
mulsd %xmm8, %xmm0
mulsd %xmm6, %xmm4
subsd %xmm0, %xmm4
movapd %xmm4, 0x90(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x3090
movaps %xmm0, 0x60(%rsp)
movapd 0x30(%rsp), %xmm0
mulpd (%rsp), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd 0x40(%rsp), %xmm0
mulsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movapd %xmm0, 0x50(%rsp)
movsd 0x18(%rsp), %xmm0
callq 0x34f0
movsd 0x267d(%rip), %xmm1     # 0x16030
subsd %xmm0, %xmm1
movapd 0x40(%rsp), %xmm3
movapd 0x80(%rsp), %xmm0
mulsd %xmm0, %xmm3
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0x30(%rsp), %xmm0
movapd %xmm0, %xmm2
movapd 0x60(%rsp), %xmm4
movapd %xmm4, %xmm0
unpcklpd %xmm4, %xmm0            # xmm0 = xmm0[0],xmm4[0]
mulpd 0x70(%rsp), %xmm0
addpd %xmm2, %xmm0
movapd 0x20(%rsp), %xmm2
movapd 0x50(%rsp), %xmm5
mulsd %xmm5, %xmm2
unpcklpd %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd (%rsp), %xmm5
mulsd %xmm1, %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm5, %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, (%rbx)
movapd 0x90(%rsp), %xmm0
mulsd %xmm4, %xmm0
addsd %xmm3, %xmm0
movapd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rbx)
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
retq
nop