OpenStructure
random_lines.py

Draw lines with random orientation in 3D space

See also
Bounding Box Example, Lines And Quads
1 import random
2 prims1 = gfx.PrimList("prims one")
3 prims2 = gfx.PrimList("prims two")
4 for i in range(1000):
5  prims1.AddLine(10.0*geom.Vec3(random.random()-1,
6  random.random()-1,
7  random.random()-0.5),
8  10.0*geom.Vec3(random.random()-0.5,
9  random.random()-0.5,
10  random.random()-0.5),
11  gfx.Color(random.random(),
12  random.random(),
13  0.5)
14  );
15  prims2.AddLine(10.0*geom.Vec3(random.random(),
16  random.random(),
17  random.random()-0.5),
18  10.0*geom.Vec3(random.random()-0.5,
19  random.random()-0.5,
20  random.random()-0.5),
21  gfx.Color(random.random(),
22  0.5,
23  random.random())
24  );
25 scene.Add(prims1)
26 scene.Add(prims2)
27 scene.SetCenter(geom.Vec3(0,0,0))
28 
29 
30 
31 
32 
33 
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48