本文整理汇总了C++中EntityBase::NormalV方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityBase::NormalV方法的具体用法?C++ EntityBase::NormalV怎么用?C++ EntityBase::NormalV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityBase
的用法示例。
在下文中一共展示了EntityBase::NormalV方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZERO
//-----------------------------------------------------------------------------
// A curve by its parametric equation, helper functions for computing tangent
// arcs by a numerical method.
//-----------------------------------------------------------------------------
void GraphicsWindow::ParametricCurve::MakeFromEntity(hEntity he, bool reverse) {
ZERO(this);
Entity *e = SK.GetEntity(he);
if(e->type == Entity::LINE_SEGMENT) {
isLine = true;
p0 = e->EndpointStart(),
p1 = e->EndpointFinish();
if(reverse) {
SWAP(Vector, p0, p1);
}
} else if(e->type == Entity::ARC_OF_CIRCLE) {
isLine = false;
p0 = SK.GetEntity(e->point[0])->PointGetNum();
Vector pe = SK.GetEntity(e->point[1])->PointGetNum();
r = (pe.Minus(p0)).Magnitude();
e->ArcGetAngles(&theta0, &theta1, &dtheta);
if(reverse) {
SWAP(double, theta0, theta1);
dtheta = -dtheta;
}
EntityBase *wrkpln = SK.GetEntity(e->workplane)->Normal();
u = wrkpln->NormalU();
v = wrkpln->NormalV();
} else {
oops();
}
}
示例2: DrawOrGetDistance
//.........这里部分代码省略.........
for(int a = 0; a < 2; a++) {
Vector r = SS.GW.projRight.ScaledBy((a+1)/SS.GW.scale);
Vector d = SS.GW.projUp.ScaledBy((2-a)/SS.GW.scale);
for(int i = 0; i < 2; i++) {
Vector p = SK.GetEntity(i == 0 ? ptA : ptB)-> PointGetNum();
glBegin(GL_QUADS);
ssglVertex3v(p.Plus (r).Plus (d));
ssglVertex3v(p.Plus (r).Minus(d));
ssglVertex3v(p.Minus(r).Minus(d));
ssglVertex3v(p.Minus(r).Plus (d));
glEnd();
}
}
}
break;
}
case PT_ON_CIRCLE:
case PT_ON_LINE:
case PT_ON_FACE:
case PT_IN_PLANE: {
double s = 8/SS.GW.scale;
Vector p = SK.GetEntity(ptA)->PointGetNum();
Vector r, d;
if(type == PT_ON_FACE) {
Vector n = SK.GetEntity(entityA)->FaceGetNormalNum();
r = n.Normal(0);
d = n.Normal(1);
} else if(type == PT_IN_PLANE) {
EntityBase *n = SK.GetEntity(entityA)->Normal();
r = n->NormalU();
d = n->NormalV();
} else {
r = gr;
d = gu;
s *= (6.0/8); // draw these a little smaller
}
r = r.WithMagnitude(s); d = d.WithMagnitude(s);
LineDrawOrGetDistance(p.Plus (r).Plus (d), p.Plus (r).Minus(d));
LineDrawOrGetDistance(p.Plus (r).Minus(d), p.Minus(r).Minus(d));
LineDrawOrGetDistance(p.Minus(r).Minus(d), p.Minus(r).Plus (d));
LineDrawOrGetDistance(p.Minus(r).Plus (d), p.Plus (r).Plus (d));
break;
}
case WHERE_DRAGGED: {
Vector p = SK.GetEntity(ptA)->PointGetNum(),
u = p.Plus(gu.WithMagnitude(8/SS.GW.scale)).Plus(
gr.WithMagnitude(8/SS.GW.scale)),
uu = u.Minus(gu.WithMagnitude(5/SS.GW.scale)),
ur = u.Minus(gr.WithMagnitude(5/SS.GW.scale));
// Draw four little crop marks, uniformly spaced (by ninety
// degree rotations) around the point.
int i;
for(i = 0; i < 4; i++) {
LineDrawOrGetDistance(u, uu);
LineDrawOrGetDistance(u, ur);
u = u.RotatedAbout(p, gn, PI/2);
ur = ur.RotatedAbout(p, gn, PI/2);
uu = uu.RotatedAbout(p, gn, PI/2);
}
break;
}
示例3: MenuConstrain
//.........这里部分代码省略.........
c.type = SYMMETRIC_LINE;
} else if(SS.GW.LockedInWorkplane()
&& gs.lineSegments == 1 && gs.points == 2 && gs.n == 3)
{
c.ptA = gs.point[0];
c.ptB = gs.point[1];
c.entityA = gs.entity[0];
c.type = SYMMETRIC_LINE;
} else {
Error("Bad selection for symmetric constraint. This constraint "
"can apply to:\n\n"
" * two points or a line segment "
"(symmetric about workplane's coordinate axis)\n"
" * line segment, and two points or a line segment "
"(symmetric about line segment)\n"
" * workplane, and two points or a line segment "
"(symmetric about workplane)\n");
return;
}
if(c.type != 0) {
// Already done, symmetry about a line segment in a workplane
} else if(c.entityA.v == Entity::NO_ENTITY.v) {
// Horizontal / vertical symmetry, implicit symmetry plane
// normal to the workplane
if(c.workplane.v == Entity::FREE_IN_3D.v) {
Error("Must be locked in to workplane when constraining "
"symmetric without an explicit symmetry plane.");
return;
}
Vector pa = SK.GetEntity(c.ptA)->PointGetNum();
Vector pb = SK.GetEntity(c.ptB)->PointGetNum();
Vector dp = pa.Minus(pb);
EntityBase *norm = SK.GetEntity(c.workplane)->Normal();;
Vector u = norm->NormalU(), v = norm->NormalV();
if(fabs(dp.Dot(u)) > fabs(dp.Dot(v))) {
c.type = SYMMETRIC_HORIZ;
} else {
c.type = SYMMETRIC_VERT;
}
if(gs.lineSegments == 1) {
// If this line segment is already constrained horiz or
// vert, then auto-remove that redundant constraint.
DeleteAllConstraintsFor(HORIZONTAL, (gs.entity[0]),
Entity::NO_ENTITY);
DeleteAllConstraintsFor(VERTICAL, (gs.entity[0]),
Entity::NO_ENTITY);
}
} else {
// Symmetry with a symmetry plane specified explicitly.
c.type = SYMMETRIC;
}
AddConstraint(&c);
break;
case GraphicsWindow::MNU_VERTICAL:
case GraphicsWindow::MNU_HORIZONTAL: {
hEntity ha, hb;
if(c.workplane.v == Entity::FREE_IN_3D.v) {
Error("Select workplane before constraining horiz/vert.");
return;
}
if(gs.lineSegments == 1 && gs.n == 1) {
c.entityA = gs.entity[0];
Entity *e = SK.GetEntity(c.entityA);
ha = e->point[0];