def scale_matrix(factor, origin=None, direction=None):
 if (direction is None):
  M = numpy.diag([factor, factor, factor, 1.0])
  if (origin is not None):
   M[:3, 3] = origin[:3]
   M[:3, 3] *= (1.0 - factor)
 else:
  direction = unit_vector(direction[:3])
  factor = (1.0 - factor)
  M = numpy.identity(4)
  M[:3, :3] -= (factor * numpy.outer(direction, direction))
  if (origin is not None):
   M[:3, 3] = ((factor * numpy.dot(origin[:3], direction)) * direction)
 return M

def scale_matrix ( factor , origin = None , direction = None ) : if ( direction is None ) : M = numpy . diag ( [ factor , factor , factor , 1.0 ] ) if ( origin is not None ) : M [ : 3 , 3 ] = origin [ : 3 ] M [ : 3 , 3 ] *= ( 1.0 - factor ) else : direction = unit_vector ( direction [ : 3 ] ) factor = ( 1.0 - factor ) M = numpy . identity ( 4 ) M [ : 3 , : 3 ] -= ( factor * numpy . outer ( direction , direction ) ) if ( origin is not None ) : M [ : 3 , 3 ] = ( ( factor * numpy . dot ( origin [ : 3 ] , direction ) ) * direction ) return M
return matrix to scale by factor around origin in direction .