Both bc and awk do, but personally I'd choose the latter, as it's easier to cut off the floating point part:
Code: Select all
# DEG=70; RADIUS=300; originX=0; originY=0
# SIN=`awk 'BEGIN {printf("%.0f\n", '$originX' + '$RADIUS' * sin('$DEG' * (3.14 / 180) ))}'`
# COS=`awk 'BEGIN {printf("%.0f\n", '$originY' + '$RADIUS' * cos('$DEG' * (3.14 / 180) ))}'`
# echo "Sin=$SIN Cos=$COS"
Sin=282 Cos=103
#
PS.I was never good at trigonometry, but hopefully the above is correct...
Greetings!