本文整理汇总了C++中SSurface::EdgeNormalsWithinSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ SSurface::EdgeNormalsWithinSurface方法的具体用法?C++ SSurface::EdgeNormalsWithinSurface怎么用?C++ SSurface::EdgeNormalsWithinSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSurface
的用法示例。
在下文中一共展示了SSurface::EdgeNormalsWithinSurface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeCopyTrimAgainst
//.........这里部分代码省略.........
} else {
if(sc->surfB.v != h.v || sc->surfA.v != ss->h.v) continue;
}
int i;
for(i = 1; i < sc->pts.n; i++) {
Vector a = sc->pts.elem[i-1].p,
b = sc->pts.elem[i].p;
Point2d auv, buv;
ss->ClosestPointTo(a, &(auv.x), &(auv.y));
ss->ClosestPointTo(b, &(buv.x), &(buv.y));
int c = (ss->bsp) ? ss->bsp->ClassifyEdge(auv, buv, ss) : SBspUv::OUTSIDE;
if(c != SBspUv::OUTSIDE) {
Vector ta = Vector::From(0, 0, 0);
Vector tb = Vector::From(0, 0, 0);
ret.ClosestPointTo(a, &(ta.x), &(ta.y));
ret.ClosestPointTo(b, &(tb.x), &(tb.y));
Vector tn = ret.NormalAt(ta.x, ta.y);
Vector sn = ss->NormalAt(auv.x, auv.y);
// We are subtracting the portion of our surface that
// lies in the shell, so the in-plane edge normal should
// point opposite to the surface normal.
bool bkwds = true;
if((tn.Cross(b.Minus(a))).Dot(sn) < 0) bkwds = !bkwds;
if(type == SShell::AS_DIFFERENCE && !opA) bkwds = !bkwds;
if(bkwds) {
inter.AddEdge(tb, ta, sc->h.v, 1);
} else {
inter.AddEdge(ta, tb, sc->h.v, 0);
}
}
}
}
}
// Record all the points where more than two edges join, which I will call
// the choosing points. If two edges join at a non-choosing point, then
// they must either both be kept or both be discarded (since that would
// otherwise create an open contour).
SPointList choosing = {};
SEdge *se;
for(se = orig.l.First(); se; se = orig.l.NextAfter(se)) {
choosing.IncrementTagFor(se->a);
choosing.IncrementTagFor(se->b);
}
for(se = inter.l.First(); se; se = inter.l.NextAfter(se)) {
choosing.IncrementTagFor(se->a);
choosing.IncrementTagFor(se->b);
}
SPoint *sp;
for(sp = choosing.l.First(); sp; sp = choosing.l.NextAfter(sp)) {
if(sp->tag == 2) {
sp->tag = 1;
} else {
sp->tag = 0;
}
}
choosing.l.RemoveTagged();
// The list of edges to trim our new surface, a combination of edges from
// our original and intersecting edge lists.
SEdgeList final = {};
while(orig.l.n > 0) {
SEdgeList chain = {};
FindChainAvoiding(&orig, &chain, &choosing);
// Arbitrarily choose an edge within the chain to classify; they
// should all be the same, though.
se = &(chain.l.elem[chain.l.n/2]);
Point2d auv = (se->a).ProjectXy(),
buv = (se->b).ProjectXy();
Vector pt, enin, enout, surfn;
ret.EdgeNormalsWithinSurface(auv, buv, &pt, &enin, &enout, &surfn,
se->auxA, into, sha, shb);
int indir_shell, outdir_shell, indir_orig, outdir_orig;
indir_orig = SShell::INSIDE;
outdir_orig = SShell::OUTSIDE;
agnst->ClassifyEdge(&indir_shell, &outdir_shell,
ret.PointAt(auv), ret.PointAt(buv), pt,
enin, enout, surfn);
if(KeepEdge(type, opA, indir_shell, outdir_shell,
indir_orig, outdir_orig))
{
for(se = chain.l.First(); se; se = chain.l.NextAfter(se)) {
final.AddEdge(se->a, se->b, se->auxA, se->auxB);
}
}
chain.Clear();
}