3.7 inte3d – Half-space truncation of arbitrary polyhedra

The inte3d routine performs geometric clipping of an arbitrary polyhedron against a half-space defined by the plane \(\mathbf{n} \cdot \mathbf{x} + \texttt{c} = 0\). It retains the portion of the polyhedron lying on the positive side of the plane (i.e., where \(\mathbf{n} \cdot \mathbf{x} + \texttt{c} > 0\), consistent with the liquid phase convention) and discards the portion on the negative side.

Fortran:

call inte3d(c,icontn,icontp,ipv,nipv,ntp,nts,ntv,vertp, &
            xnc,xns,ync,yns,znc,zns)

C:

inte3d(&c,&icontn,&icontp,ipv,nipv,&ntp,&nts,&ntv,vertp,
&xnc,xns,&ync,yns,&znc,zns);

Python:

ntp = np.array(ntp, dtype=np.int32)
nts = np.array(nts, dtype=np.int32)
ntv = np.array(ntv, dtype=np.int32)
(icontn,icontp) = voft.inte3d(c,ipv,nipv,ntp,nts,ntv,vertp,xnc,xns,ync,yns,znc,zns)

Arguments:

c

IN

W_P

scalar representing the signed distance from the PLIC interface to the origin along the normal vector \(\boldsymbol{n}\)

icontn

OUT

I_P

number of original polyhedron vertices satisfying \(\mathbf n\cdot\mathbf x+\texttt{c}\leq0\)

icontp

OUT

I_P

number of original polyhedron vertices satisfying \(\mathbf n\cdot\mathbf x+\texttt{c}>0\)

ipv

INOUT

I_P

array of dimensions (ns,nv) storing the vertex indices defining each face boundary; updated for the truncated geometry

nipv

INOUT

I_P

array of length \(\texttt{ns}\) storing the number of vertices per face boundary; updated for the truncated geometry

ntp

INOUT

I_P

maximum vertex index in the connectivity list; updated after truncation

nts

INOUT

I_P

total number of face boundaries; updated after truncation

ntv

INOUT

I_P

total number of vertices; updated after truncation

vertp

INOUT

W_P

array of dimensions \(({nv},3)\) storing the \(x,y,z\)-coordinates of each vertex; updated for the truncated geometry

xnc, ync, znc

IN

W_P

\(x,y,z\)-components of the unit-length vector \(\boldsymbol{n}\) normal to the PLIC interface pointing towards the liquid phase

xns, yns, zns

INOUT

W_P

arrays of length \(\texttt{ns}\) storing the \(x,y,z\)-components of the outward-pointing unit normal vector for each face boundary; updated for the truncated geometry

Note: The geometry is updated only when both icontp and icontn are positive. If \(\texttt{icontn}=0\), the entire polyhedron is retained and the geometry remains unchanged. If \(\texttt{icontp}=0\), the retained volume is zero, but the geometry arrays and size parameters also remain unchanged. The caller must therefore check these counters before using the returned geometry.