array2_from_points2

compas_occ.conversions.array2_from_points2(points)

Construct a two-dimensional point array from a list of lists of points.

Parameters:
pointslist[list[Point]]
Returns:
TColgp_Array2OfPnt

Examples

>>> from itertools import product
>>> from compas.geometry import Point
>>> from compas_occ.conversions import array2_from_points2
>>> points2 = [
...     [Point(0, 0, 0), Point(1, 0, 0), Point(2, 0, 0)],
...     [Point(0, 1, 0), Point(1, 1, 0), Point(2, 1, 0)],
... ]
>>> array2 = array2_from_points2(points2)
>>> array2  
<OCC.Core.TColgp.TColgp_Array2OfPnt; ... >
>>> rows = range(array2.LowerRow(), array2.UpperRow() + 1)
>>> cols = range(array2.LowerCol(), array2.UpperCol() + 1)
>>> for i, j in product(rows, cols):
...     value = array2.Value(i, j)
...     x = value.X()
...     y = value.Y()
...     z = value.Z()
...     print(x, y, z)
0.0 0.0 0.0
0.0 1.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
2.0 0.0 0.0
2.0 1.0 0.0