The values for temp_x_btm_left = 0 & temp_y_btm_left=1;
angle = 90;
//Moving the bottom left coordinates
_btm_left.real() = (temp_x_btm_left * cos(angle
Pre-calculate your angle calculations, then use the results. Something like:
if (angle == 90) {
cos_angle = 0
} else {
cos_angle = cos(angle)
}
...
_btm_left.real() = ... * cos_angle ...
This has the additional benefit of doing fewer calls to cos()
and sin()
.
Keep in mind that if angle
is a float, doing something like angle == 90
could always return false, because of how floating point numbers are represented internally. You might want to change that to something like:
if (abs(angle-90) < some_small_number) {