'Toxin
2012-05-28 15:16:12
So, I'm working on somewhat of a fail-safe here regarding angles, and I've stumped into somewhat of a dead end. Basically, I want to be able to track the positioning of the compass angle, and if it is a certain angle, then move left or right 5 degrees.
Here's what I've come up with so far…
The issue is, SetAngle accepts Integers, and the 'newDegrees' is of type Extended. Is there a way I can take the newDegrees variable and convert/round it such that it is an integer? The value of newDegree is usually something like 5.1923478593489, so if I am able to convert that into an Integer, I'd be able to do what I am trying to do. Any ideas?
Here's what I've come up with so far…
if Length(tpa) < 40 then
begin
WriteLn('Failed to track ob');
deg := rs_GetCompassAngleDegrees;
writeln('degrees below:');
writeln(deg);
if (deg < 5) then
begin
newDegrees := deg + 5;
//SetAngle(newDegrees);
end else
begin
newDegrees := deg - 5;
//SetAngle(newDegrees);
end;
The issue is, SetAngle accepts Integers, and the 'newDegrees' is of type Extended. Is there a way I can take the newDegrees variable and convert/round it such that it is an integer? The value of newDegree is usually something like 5.1923478593489, so if I am able to convert that into an Integer, I'd be able to do what I am trying to do. Any ideas?