Just to replicate the error, let's consider the succession of points describing a nonconvex polygon:
[0. , 0. , 0. ],
[1. , 0. , 0. ],
[1. , 0.5, 0. ],
[0.5, 0.5, 0. ],
[0.5, 1. , 0. ],
[1. , 1. , 0. ],
[1. , 1.5, 0. ],
[0. , 1.5, 0. ]
This data should represent a nonconvex polygon looking like
But when trying to set this up using PyVista's PolyData
constructor, as:
import numpy as np
import pyvista
b = 0.5
c = 0.5
points = np.array([
[0, 0, 0],
[1, 0, 0],
[1, b, 0],
[1-b, b, 0],
[1-b, b+c, 0],
[1, b+c, 0],
[1, 2*b+c, 0],
[0, 2*b+c, 0],
])
face = np.concatenate([
[9],
np.arange(9),
[0],
])
polygon = pyvista.PolyData(
points,
face)
polygon.plot()
I somehow get a distorted version of it:
Is there something I'm missing from pyvista documentation?