To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. (See discussion at SO SO). This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. (See discussion at SO). This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. (See discussion at SO). This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. For details, see(See discussion at SO ). This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. For details, see discussion at SO. This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. (See discussion at SO ). This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position just by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. For details, see discussion at SO . This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position just by using %
.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
To simplify your normalization code...
First, calculate the intervals for each pair on the unnormalized data. For example, the length of the interval between [0, 360]
is calculated via 360 - 0
.
Second, calculate the normalized start position by using modulus. In C, calculate n mod M
with ((n % M) + M) % M
. For details, see discussion at SO . This could be a function.
Now, you have your data represented as (start1, interval1)
and (start2, interval2)
. I think that's a better representation for what you want to do.
If you disagree, calculate endN
via startN + intervalN
to get (start1, end1)
and (start2, end2)
.
Edit: Added info from comments.