本文整理汇总了C++中Entity::GenerateEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GenerateEdges方法的具体用法?C++ Entity::GenerateEdges怎么用?C++ Entity::GenerateEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GenerateEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectByMarquee
//-----------------------------------------------------------------------------
// Select everything that lies within the marquee view-aligned rectangle. For
// points, we test by the point location. For normals, we test by the normal's
// associated point. For anything else, we test by any piecewise linear edge.
//-----------------------------------------------------------------------------
void GraphicsWindow::SelectByMarquee(void) {
Point2d begin = ProjectPoint(orig.marqueePoint);
double xmin = min(orig.mouse.x, begin.x),
xmax = max(orig.mouse.x, begin.x),
ymin = min(orig.mouse.y, begin.y),
ymax = max(orig.mouse.y, begin.y);
Entity *e;
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
if(e->group.v != SS.GW.activeGroup.v) continue;
if(e->IsFace() || e->IsDistance()) continue;
if(!e->IsVisible()) continue;
if(e->IsPoint() || e->IsNormal()) {
Vector p = e->IsPoint() ? e->PointGetNum() :
SK.GetEntity(e->point[0])->PointGetNum();
Point2d pp = ProjectPoint(p);
if(pp.x >= xmin && pp.x <= xmax &&
pp.y >= ymin && pp.y <= ymax)
{
MakeSelected(e->h);
}
} else {
// Use the 3d bounding box test routines, to avoid duplication;
// so let our bounding square become a bounding box that certainly
// includes the z = 0 plane.
Vector ptMin = Vector::From(xmin, ymin, -1),
ptMax = Vector::From(xmax, ymax, 1);
SEdgeList sel;
ZERO(&sel);
e->GenerateEdges(&sel, true);
SEdge *se;
for(se = sel.l.First(); se; se = sel.l.NextAfter(se)) {
Point2d ppa = ProjectPoint(se->a),
ppb = ProjectPoint(se->b);
Vector ptA = Vector::From(ppa.x, ppa.y, 0),
ptB = Vector::From(ppb.x, ppb.y, 0);
if(Vector::BoundingBoxIntersectsLine(ptMax, ptMin,
ptA, ptB, true) ||
!ptA.OutsideAndNotOn(ptMax, ptMin) ||
!ptB.OutsideAndNotOn(ptMax, ptMin))
{
MakeSelected(e->h);
break;
}
}
sel.Clear();
}
}
}
示例2: ExportViewOrWireframeTo
void SolveSpace::ExportViewOrWireframeTo(char *filename, bool wireframe) {
int i;
SEdgeList edges;
ZERO(&edges);
SBezierList beziers;
ZERO(&beziers);
SMesh *sm = NULL;
if(SS.GW.showShaded) {
Group *g = SK.GetGroup(SS.GW.activeGroup);
g->GenerateDisplayItems();
sm = &(g->displayMesh);
}
if(sm && sm->IsEmpty()) {
sm = NULL;
}
for(i = 0; i < SK.entity.n; i++) {
Entity *e = &(SK.entity.elem[i]);
if(!e->IsVisible()) continue;
if(e->construction) continue;
if(SS.exportPwlCurves || (sm && !SS.GW.showHdnLines) ||
fabs(SS.exportOffset) > LENGTH_EPS)
{
// We will be doing hidden line removal, which we can't do on
// exact curves; so we need things broken down to pwls. Same
// problem with cutter radius compensation.
e->GenerateEdges(&edges);
} else {
e->GenerateBezierCurves(&beziers);
}
}
if(SS.GW.showEdges) {
Group *g = SK.GetGroup(SS.GW.activeGroup);
g->GenerateDisplayItems();
SEdgeList *selr = &(g->displayEdges);
SEdge *se;
for(se = selr->l.First(); se; se = selr->l.NextAfter(se)) {
edges.AddEdge(se->a, se->b, Style::SOLID_EDGE);
}
}
if(SS.GW.showConstraints) {
Constraint *c;
for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
c->GetEdges(&edges);
}
}
if(wireframe) {
VectorFileWriter *out = VectorFileWriter::ForFile(filename);
if(out) {
ExportWireframeCurves(&edges, &beziers, out);
}
} else {
Vector u = SS.GW.projRight,
v = SS.GW.projUp,
n = u.Cross(v),
origin = SS.GW.offset.ScaledBy(-1);
VectorFileWriter *out = VectorFileWriter::ForFile(filename);
if(out) {
ExportLinesAndMesh(&edges, &beziers, sm,
u, v, n, origin, SS.CameraTangent()*SS.GW.scale,
out);
}
if(out && !out->HasCanvasSize()) {
// These file formats don't have a canvas size, so they just
// get exported in the raw coordinate system. So indicate what
// that was on-screen.
SS.justExportedInfo.draw = true;
SS.justExportedInfo.pt = origin;
SS.justExportedInfo.u = u;
SS.justExportedInfo.v = v;
InvalidateGraphics();
}
}
edges.Clear();
beziers.Clear();
}