GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use C++ std::{min,max,swap} instead of custom ones. · realthunder/solvespace@28166e6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • bsp.cpp
    • confscreen.cpp
    • constraint.cpp
    • constrainteq.cpp
    • drawconstraint.cpp
    • dsc.h
    • export.cpp
    • exportvector.cpp
    • graphicswin.cpp
    • group.cpp
    • groupmesh.cpp
    • mesh.cpp
    • modify.cpp
    • polygon.cpp
    • solvespace.h
    • srf
      • boolean.cpp
      • curve.cpp
      • raycast.cpp
      • surface.cpp
      • surfinter.cpp
    • style.cpp
    • system.cpp
    • textwin.cpp
    • ttf.cpp
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/bsp.cpp‎

Copy file name to clipboardExpand all lines: src/bsp.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SBsp3 *SBsp3::FromMesh(SMesh *m) {
2525
while(n > 1) {
2626
int k = rand() % n;
2727
n--;
28-
SWAP(STriangle, mc.l.elem[k], mc.l.elem[n]);
28+
swap(mc.l.elem[k], mc.l.elem[n]);
2929
}
3030

3131
for(i = 0; i < mc.l.n; i++) {
Collapse file

‎src/confscreen.cpp‎

Copy file name to clipboardExpand all lines: src/confscreen.cpp
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void TextWindow::ShowConfiguration(void) {
316316
bool TextWindow::EditControlDoneForConfiguration(const char *s) {
317317
switch(edit.meaning) {
318318
case EDIT_LIGHT_INTENSITY:
319-
SS.lightIntensity[edit.i] = min(1, max(0, atof(s)));
319+
SS.lightIntensity[edit.i] = min(1.0, max(0.0, atof(s)));
320320
InvalidateGraphics();
321321
break;
322322

@@ -341,7 +341,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
341341
break;
342342
}
343343
case EDIT_CHORD_TOLERANCE: {
344-
SS.chordTol = min(10, max(0.1, atof(s)));
344+
SS.chordTol = min(10.0, max(0.1, atof(s)));
345345
SS.GenerateAll(0, INT_MAX);
346346
break;
347347
}
@@ -351,7 +351,7 @@ bool TextWindow::EditControlDoneForConfiguration(const char *s) {
351351
break;
352352
}
353353
case EDIT_CAMERA_TANGENT: {
354-
SS.cameraTangent = (min(2, max(0, atof(s))))/1000.0;
354+
SS.cameraTangent = (min(2.0, max(0.0, atof(s))))/1000.0;
355355
if(!SS.usePerspectiveProj) {
356356
Message("The perspective factor will have no effect until you "
357357
"enable View -> Use Perspective Projection.");
Collapse file

‎src/constraint.cpp‎

Copy file name to clipboardExpand all lines: src/constraint.cpp
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void Constraint::MenuConstrain(int id) {
369369
if((l1->group.v != SS.GW.activeGroup.v) ||
370370
(l1->construction && !(l0->construction)))
371371
{
372-
SWAP(Entity *, l0, l1);
372+
swap(l0, l1);
373373
}
374374
c.ptA = l1->point[0];
375375
c.ptB = l1->point[1];
@@ -476,7 +476,7 @@ void Constraint::MenuConstrain(int id) {
476476
Entity *nfree = SK.GetEntity(c.entityA);
477477
Entity *nref = SK.GetEntity(c.entityB);
478478
if(nref->group.v == SS.GW.activeGroup.v) {
479-
SWAP(Entity *, nref, nfree);
479+
swap(nref, nfree);
480480
}
481481
if(nfree->group.v == SS.GW.activeGroup.v &&
482482
nref ->group.v != SS.GW.activeGroup.v)
@@ -491,7 +491,7 @@ void Constraint::MenuConstrain(int id) {
491491
// There might be an odd*90 degree rotation about the
492492
// normal vector; allow that, since the numerical
493493
// constraint does
494-
SWAP(Vector, ru, rv);
494+
swap(ru, rv);
495495
}
496496
fu = fu.Dot(ru) > 0 ? ru : ru.ScaledBy(-1);
497497
fv = fv.Dot(rv) > 0 ? rv : rv.ScaledBy(-1);
@@ -582,7 +582,7 @@ void Constraint::MenuConstrain(int id) {
582582
Entity *line = SK.GetEntity(gs.entity[0]);
583583
Entity *arc = SK.GetEntity(gs.entity[1]);
584584
if(line->type == Entity::ARC_OF_CIRCLE) {
585-
SWAP(Entity *, line, arc);
585+
swap(line, arc);
586586
}
587587
Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(),
588588
l1 = SK.GetEntity(line->point[1])->PointGetNum();
@@ -606,7 +606,7 @@ void Constraint::MenuConstrain(int id) {
606606
Entity *line = SK.GetEntity(gs.entity[0]);
607607
Entity *cubic = SK.GetEntity(gs.entity[1]);
608608
if(line->type == Entity::CUBIC) {
609-
SWAP(Entity *, line, cubic);
609+
swap(line, cubic);
610610
}
611611
Vector l0 = SK.GetEntity(line->point[0])->PointGetNum(),
612612
l1 = SK.GetEntity(line->point[1])->PointGetNum();
Collapse file

‎src/constrainteq.cpp‎

Copy file name to clipboardExpand all lines: src/constrainteq.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
592592
EntityBase *a = SK.GetEntity(entityA);
593593
EntityBase *b = SK.GetEntity(entityB);
594594
if(b->group.v != group.v) {
595-
SWAP(EntityBase *, a, b);
595+
swap(a, b);
596596
}
597597

598598
ExprVector au = a->NormalExprsU(),
@@ -744,7 +744,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
744744
case PARALLEL: {
745745
EntityBase *ea = SK.GetEntity(entityA), *eb = SK.GetEntity(entityB);
746746
if(eb->group.v != group.v) {
747-
SWAP(EntityBase *, ea, eb);
747+
swap(ea, eb);
748748
}
749749
ExprVector a = ea->VectorGetExprs();
750750
ExprVector b = eb->VectorGetExprs();
Collapse file

‎src/drawconstraint.cpp‎

Copy file name to clipboardExpand all lines: src/drawconstraint.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
727727
// a bit of bias to stop it from flickering between the
728728
// two possibilities
729729
if(fabs(u.Dot(ru)) < fabs(v.Dot(ru)) + LENGTH_EPS) {
730-
SWAP(Vector, u, v);
730+
swap(u, v);
731731
}
732732
if(u.Dot(ru) < 0) u = u.ScaledBy(-1);
733733
}
Collapse file

‎src/dsc.h‎

Copy file name to clipboardExpand all lines: src/dsc.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class List {
216216
void Reverse(void) {
217217
int i;
218218
for(i = 0; i < (n/2); i++) {
219-
SWAP(T, elem[i], elem[(n-1)-i]);
219+
swap(elem[i], elem[(n-1)-i]);
220220
}
221221
}
222222
};
Collapse file

‎src/export.cpp‎

Copy file name to clipboardExpand all lines: src/export.cpp
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void SolveSpaceUI::ExportSectionTo(const char *filename) {
4848
vt = vt.WithMagnitude(1);
4949

5050
if(fabs(SS.GW.projUp.Dot(vt)) < fabs(SS.GW.projUp.Dot(ut))) {
51-
SWAP(Vector, ut, vt);
51+
swap(ut, vt);
5252
}
5353
if(SS.GW.projRight.Dot(ut) < 0) ut = ut.ScaledBy(-1);
5454
if(SS.GW.projUp. Dot(vt) < 0) vt = vt.ScaledBy(-1);
@@ -280,11 +280,11 @@ void SolveSpaceUI::ExportLinesAndMesh(SEdgeList *sel, SBezierList *sbl, SMesh *s
280280
// And calculate lighting for the triangle
281281
Vector n = tt.Normal().WithMagnitude(1);
282282
double lighting = SS.ambientIntensity +
283-
max(0, (SS.lightIntensity[0])*(n.Dot(l0))) +
284-
max(0, (SS.lightIntensity[1])*(n.Dot(l1)));
285-
double r = min(1, tt.meta.color.redF() *lighting),
286-
g = min(1, tt.meta.color.greenF()*lighting),
287-
b = min(1, tt.meta.color.blueF() *lighting);
283+
max(0.0, (SS.lightIntensity[0])*(n.Dot(l0))) +
284+
max(0.0, (SS.lightIntensity[1])*(n.Dot(l1)));
285+
double r = min(1.0, tt.meta.color.redF() * lighting),
286+
g = min(1.0, tt.meta.color.greenF() * lighting),
287+
b = min(1.0, tt.meta.color.blueF() * lighting);
288288
tt.meta.color = RGBf(r, g, b);
289289
smp.AddTriangle(&tt);
290290
}
Collapse file

‎src/exportvector.cpp‎

Copy file name to clipboardExpand all lines: src/exportvector.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void DxfFileWriter::Bezier(SBezier *sb) {
112112
theta1 = atan2(sb->ctrl[2].y - c.y, sb->ctrl[2].x - c.x),
113113
dtheta = WRAP_SYMMETRIC(theta1 - theta0, 2*PI);
114114
if(dtheta < 0) {
115-
SWAP(double, theta0, theta1);
115+
swap(theta0, theta1);
116116
}
117117

118118
fprintf(f,
Collapse file

‎src/graphicswin.cpp‎

Copy file name to clipboardExpand all lines: src/graphicswin.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ void GraphicsWindow::ZoomToFit(bool includingInvisibles) {
384384
if(EXACT(dy != 0)) scaley = 0.9*height/dy;
385385
scale = min(scalex, scaley);
386386

387-
scale = min(300, scale);
387+
scale = min(300.0, scale);
388388
scale = max(0.003, scale);
389389
}
390390

Collapse file

‎src/group.cpp‎

Copy file name to clipboardExpand all lines: src/group.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void Group::MenuGroup(int id) {
9797
vt = vt.WithMagnitude(1);
9898

9999
if(fabs(SS.GW.projUp.Dot(vt)) < fabs(SS.GW.projUp.Dot(ut))) {
100-
SWAP(Vector, ut, vt);
100+
swap(ut, vt);
101101
g.predef.swapUV = true;
102102
}
103103
if(SS.GW.projRight.Dot(ut) < 0) g.predef.negateU = true;
@@ -317,7 +317,7 @@ void Group::Generate(IdList<Entity,hEntity> *entity,
317317
Vector n = u.Cross(v);
318318
v = (n.Cross(u)).WithMagnitude(1);
319319

320-
if(predef.swapUV) SWAP(Vector, u, v);
320+
if(predef.swapUV) swap(u, v);
321321
if(predef.negateU) u = u.ScaledBy(-1);
322322
if(predef.negateV) v = v.ScaledBy(-1);
323323
q = Quaternion::From(u, v);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.