(n)
This test constructs a two sets of variables related to each
    other by a simple linear transformation (scale and offset). The
    time is measured to change a variable on either side of the
    mapping and to change the scale and offset factors.
This test constructs a two sets of variables related to each
    other by a simple linear transformation (scale and offset). The
    time is measured to change a variable on either side of the
    mapping and to change the scale and offset factors.
This test constructs a two sets of variables related to each other by a simple linear transformation ( scale and offset ) . The time is measured to change a variable on either side of the mapping and to change the scale and offset factors .
def projection_test(n):
    """
    This test constructs a two sets of variables related to each
    other by a simple linear transformation (scale and offset). The
    time is measured to change a variable on either side of the
    mapping and to change the scale and offset factors.
    """
    global planner
    planner = Planner()
    scale = Variable("scale", 10)
    offset = Variable("offset", 1000)
    src, dest = None, None

    dests = []

    for i in range(n):
        src = Variable("src%s" % i, i)
        dst = Variable("dst%s" % i, i)
        dests.append(dst)
        StayConstraint(src, Strength.NORMAL)
        ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED)

    change(src, 17)

    if dst.value != 1170:
        print("Projection 1 failed")

    change(dst, 1050)

    if src.value != 5:
        print("Projection 2 failed")

    change(scale, 5)

    for i in range(n - 1):
        if dests[i].value != (i * 5 + 1000):
            print("Projection 3 failed")

    change(offset, 2000)

    for i in range(n - 1):
        if dests[i].value != (i * 5 + 2000):
            print("Projection 4 failed")
def projection_test ( n ) : global planner planner = Planner ( ) scale = Variable ( "scale" , 10 ) offset = Variable ( "offset" , 1000 ) src , dest = None , None dests = [ ] for i in range ( n ) : src = Variable ( "src%s" % i , i ) dst = Variable ( "dst%s" % i , i ) dests . append ( dst ) StayConstraint ( src , Strength . NORMAL ) ScaleConstraint ( src , scale , offset , dst , Strength . REQUIRED ) change ( src , 17 ) if dst . value != 1170 : print ( "Projection 1 failed" ) change ( dst , 1050 ) if src . value != 5 : print ( "Projection 2 failed" ) change ( scale , 5 ) for i in range ( n - 1 ) : if dests [ i ] . value != ( i * 5 + 1000 ) : print ( "Projection 3 failed" ) change ( offset , 2000 ) for i in range ( n - 1 ) : if dests [ i ] . value != ( i * 5 + 2000 ) : print ( "Projection 4 failed" )