coords.Coords.reflect#
- Coords.reflect(dir=0, pos=0.0, inplace=False)#
Reflect the coordinates across a mirror plane.
The mirror plane is perpendicular to a specified global axis (or axes) and located at a given coordinate
posalong that axis.Parameters#
- dirint (0, 1, or 2) or int array_like
Axis (or axes) normal to the mirror plane(s).
0= x-axis,1= y-axis,2= z-axis.- posfloat or float array_like
Position(s) of the mirror plane(s) along the specified axis (or axes). Default is 0.0 (plane through the origin).
- inplacebool, optional
If True, modify the coordinates in place. If False (default), return a new reflected copy.
Returns#
- Coords
The reflected coordinates.
Examples#
>>> X = Coords([[0.0, 0.0],[1.0, 0.0],[1.0, 1.0]]) >>> print(X) [[0. 0. 0.] [1. 0. 0.] [1. 1. 0.]] >>> print(X.reflect(0)) [[ 0. 0. 0.] [-1. 0. 0.] [-1. 1. 0.]] >>> print(X.reflect(1,0.5)) [[0. 1. 0.] [1. 1. 0.] [1. 0. 0.]] >>> print(X.reflect([0,1],[0.5,0.])) [[ 1. 0. 0.] [ 0. 0. 0.] [ 0. -1. 0.]]