In the maths.h include file is the Atan function which is on based on Roman Black's formulae.
In the comments it says:
"'Any values of X and Y are usable including negative values provided
'they are between -1456 and 1456 so the 16bit multiply does not overflow."
The Function uses this:
Dim uxvector, uyvector, degree as Integer
If this is changed to:
Dim degree as Integer
Dim uxvector, uyvector As Long
the range increases from -1456 and 1456 to -32768 and 32767. This would allow the ArcTangent of any integer to be calculated.
Does anyone see a problem with this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds reasonable, but, why did the author put that constraint there?
I do not think it was a variable type issue. Longs were available so this would not have been a constraint.
The 16bit multiple. Are you sure it cannot overflow?
Or, was the Word value a constraint in the Roman Black code? and, it was carried forward?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Quote
A big benefit of this algorithm is its flexibility, being able to use any X and Y values. If you use a 32bit multiply and divide which is a little slower than the 16bit multiply and divide it is possible to use very large X and Y values. This makes it ideal for robot navigation or CNC machine coordinates where you just give it the XY values from the last move and it returns the direction as a 0-360 degree heading.
So the author put no constraint on 32 bit math it seems.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This makes it ideal for robot navigation or CNC machine coordinates where you just give it the XY values from the last move and it returns the direction as a 0-360 degree heading.
...does it simplify anything? still got to use sin cos to use heading...but I hate trig
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the maths.h include file is the Atan function which is on based on Roman Black's formulae.
In the comments it says:
"'Any values of X and Y are usable including negative values provided
'they are between -1456 and 1456 so the 16bit multiply does not overflow."
The Function uses this:
Dim uxvector, uyvector, degree as Integer
If this is changed to:
Dim degree as Integer
Dim uxvector, uyvector As Long
the range increases from -1456 and 1456 to -32768 and 32767. This would allow the ArcTangent of any integer to be calculated.
Does anyone see a problem with this?
Sounds reasonable, but, why did the author put that constraint there?
I do not think it was a variable type issue. Longs were available so this would not have been a constraint.
The 16bit multiple. Are you sure it cannot overflow?
Or, was the Word value a constraint in the Roman Black code? and, it was carried forward?
Quote
A big benefit of this algorithm is its flexibility, being able to use any X and Y values. If you use a 32bit multiply and divide which is a little slower than the 16bit multiply and divide it is possible to use very large X and Y values. This makes it ideal for robot navigation or CNC machine coordinates where you just give it the XY values from the last move and it returns the direction as a 0-360 degree heading.
So the author put no constraint on 32 bit math it seems.
This makes it ideal for robot navigation or CNC machine coordinates where you just give it the XY values from the last move and it returns the direction as a 0-360 degree heading.
...does it simplify anything? still got to use sin cos to use heading...but I hate trig