Remove points from a polygon
-
I have created a function that adds points to a polygon.
But how to remove a point from a polygon, as well as remove the faces that contain it ? -
Hey @kantronin,
Thank you for reaching out to us. I would recommend having a look at the Modeling Python Examples. They are a bit hidden, but in the Geometry section I went over the general classic API geometry model of Cinema 4D.
Regarding your core questions:
- Removing points from a polygon: Without wanting to be overly pedantic, I must point out that polygons only index vertices, they do not hold them;
CPolygon
references with its fieldsa
,b
,c
, andd
the vertices of thePolygonObject
it is attached to. In this sense removing points from a polygon is not possible, you can just de-index them. Cinema 4D expresses both triangles and quadrangles with the typeCPolygon
, i.e., as quadrangles. A triangle simply repeats itsc
index in itsd
index. I explained this in the modelling examples in more detail. - Removing vertices or polygons from a
PolygonObject
: There is neither aPolygonObject.RemovePolygon
nor aPointObject.RemovePoint
if that is what you are looking for. When you want to change the vertex or polygon count of aPolygonObject
, you must callPolygonObject.ResizeObject
and then callPointObject.SetAllPoints()
and for each (new) polygonPolygonObject.SetPolygon
. The operation_extrude_polygons_s26 example covers this subject, although I go there into the opposite direction, I increase the point and polygon count rather than decreasing it.
PS: Useful might also be geometry_polygonobject_s26 because I explained there the type from scratch.
Cheers,
Ferdinand - Removing points from a polygon: Without wanting to be overly pedantic, I must point out that polygons only index vertices, they do not hold them;