9.9. Slicing¶
- class cherab.core.math.slice.Slice2D¶
Exposes a slice of a Function2D as a Function1D.
- Parameters:
function (Function2D) – the function to be sliced.
axis – the axis to be sliced. Must be [‘x’, ‘y’] or [0, 1].
value (float) – the axis value at which to return a slice
>>> from cherab.core.math import Slice2D >>> >>> def f1(x, y): >>> return x**2 + y >>> >>> f2 = Slice2D(f1, 'x', 1.5) >>> >>> f2(0) 2.25 >>> f2(1) 3.25
- class cherab.core.math.slice.Slice3D¶
Exposes a slice of a Function3D as a Function2D.
- Parameters:
function (Function3D) – the function to be sliced.
axis – the axis to be sliced. Must be [‘x’, ‘y’, ‘z’] or [0, 1, 2].
value (float) – the axis value at which to return a slice
>>> from cherab.core.math import Slice3D >>> >>> def f1(x, y, z): >>> return x**3 + y**2 + z >>> >>> f2 = Slice3D(f1, 'x', 1.5) >>> >>> f2(0, 0) 3.375 >>> f2(1, 0) 4.375