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: dbe0b8daa448
Choose a base ref
...
head repository: solvespace/solvespace
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 52a481cd1eee
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on May 13, 2019

  1. Copy the full SHA
    838126f View commit details
  2. Small performance optimization in Vector::Equals.

    This function showed up surprisingly high on a CPU time profile
    when the GUI was unresponsive "doing things". Removed a duplicated
    difference in the not-equal case, and switched to abs and a single compare
    instead of two compares with a negation. It seems to have moved the
    function further down in the profile.
    rpavlik authored and whitequark committed May 13, 2019
    Copy the full SHA
    52a481c View commit details
Showing with 8 additions and 7 deletions.
  1. +3 −3 src/platform/guigtk.cpp
  2. +5 −4 src/util.cpp
6 changes: 3 additions & 3 deletions src/platform/guigtk.cpp
Original file line number Diff line number Diff line change
@@ -15,9 +15,6 @@
#include <gtkmm/cssprovider.h>
#include <gtkmm/entry.h>
#include <gtkmm/filechooserdialog.h>
#if defined(HAVE_GTK_FILECHOOSERNATIVE)
# include <gtkmm/filechoosernative.h>
#endif
#include <gtkmm/fixed.h>
#include <gtkmm/glarea.h>
#include <gtkmm/main.h>
@@ -29,6 +26,9 @@
#include <gtkmm/window.h>

#include "config.h"
#if defined(HAVE_GTK_FILECHOOSERNATIVE)
# include <gtkmm/filechoosernative.h>
#endif

#if defined(HAVE_SPACEWARE)
# include <spnav.h>
9 changes: 5 additions & 4 deletions src/util.cpp
Original file line number Diff line number Diff line change
@@ -441,11 +441,12 @@ double Vector::Element(int i) const {

bool Vector::Equals(Vector v, double tol) const {
// Quick axis-aligned tests before going further
double dx = v.x - x; if(dx < -tol || dx > tol) return false;
double dy = v.y - y; if(dy < -tol || dy > tol) return false;
double dz = v.z - z; if(dz < -tol || dz > tol) return false;
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 (this->Minus(v)).MagSquared() < tol*tol;
return dv.MagSquared() < tol*tol;
}

bool Vector::EqualsExactly(Vector v) const {