Menu

[r4653]: / branches / transforms / unit / helpers.py  Maximize  Restore  History

Download this file

24 lines (17 with data), 578 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import sys, time, os
from matplotlib.numerix.mlab import rand
from matplotlib.transforms import identity_transform, unit_bbox, Func, IDENTITY
from matplotlib.transforms import one, Point, Value, Bbox, get_bbox_transform
def rand_val(N = 1):
if N==1: return Value(rand())
else: return [Value(val) for val in rand(N)]
def rand_point():
return Point( rand_val(), rand_val() )
def rand_bbox():
ll = rand_point()
ur = rand_point()
return Bbox(ll, ur)
def rand_transform():
b1 = rand_bbox()
b2 = rand_bbox()
return get_bbox_transform(b1, b2)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.