本文整理汇总了C++中Entity::CircleGetRadiusNum方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::CircleGetRadiusNum方法的具体用法?C++ Entity::CircleGetRadiusNum怎么用?C++ Entity::CircleGetRadiusNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::CircleGetRadiusNum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateEntityBBox
BBox Sketch::CalculateEntityBBox(bool includingInvisible) {
BBox box = {};
bool first = true;
for(int i = 0; i < entity.n; i++) {
Entity *e = (Entity *)&entity.elem[i];
if(!(e->IsVisible() || includingInvisible)) continue;
Vector point;
double r = 0.0;
if(e->IsPoint()) {
point = e->PointGetNum();
} else {
switch(e->type) {
case Entity::ARC_OF_CIRCLE:
case Entity::CIRCLE:
r = e->CircleGetRadiusNum();
point = GetEntity(e->point[0])->PointGetNum();
break;
default: continue;
}
}
if(first) {
box.minp = point;
box.maxp = point;
box.Include(point, r);
first = false;
} else {
box.Include(point, r);
}
}
return box;
}
示例2: DoEqualRadiusTicks
void Constraint::DoEqualRadiusTicks(hEntity he) {
Entity *circ = SK.GetEntity(he);
Vector center = SK.GetEntity(circ->point[0])->PointGetNum();
double r = circ->CircleGetRadiusNum();
Quaternion q = circ->Normal()->NormalGetNum();
Vector u = q.RotationU(), v = q.RotationV();
double theta;
if(circ->type == Entity::CIRCLE) {
theta = PI/2;
} else if(circ->type == Entity::ARC_OF_CIRCLE) {
double thetaa, thetab, dtheta;
circ->ArcGetAngles(&thetaa, &thetab, &dtheta);
theta = thetaa + dtheta/2;
} else oops();
Vector d = u.ScaledBy(cos(theta)).Plus(v.ScaledBy(sin(theta)));
d = d.ScaledBy(r);
Vector p = center.Plus(d);
Vector tick = d.WithMagnitude(10/SS.GW.scale);
LineDrawOrGetDistance(p.Plus(tick), p.Minus(tick));
}
示例3: DrawOrGetDistance
//.........这里部分代码省略.........
DoProjectedPoint(&pt);
}
// Find the closest point on the line
Vector closest = pt.ClosestPointOnLine(lA, dl);
Vector ref = ((closest.Plus(pt)).ScaledBy(0.5)).Plus(disp.offset);
DoLabel(ref, labelPos, gr, gu);
if(!pt.Equals(closest)) {
DoLineWithArrows(ref, pt, closest, true);
}
if(workplane.v != Entity::FREE_IN_3D.v) {
// Draw the projection marker from the closest point on the
// projected line to the projected point on the real line.
Vector lAB = (lA.Minus(lB));
double t = (lA.Minus(closest)).DivPivoting(lAB);
Vector lA = SK.GetEntity(line->point[0])->PointGetNum();
Vector lB = SK.GetEntity(line->point[1])->PointGetNum();
Vector c2 = (lA.ScaledBy(1-t)).Plus(lB.ScaledBy(t));
DoProjectedPoint(&c2);
}
break;
}
case DIAMETER: {
Entity *circle = SK.GetEntity(entityA);
Vector center = SK.GetEntity(circle->point[0])->PointGetNum();
Quaternion q = SK.GetEntity(circle->normal)->NormalGetNum();
Vector n = q.RotationN().WithMagnitude(1);
double r = circle->CircleGetRadiusNum();
Vector ref = center.Plus(disp.offset);
// Force the label into the same plane as the circle.
ref = ref.Minus(n.ScaledBy(n.Dot(ref) - n.Dot(center)));
Vector mark = ref.Minus(center);
mark = mark.WithMagnitude(mark.Magnitude()-r);
DoLineTrimmedAgainstBox(ref, ref, ref.Minus(mark));
Vector topLeft;
DoLabel(ref, &topLeft, gr, gu);
if(labelPos) *labelPos = topLeft;
// Show this as diameter or radius?
if(!other) {
// Draw the diameter symbol
Vector dc = topLeft;
dc = dc.Plus(gu.WithMagnitude(5/SS.GW.scale));
dc = dc.Plus(gr.WithMagnitude(9/SS.GW.scale));
double dr = 5/SS.GW.scale;
double theta, dtheta = (2*PI)/12;
for(theta = 0; theta < 2*PI-0.01; theta += dtheta) {
LineDrawOrGetDistance(
dc.Plus(gu.WithMagnitude(cos(theta)*dr)).Plus(
gr.WithMagnitude(sin(theta)*dr)),
dc.Plus(gu.WithMagnitude(cos(theta+dtheta)*dr)).Plus(
gr.WithMagnitude(sin(theta+dtheta)*dr)));
}
theta = 25*(PI/180);
dr *= 1.7;
dtheta = PI;
LineDrawOrGetDistance(
示例4: DescribeSelection
void TextWindow::DescribeSelection(void) {
Entity *e;
Vector p;
int i;
Printf(false, "");
if(gs.n == 1 && (gs.points == 1 || gs.entities == 1)) {
e = SK.GetEntity(gs.points == 1 ? gs.point[0] : gs.entity[0]);
#define COSTR(p) \
SS.MmToString((p).x), SS.MmToString((p).y), SS.MmToString((p).z)
#define PT_AS_STR "(%Fi%s%E, %Fi%s%E, %Fi%s%E)"
#define PT_AS_NUM "(%Fi%3%E, %Fi%3%E, %Fi%3%E)"
switch(e->type) {
case Entity::POINT_IN_3D:
case Entity::POINT_IN_2D:
case Entity::POINT_N_TRANS:
case Entity::POINT_N_ROT_TRANS:
case Entity::POINT_N_COPY:
case Entity::POINT_N_ROT_AA:
p = e->PointGetNum();
Printf(false, "%FtPOINT%E at " PT_AS_STR, COSTR(p));
break;
case Entity::NORMAL_IN_3D:
case Entity::NORMAL_IN_2D:
case Entity::NORMAL_N_COPY:
case Entity::NORMAL_N_ROT:
case Entity::NORMAL_N_ROT_AA: {
Quaternion q = e->NormalGetNum();
p = q.RotationN();
Printf(false, "%FtNORMAL / COORDINATE SYSTEM%E");
Printf(true, " basis n = " PT_AS_NUM, CO(p));
p = q.RotationU();
Printf(false, " u = " PT_AS_NUM, CO(p));
p = q.RotationV();
Printf(false, " v = " PT_AS_NUM, CO(p));
break;
}
case Entity::WORKPLANE: {
p = SK.GetEntity(e->point[0])->PointGetNum();
Printf(false, "%FtWORKPLANE%E");
Printf(true, " origin = " PT_AS_STR, COSTR(p));
Quaternion q = e->Normal()->NormalGetNum();
p = q.RotationN();
Printf(true, " normal = " PT_AS_NUM, CO(p));
break;
}
case Entity::LINE_SEGMENT: {
Vector p0 = SK.GetEntity(e->point[0])->PointGetNum();
p = p0;
Printf(false, "%FtLINE SEGMENT%E");
Printf(true, " thru " PT_AS_STR, COSTR(p));
Vector p1 = SK.GetEntity(e->point[1])->PointGetNum();
p = p1;
Printf(false, " " PT_AS_STR, COSTR(p));
Printf(true, " len = %Fi%s%E",
SS.MmToString((p1.Minus(p0).Magnitude())));
break;
}
case Entity::CUBIC_PERIODIC:
case Entity::CUBIC:
int pts;
if(e->type == Entity::CUBIC_PERIODIC) {
Printf(false, "%FtPERIODIC C2 CUBIC SPLINE%E");
pts = (3 + e->extraPoints);
} else if(e->extraPoints > 0) {
Printf(false, "%FtINTERPOLATING C2 CUBIC SPLINE%E");
pts = (4 + e->extraPoints);
} else {
Printf(false, "%FtCUBIC BEZIER CURVE%E");
pts = 4;
}
for(i = 0; i < pts; i++) {
p = SK.GetEntity(e->point[i])->PointGetNum();
Printf((i==0), " p%d = " PT_AS_STR, i, COSTR(p));
}
break;
case Entity::ARC_OF_CIRCLE: {
Printf(false, "%FtARC OF A CIRCLE%E");
p = SK.GetEntity(e->point[0])->PointGetNum();
Printf(true, " center = " PT_AS_STR, COSTR(p));
p = SK.GetEntity(e->point[1])->PointGetNum();
Printf(true, " endpoints = " PT_AS_STR, COSTR(p));
p = SK.GetEntity(e->point[2])->PointGetNum();
Printf(false, " " PT_AS_STR, COSTR(p));
double r = e->CircleGetRadiusNum();
Printf(true, " diameter = %Fi%s", SS.MmToString(r*2));
Printf(false, " radius = %Fi%s", SS.MmToString(r));
double thetas, thetaf, dtheta;
e->ArcGetAngles(&thetas, &thetaf, &dtheta);
Printf(false, " arc len = %Fi%s", SS.MmToString(dtheta*r));
break;
}
case Entity::CIRCLE: {
Printf(false, "%FtCIRCLE%E");
p = SK.GetEntity(e->point[0])->PointGetNum();
Printf(true, " center = " PT_AS_STR, COSTR(p));
double r = e->CircleGetRadiusNum();
//.........这里部分代码省略.........