本文整理汇总了C++中Facet::NextFacet方法的典型用法代码示例。如果您正苦于以下问题:C++ Facet::NextFacet方法的具体用法?C++ Facet::NextFacet怎么用?C++ Facet::NextFacet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facet
的用法示例。
在下文中一共展示了Facet::NextFacet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stellate
void stellate (Scene &body, float height)
//
// Adds starlike jags to every facet of the body. The tip
// of a jag is placed in the given height over the center
// of the facet.
//
{
float nx,ny,nz,nk,nn,cx,cy,cz,h;
Vertex* tip;
Facet* f;
int i,j,n;
Scene stella;
for (f = body.TheFacets(); f; f = f->NextFacet() ) {
// calculate the normal form and the center of the facet
f->Normal(nx,ny,nz,nk);
f->Center(cx,cy,cz);
// normalization of the normal vector to unit length
nn = hypot(nx,ny,nz);
// check if facet is degenerate
if (nn == 0) continue;
// add the tip vertex of the jag
h = height / nn;
tip = &stella.AddVertex( cx+h*nx, cy+h*ny, cz+h*nz );
// add three-sided facets for each side of the jag
n = f->GetNumVertices();
for (i = 0, j = n-1; i < n; j = i++) {
Facet& s = stella.AddFacet(3);
s(0) = &stella.AddVertex( *(*f)(j) );
s(1) = &stella.AddVertex( *(*f)(i) );
s(2) = tip;
}
}
// now clear the original
body.Remove();
// and add the stellated body instead (duplicate vertices are now removed)
body.AddScene(stella,Identity);
}