#NEWLINE# def reflection_matrix( point , normal ) : #NEWLINE# #INDENT# 'Return matrix to mirror at plane defined by point and normal vector.\n\n    >>> v0 = numpy.random.random(4) - 0.5\n    >>> v0[3] = 1.\n    >>> v1 = numpy.random.random(3) - 0.5\n    >>> R = reflection_matrix(v0, v1)\n    >>> numpy.allclose(2, numpy.trace(R))\n    True\n    >>> numpy.allclose(v0, numpy.dot(R, v0))\n    True\n    >>> v2 = v0.copy()\n    >>> v2[:3] += v1\n    >>> v3 = v0.copy()\n    >>> v2[:3] -= v1\n    >>> numpy.allclose(v2, numpy.dot(R, v3))\n    True\n\n    ' #NEWLINE# normal = unit_vector ( normal [ : 3 ] ) #NEWLINE# M = numpy . identity ( 4 ) #NEWLINE# M [ : 3 , : 3 ] -= ( 2.0 * numpy . outer ( normal , normal ) ) #NEWLINE# M [ : 3 , 3 ] = ( ( 2.0 * numpy . dot ( point [ : 3 ] , M ) ) * normal ) #NEWLINE# return M