3d-dart/server/system/NAfunctionLib.py
def rmatrixu(u, theta):
	
	"""Return a rotation matrix caused by a right hand rotation of theta radians around vector u."""
	
	if numpy.allclose(theta, 0.0) or numpy.allclose(numpy.dot(u,u), 0.0):
            return numpy.identity(3, float)

	x, y, z = normalize(u)
	sa = math.sin(theta)
	ca = math.cos(theta)

	R = array(
            [[1.0+(1.0-ca)*(x*x-1.0), -z*sa+(1.0-ca)*x*y,     y*sa+(1.0-ca)*x*z],
             [z*sa+(1.0-ca)*x*y,      1.0+(1.0-ca)*(y*y-1.0), -x*sa+(1.0-ca)*y*z],
             [-y*sa+(1.0-ca)*x*z,     x*sa+(1.0-ca)*y*z,      1.0+(1.0-ca)*(z*z-1.0)]], float)

	try:
            assert numpy.allclose(numpy.linalg.determinant(R), 1.0)
	except AssertionError:
            print "rmatrixu(%s, %f) determinant(R)=%f" % (
        	u, theta, numpy.linalg.determinant(R))
            raise

	return R
Return a rotation matrix caused by a right hand rotation of theta radians around vector u.
Return a rotation matrix caused by a right hand rotation of theta radians around vector u.
Return a rotation matrix caused by a right hand rotation of theta radians around vector u .
def rmatrixu(u, theta):
	if numpy.allclose(theta, 0.0) or numpy.allclose(numpy.dot(u,u), 0.0):
            return numpy.identity(3, float)
	x, y, z = normalize(u)
	sa = math.sin(theta)
	ca = math.cos(theta)
	R = array(
            [[1.0+(1.0-ca)*(x*x-1.0), -z*sa+(1.0-ca)*x*y,     y*sa+(1.0-ca)*x*z],
             [z*sa+(1.0-ca)*x*y,      1.0+(1.0-ca)*(y*y-1.0), -x*sa+(1.0-ca)*y*z],
             [-y*sa+(1.0-ca)*x*z,     x*sa+(1.0-ca)*y*z,      1.0+(1.0-ca)*(z*z-1.0)]], float)
	try:
            assert numpy.allclose(numpy.linalg.determinant(R), 1.0)
	except AssertionError:
            print "rmatrixu(%s, %f) determinant(R)=%f" % (
        	u, theta, numpy.linalg.determinant(R))
            raise
	return R
def rmatrixu ( u , theta ) : if numpy . allclose ( theta , 0.0 ) or numpy . allclose ( numpy . dot ( u , u ) , 0.0 ) : return numpy . identity ( 3 , float ) x , y , z = normalize ( u ) sa = math . sin ( theta ) ca = math . cos ( theta ) R = array ( [ [ 1.0 + ( 1.0 - ca ) * ( x * x - 1.0 ) , - z * sa + ( 1.0 - ca ) * x * y , y * sa + ( 1.0 - ca ) * x * z ] , [ z * sa + ( 1.0 - ca ) * x * y , 1.0 + ( 1.0 - ca ) * ( y * y - 1.0 ) , - x * sa + ( 1.0 - ca ) * y * z ] , [ - y * sa + ( 1.0 - ca ) * x * z , x * sa + ( 1.0 - ca ) * y * z , 1.0 + ( 1.0 - ca ) * ( z * z - 1.0 ) ] ] , float ) try : assert numpy . allclose ( numpy . linalg . determinant ( R ) , 1.0 ) except AssertionError : print "rmatrixu(%s, %f) determinant(R)=%f" % ( u , theta , numpy . linalg . determinant ( R ) ) raise return R
Return a rotation matrix caused by a right hand rotation of theta radians around vector u.
Return a rotation matrix caused by a right hand rotation of theta radians around vector u .
"""Return a rotation matrix caused by a right hand rotation of theta radians around vector u."""
u
theta