about summary refs log tree commit diff homepage
path: root/utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-02 17:59:13 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-02 17:59:13 +0000
commitf4cdc443fb86f715ab93f3528aff23452a5bb3a3 (patch)
treeffab5077611d32a8b95c9d9b4f96b47703190e82 /utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py
parentbae2fa50234b0a575a18a119019e5d96f7ff7ecf (diff)
downloadklee-f4cdc443fb86f715ab93f3528aff23452a5bb3a3.tar.gz
Add a little hack for visualizing KLEE branching.
 - This consumes the treestream files produced with --write-paths or
   --write-sym-paths, and renders out the tree in a very ad-hoc funky way.
   Your mileage may vary! :)

Example image: http://klee.llvm.org/data/treegraph_example.jpg
Example movie: http://klee.llvm.org/data/treegraph_example.avi

git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@102869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py')
-rw-r--r--utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py b/utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py
new file mode 100644
index 00000000..b8705a32
--- /dev/null
+++ b/utils/hacks/TreeGraphs/Graphics/Geometry/mat3.py
@@ -0,0 +1,40 @@
+import vec3,mat2

+

+def identity():

+	return ((1.0, 0.0, 0.0),

+			(0.0, 1.0, 0.0),

+			(0.0, 0.0, 1.0))

+

+def fromscale(scale):

+	x,y,z= scale

+	x,y,z= float(x),float(y),float(z)

+	return ((  x, 0.0, 0.0),

+			(0.0,   y, 0.0),

+			(0.0, 0.0,   z))

+def fromscaleN(n):

+	return fromscale((n,n,n))

+

+def mul(a,b):

+	b_trans= zip(* b)

+	return tuple([transmulvec3(b_trans, a_r) for a_r in a])

+

+	# multiple vector v by a transposed matrix

+def transmulvec3(m_trans,v):

+	return tuple([vec3.dot(v, m_c) for m_c in m_trans])

+

+def mulvec3(m,v):

+	return transmulvec3(zip(* m), v)

+

+def mulN(m,N):

+	return tuple([vec3.mulN(v,N) for v in m])

+

+def det(m):

+	((m00,m01,m02),

+	 (m10,m11,m12),

+	 (m20,m21,m22))= m

+

+	a= m00 * mat2.det( ((m11, m12), (m21, m22)) );

+	b= m10 * mat2.det( ((m01, m02), (m21, m22)) );

+	c= m20 * mat2.det( ((m01, m02), (m11, m12)) );

+	

+	return a-b+c