Skip to main content
deleted 2 characters in body
Source Link

I don't know why are you choosing 0.5 as offset. The formula is (I'll use o instead of new_offset):

t1*w1 + t2*w2 = ( (t1-t2)*o + t2 )*w3
t1*w1 + t2*w2 = t1*o*w3 - t2*o*w3 + t2*w3
t1*w1 + t2*w2 = t1*(o*w3) + t2*(w3 - o*w3)

Form that we see this:

w1 = o*w3
w2 = w3 - o*w3

From first equation lets get o:

o = w1/w3

And put it into second equation:

w2 = w3 - (w1/w3)*w3 = w3 - w1

And you can calculate w3:

w3 = w2 + w1 (in your case w3 = 4+1 = 5)

And now you can get offset:

o = w1/w3 = w1/(w2+w1) (in your case o = 1/5)

Let's try with t1=10 and t2=20:

t1*w1 + t2*w2 = 10*1 + 20*4 = 90
( (t1-t2)*o + t2 )*w3 = (-10*0.252 + 20)*5 = (-2 + 20)*5 = 90

Great! Let's try with t1=10 and t2=30:

t1*w1 + t2*w2 = 10*1 + 30*4 = 130
( (t1-t2)*o + t2 )*w3 = (-20*0.252 + 30)*5 = (-4 + 30)*5 = 130

Excellent. It works. Right?

I don't know why are you choosing 0.5 as offset. The formula is (I'll use o instead of new_offset):

t1*w1 + t2*w2 = ( (t1-t2)*o + t2 )*w3
t1*w1 + t2*w2 = t1*o*w3 - t2*o*w3 + t2*w3
t1*w1 + t2*w2 = t1*(o*w3) + t2*(w3 - o*w3)

Form that we see this:

w1 = o*w3
w2 = w3 - o*w3

From first equation lets get o:

o = w1/w3

And put it into second equation:

w2 = w3 - (w1/w3)*w3 = w3 - w1

And you can calculate w3:

w3 = w2 + w1 (in your case w3 = 4+1 = 5)

And now you can get offset:

o = w1/w3 = w1/(w2+w1) (in your case o = 1/5)

Let's try with t1=10 and t2=20:

t1*w1 + t2*w2 = 10*1 + 20*4 = 90
( (t1-t2)*o + t2 )*w3 = (-10*0.25 + 20)*5 = (-2 + 20)*5 = 90

Great! Let's try with t1=10 and t2=30:

t1*w1 + t2*w2 = 10*1 + 30*4 = 130
( (t1-t2)*o + t2 )*w3 = (-20*0.25 + 30)*5 = (-4 + 30)*5 = 130

Excellent. It works. Right?

I don't know why are you choosing 0.5 as offset. The formula is (I'll use o instead of new_offset):

t1*w1 + t2*w2 = ( (t1-t2)*o + t2 )*w3
t1*w1 + t2*w2 = t1*o*w3 - t2*o*w3 + t2*w3
t1*w1 + t2*w2 = t1*(o*w3) + t2*(w3 - o*w3)

Form that we see this:

w1 = o*w3
w2 = w3 - o*w3

From first equation lets get o:

o = w1/w3

And put it into second equation:

w2 = w3 - (w1/w3)*w3 = w3 - w1

And you can calculate w3:

w3 = w2 + w1 (in your case w3 = 4+1 = 5)

And now you can get offset:

o = w1/w3 = w1/(w2+w1) (in your case o = 1/5)

Let's try with t1=10 and t2=20:

t1*w1 + t2*w2 = 10*1 + 20*4 = 90
( (t1-t2)*o + t2 )*w3 = (-10*0.2 + 20)*5 = (-2 + 20)*5 = 90

Great! Let's try with t1=10 and t2=30:

t1*w1 + t2*w2 = 10*1 + 30*4 = 130
( (t1-t2)*o + t2 )*w3 = (-20*0.2 + 30)*5 = (-4 + 30)*5 = 130

Excellent. It works. Right?

Source Link

I don't know why are you choosing 0.5 as offset. The formula is (I'll use o instead of new_offset):

t1*w1 + t2*w2 = ( (t1-t2)*o + t2 )*w3
t1*w1 + t2*w2 = t1*o*w3 - t2*o*w3 + t2*w3
t1*w1 + t2*w2 = t1*(o*w3) + t2*(w3 - o*w3)

Form that we see this:

w1 = o*w3
w2 = w3 - o*w3

From first equation lets get o:

o = w1/w3

And put it into second equation:

w2 = w3 - (w1/w3)*w3 = w3 - w1

And you can calculate w3:

w3 = w2 + w1 (in your case w3 = 4+1 = 5)

And now you can get offset:

o = w1/w3 = w1/(w2+w1) (in your case o = 1/5)

Let's try with t1=10 and t2=20:

t1*w1 + t2*w2 = 10*1 + 20*4 = 90
( (t1-t2)*o + t2 )*w3 = (-10*0.25 + 20)*5 = (-2 + 20)*5 = 90

Great! Let's try with t1=10 and t2=30:

t1*w1 + t2*w2 = 10*1 + 30*4 = 130
( (t1-t2)*o + t2 )*w3 = (-20*0.25 + 30)*5 = (-4 + 30)*5 = 130

Excellent. It works. Right?