コード例 #1
0
def getRandomLoc(randomLoc, rand, width, height):
    """ get random location between (0,0,0) and (width/2, width/2, height/2) """
    loc = Vector((0, 0, 0))
    loc.xy = [rand.uniform(-(width / 2) * randomLoc,
                           (width / 2) * randomLoc)] * 2
    loc.z = rand.uniform(-(height / 2) * randomLoc, (height / 2) * randomLoc)
    return loc
コード例 #2
0
def get_random_loc(random_loc, rand, half_width, half_height):
    """ get random location between (0,0,0) and (width/2, width/2, height/2) """
    loc = Vector((0, 0, 0))
    if random_loc > 0:
        loc.xy = [
            rand.uniform(-half_width * random_loc, half_width * random_loc)
        ] * 2
        loc.z = rand.uniform(-half_height * random_loc,
                             half_height * random_loc)
    return loc