本文整理汇总了C++中Plane::ClipEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::ClipEdge方法的具体用法?C++ Plane::ClipEdge怎么用?C++ Plane::ClipEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::ClipEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clip
/**
* @brief
* Clips the polygon against a plane
*/
Polygon Polygon::Clip(const Plane &cPlane) const
{
uint32 nNumOfVertices = m_lstVertices.GetNumOfElements();
Polygon cClipped;
// Loop through all vertices of this polygon
for (uint32 i=0; i<nNumOfVertices; i++) {
// The 2 vertices of an edge
const Vector3 &vA = m_lstVertices[i];
const Vector3 &vB = m_lstVertices[(i+1) % nNumOfVertices];
// Check on which side of the plane the vertices are on
Plane::ESide nSideA = cPlane.GetSide(vA);
Plane::ESide nSideB = cPlane.GetSide(vB);
// Clip
if (nSideA == Plane::InFront || nSideA == Plane::Coinciding) {
cClipped.AddVertex(vA);
if (nSideB == Plane::Behind)
cClipped.AddVertex(cPlane.ClipEdge(vA, vB));
} else if (nSideB == Plane::InFront) {
cClipped.AddVertex(cPlane.ClipEdge(vA, vB));
cClipped.AddVertex(vB);
}
}
// Return the clipped polygon
return cClipped;
}