Skip to content

Commit

Permalink
revert autoawesome change
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjlockwood committed May 1, 2017
1 parent 101fd4d commit 44bd245
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -7,13 +7,13 @@
user interface, which is activated whenever the user selects a subpath, segment, and/or point.
* Added a new *pair subpaths* mode, which allows the user to specify how subpaths in the start
canvas should morph into subpaths in the end canvas.
* Added two new export formats for the web:
* Added three new export formats for the web:
* Export to *SVG spritesheet* (30fps and 60fps).
* Export to standalone *SVG frames* (30fps and 60fps).
* Export to *CSS keyframes* (note that Chrome is the only browser that supports them
as of April, 2017).
* Added the ability to import `VectorDrawable` files into the workspace.
* Added the ability to delete subpaths and split segments directly from the canvas.
* Made improvements to the "auto fix" algorithm which now gives more accurate results.

# [v0.2.0](https://github.com/alexjlockwood/ShapeShifter/compare/v0.1.3...v0.2.0) (2017-04-10)

Expand Down
11 changes: 7 additions & 4 deletions src/app/scripts/algorithms/AutoAwesome.ts
Expand Up @@ -36,11 +36,12 @@ export function autoFix(
return fromPaths;
};

// TODO: experiment with this... need to test this more
// Approximate the centers of the start and end subpaths. We'll use this information
// to achieve a more accurate alignment score.
const fromCenter = srcFromPath.getPoleOfInaccessibility(subIdx);
const toCenter = srcToPath.getPoleOfInaccessibility(subIdx);
const centerOffset = new Point(toCenter.x - fromCenter.x, toCenter.y - fromCenter.y);
// const fromCenter = srcFromPath.getPoleOfInaccessibility(subIdx);
// const toCenter = srcToPath.getPoleOfInaccessibility(subIdx);
// const centerOffset = new Point(toCenter.x - fromCenter.x, toCenter.y - fromCenter.y);

// The scoring function to use to calculate the alignment. Convert-able
// commands are considered matches. However, the farther away the points
Expand All @@ -52,7 +53,9 @@ export function autoFix(
return MISMATCH;
}
const { x, y } = cmdA.getEnd();
const start = new Point(x + centerOffset.x, y + centerOffset.y);
// TODO: experiment with this... need to test this more
// const start = new Point(x + centerOffset.x, y + centerOffset.y);
const start = new Point(x, y);
const end = cmdB.getEnd();
const distance = Math.max(MATCH, MathUtil.distance(start, end));
return 1 / distance;
Expand Down

0 comments on commit 44bd245

Please sign in to comment.