9.2.7. Creating point series#
We learned in the previous section that a series of N points is expressed as:
[
[x(t0), y(t0), z(t0), 1.0],
[x(t1), y(t1), z(t1), 1.0],
[x(t2), y(t2), z(t2), 1.0],
[ ... , ... , ... , ...],
]
The function ktk.geometry.create_point_series can create such series from different forms:
9.2.7.1. Using multiple arrays#
In this case, the arguments x
, y
, and z
accept arrays of floats:
import kineticstoolkit.lab as ktk
ktk.geometry.create_point_series(
x=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5], z=[5.0, 5.0, 5.0, 5.1, 5.1, 5.1]
)
array([[0. , 0. , 5. , 1. ],
[0.1, 0. , 5. , 1. ],
[0.2, 0. , 5. , 1. ],
[0.3, 0. , 5.1, 1. ],
[0.4, 0. , 5.1, 1. ],
[0.5, 0. , 5.1, 1. ]])
9.2.7.2. Using a single array#
The default argument accepts an array of NxM where M could be 1 (x), 2 (x, y), 3 (x, y, z) or 4 (x, y, z, 1):
ktk.geometry.create_point_series(
[
[0.0, 0.0, 5.0],
[0.1, 0.0, 5.0],
[0.2, 0.0, 5.0],
[0.3, 0.0, 5.1],
[0.4, 0.0, 5.1],
[0.5, 0.0, 5.1],
]
)
array([[0. , 0. , 5. , 1. ],
[0.1, 0. , 5. , 1. ],
[0.2, 0. , 5. , 1. ],
[0.3, 0. , 5.1, 1. ],
[0.4, 0. , 5.1, 1. ],
[0.5, 0. , 5.1, 1. ]])
9.2.7.3. Series of constant values#
The function ktk.geometry.create_point_series has a convenient argument length
for series of constant values. For instance, if we need to repeat a constant point over five samples:
ktk.geometry.create_point_series([[1.0, 2.0, 3.0]], length=5)
array([[1., 2., 3., 1.],
[1., 2., 3., 1.],
[1., 2., 3., 1.],
[1., 2., 3., 1.],
[1., 2., 3., 1.]])