Skip to content

Commit 1464c4b

Browse files
Peter RuevskiPeter Ruevski
authored andcommitted
NFC: When passing a zero vector as a parameter use {0, 0, 0} instead of {}
In addition unify `Vector` variable initialization style.
1 parent c4ceeb5 commit 1464c4b

14 files changed

Lines changed: 24 additions & 24 deletions

src/clipboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
209209
// Likewise the scale, which could otherwise take us out of the
210210
// workplane.
211211
pt = pt.ScaledBy(fabs(scale));
212-
pt = pt.ScaleOutOfCsys(u, v, {});
212+
pt = pt.ScaleOutOfCsys(u, v, {0, 0, 0});
213213
pt = pt.Plus(p);
214214
pt = pt.RotatedAbout(n, theta);
215215
pt = pt.Plus(trans);

src/drawconstraint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ void Constraint::DoLayout(DrawAs how, Canvas *canvas,
886886
}
887887

888888
case Type::PERPENDICULAR: {
889-
Vector u{}, v{};
889+
Vector u = {}, v = {};
890890
Vector rn, ru;
891891
if(workplane == Entity::FREE_IN_3D) {
892892
rn = gn;

src/drawentity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ void Entity::ComputeInterpolatingSpline(SBezierList *sbl, bool periodic) const {
263263

264264
// The starting and finishing control points that define our end tangents
265265
// (if the spline isn't periodic), and the on-curve points.
266-
Vector ctrl_s{};
267-
Vector ctrl_f{};
266+
Vector ctrl_s = {};
267+
Vector ctrl_f = {};
268268
Vector pt[MAX_N+4];
269269
if(periodic) {
270270
for(i = 0; i < ep + 3; i++) {

src/export.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ void SolveSpaceUI::ExportViewOrWireframeTo(const Platform::Path &filename, bool
246246
}
247247

248248
if(exportWireframe) {
249-
Vector u{1.0, 0.0, 0.0},
250-
v{0.0, 1.0, 0.0},
251-
n{0.0, 0.0, 1.0},
252-
origin{};
249+
Vector u = {1.0, 0.0, 0.0},
250+
v = {0.0, 1.0, 0.0},
251+
n = {0.0, 0.0, 1.0},
252+
origin = {};
253253
double cameraTan = 0.0,
254254
scale = 1.0;
255255

src/exportvector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,10 @@ class DxfWriteInterface : public DRW_Interface {
311311
int findDxfColor(const RgbaColor &src) {
312312
int best = 0;
313313
double minDist = VERY_POSITIVE;
314-
Vector srcv = {src.redF(), src.greenF(), src.blueF()};
314+
Vector srcv = {src.redF(), src.greenF(), src.blueF()};
315315
for(int i = 1; i < 256; i++) {
316316
RgbaColor dst = RGBi(DRW::dxfColors[i][0], DRW::dxfColors[i][1], DRW::dxfColors[i][2]);
317-
Vector dstv = {dst.redF(), dst.greenF(), dst.blueF()};
317+
Vector dstv = {dst.redF(), dst.greenF(), dst.blueF()};
318318
double dist = srcv.Minus(dstv).Magnitude();
319319
if(dist < minDist || best == 0) {
320320
best = i;

src/generate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ void SolveSpaceUI::ForceReferences() {
421421
Entity *wrkpl = SK.GetEntity(hr.entity(0));
422422
// The origin for our coordinate system, always zero
423423
Entity *origin = SK.GetEntity(wrkpl->point[0]);
424-
origin->PointForceTo({});
424+
origin->PointForceTo({0, 0, 0});
425425
origin->construction = true;
426426
SK.GetParam(origin->param[0])->known = true;
427427
SK.GetParam(origin->param[1])->known = true;

src/graphicswin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ void GraphicsWindow::MenuEdit(Command id) {
12161216
norm = norm.WithMagnitude(1);
12171217
Quaternion qaa = Quaternion::From(norm, PI/2);
12181218

1219-
g->TransformImportedBy({}, qaa);
1219+
g->TransformImportedBy({0, 0, 0}, qaa);
12201220

12211221
// and regenerate as necessary.
12221222
SS.MarkGroupDirty(hg);

src/group.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ void Group::MakeRevolveEndFaces(EntityList *el, hEntity pt, int ai, int af)
10021002

10031003
// When there is no loop normal (e.g. if the loop is broken), use normal of workplane
10041004
// as fallback, to avoid breaking constraints depending on the faces.
1005-
if(n.Equals({}) && src->type == Group::Type::DRAWING_WORKPLANE) {
1005+
if(n.Equals({0, 0, 0}) && src->type == Group::Type::DRAWING_WORKPLANE) {
10061006
n = SK.GetEntity(src->h.entity(0))->Normal()->NormalN();
10071007
}
10081008

@@ -1039,7 +1039,7 @@ void Group::MakeExtrusionTopBottomFaces(EntityList *el, hEntity pt)
10391039

10401040
// When there is no loop normal (e.g. if the loop is broken), use normal of workplane
10411041
// as fallback, to avoid breaking constraints depending on the faces.
1042-
if(n.Equals({}) && src->type == Group::Type::DRAWING_WORKPLANE) {
1042+
if(n.Equals({0, 0, 0}) && src->type == Group::Type::DRAWING_WORKPLANE) {
10431043
n = SK.GetEntity(src->h.entity(0))->Normal()->NormalN();
10441044
}
10451045

src/importidf.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
339339

340340
hEntity hprev;
341341
hEntity hprevTop;
342-
Vector pprev{};
343-
Vector pprevTop{};
342+
Vector pprev = {};
343+
Vector pprevTop = {};
344344

345345
double board_thickness = 10.0;
346346
double scale = 1.0; //mm
@@ -522,7 +522,7 @@ bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
522522
double ctc = SS.chordTolCalculated;
523523
if(ctc == 0.0) SS.chordTolCalculated = 0.1; //mm
524524
// there should only by one sbls in the sblss unless a board has disjointed parts...
525-
sh->MakeFromExtrusionOf(sblss.l.First(), {},
525+
sh->MakeFromExtrusionOf(sblss.l.First(), {0, 0, 0},
526526
{0.0, 0.0, board_thickness},
527527
RgbaColor::From(0, 180, 0) );
528528
SS.chordTolCalculated = ctc;

src/importmesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static hEntity newNormal(EntityList *el, int *id, Quaternion normal, hEntity p)
8787
en.construction = false;
8888
en.style.v = Style::NORMALS;
8989
// to be visible we need to add a point.
90-
// en.point[0] = newPoint(el, id, {});
90+
// en.point[0] = newPoint(el, id, {0, 0, 0});
9191
en.point[0] = p;
9292
en.actVisible = true;
9393
en.forceHidden = false;

0 commit comments

Comments
 (0)