Skip to content

Instantly share code, notes, and snippets.

@rogersguedes
Created July 25, 2018 18:21
Show Gist options
  • Select an option

  • Save rogersguedes/eb0e27db387f3c6ddb368b41e10f16a8 to your computer and use it in GitHub Desktop.

Select an option

Save rogersguedes/eb0e27db387f3c6ddb368b41e10f16a8 to your computer and use it in GitHub Desktop.
//unidades:
//distancia: metros (m)
//angulo: radianos
clear //apaga todas as variáveis do escopo atual
clc // limpa a tela
function deg = radToDeg(rad)
deg = rad * 180 / %pi;
endfunction
function rad = degToRad(deg)
rad = deg * %pi / 180;
endfunction
l = 0.4 // largura traseira do objeto observado
theta = %pi/6
d = 5 // distância entre a camera e o objeto observado
gama = atan( ( cos(theta) * d ) / ( sin(theta) * d +l/2) )
alpha = 2 * ( ( (%pi/2) - theta ) - gama )
dRe = sqrt( (sin(theta)*d + l/2)^2 + ( cos(theta)*d )^2 )
dLe = l * ( (sin(theta)) / (sin(alpha)) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment