Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: solvespace/solvespace
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 201e15e68a9a
Choose a base ref
...
head repository: solvespace/solvespace
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 62aba398f769
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on May 15, 2019

  1. Move two members of Vector to be inline.

    Performance change: moved since they show up disproportionately
    in profiling.
    rpavlik authored and whitequark committed May 15, 2019
    Copy the full SHA
    62aba39 View commit details
Showing with 19 additions and 19 deletions.
  1. +19 −0 src/dsc.h
  2. +0 −19 src/util.cpp
19 changes: 19 additions & 0 deletions src/dsc.h
Original file line number Diff line number Diff line change
@@ -108,6 +108,25 @@ class Vector {
Vector4 Project4d() const;
};

inline double Vector::Element(int i) const {
switch (i) {
case 0: return x;
case 1: return y;
case 2: return z;
default: ssassert(false, "Unexpected vector element index");
}
}

inline bool Vector::Equals(Vector v, double tol) const {
// Quick axis-aligned tests before going further
const Vector dv = this->Minus(v);
if (fabs(dv.x) > tol) return false;
if (fabs(dv.y) > tol) return false;
if (fabs(dv.z) > tol) return false;

return dv.MagSquared() < tol*tol;
}

struct VectorHash {
size_t operator()(const Vector &v) const;
};
19 changes: 0 additions & 19 deletions src/util.cpp
Original file line number Diff line number Diff line change
@@ -430,25 +430,6 @@ Vector Vector::From(hParam x, hParam y, hParam z) {
return v;
}

double Vector::Element(int i) const {
switch(i) {
case 0: return x;
case 1: return y;
case 2: return z;
default: ssassert(false, "Unexpected vector element index");
}
}

bool Vector::Equals(Vector v, double tol) const {
// Quick axis-aligned tests before going further
const Vector dv = this->Minus(v);
if (fabs(dv.x) > tol) return false;
if (fabs(dv.y) > tol) return false;
if (fabs(dv.z) > tol) return false;

return dv.MagSquared() < tol*tol;
}

bool Vector::EqualsExactly(Vector v) const {
return EXACT(x == v.x &&
y == v.y &&