Skip to content

Commit

Permalink
Fix specs variable redeclarations
Browse files Browse the repository at this point in the history
  • Loading branch information
shehzan10 committed Nov 2, 2018
1 parent 79f2415 commit 1d7e177
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions Specs/Core/Intersections2DSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,55 +291,55 @@ defineSuite([

describe('computeLineSegmentLineSegmentIntersection', function() {
it('returns the correct result for intersection point', function() {
var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1.0, 1.0, 1.0, 1.0);
expect(intersection.x).toEqualEpsilon(0.0, 1e-15);
expect(intersection.y).toEqualEpsilon(1.0, 1e-15);
var intersection0 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1.0, 1.0, 1.0, 1.0);
expect(intersection0.x).toEqualEpsilon(0.0, 1e-15);
expect(intersection0.y).toEqualEpsilon(1.0, 1e-15);

var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 10.0, 5.0, 0.0, 5.0, 10.0, 0.0);
expect(intersection.x).toEqualEpsilon(5.0, 1e-15);
expect(intersection.y).toEqualEpsilon(2.5, 1e-15);
var intersection1 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 10.0, 5.0, 0.0, 5.0, 10.0, 0.0);
expect(intersection1.x).toEqualEpsilon(5.0, 1e-15);
expect(intersection1.y).toEqualEpsilon(2.5, 1e-15);

var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, -5.0, 4.0, 3.0, -2.0, 1.0, 4.0, -2.0);
expect(intersection.x).toEqualEpsilon(2.0, 1e-15);
expect(intersection.y).toEqualEpsilon(-1.0, 1e-15);
var intersection2 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, -5.0, 4.0, 3.0, -2.0, 1.0, 4.0, -2.0);
expect(intersection2.x).toEqualEpsilon(2.0, 1e-15);
expect(intersection2.y).toEqualEpsilon(-1.0, 1e-15);
});

it('returns the correct result for intersection point on a vertex', function() {
var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1.0, 0.0, 1.0, 0.0);
expect(intersection.x).toEqualEpsilon(0.0, 1e-15);
expect(intersection.y).toEqualEpsilon(0.0, 1e-15);
var intersection0 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1.0, 0.0, 1.0, 0.0);
expect(intersection0.x).toEqualEpsilon(0.0, 1e-15);
expect(intersection0.y).toEqualEpsilon(0.0, 1e-15);

intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 0.0);
expect(intersection.x).toEqualEpsilon(1.0, 1e-15);
expect(intersection.y).toEqualEpsilon(1.0, 1e-15);
var intersection1 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 0.0);
expect(intersection1.x).toEqualEpsilon(1.0, 1e-15);
expect(intersection1.y).toEqualEpsilon(1.0, 1e-15);

intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 4.0, 3.0, 5.0, 0.0, 4.0, 3.0);
expect(intersection.x).toEqualEpsilon(4.0, 1e-15);
expect(intersection.y).toEqualEpsilon(3.0, 1e-15);
var intersection2 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 4.0, 3.0, 5.0, 0.0, 4.0, 3.0);
expect(intersection2.x).toEqualEpsilon(4.0, 1e-15);
expect(intersection2.y).toEqualEpsilon(3.0, 1e-15);
});

it('returns undefined for non-intersecting lines', function() {
var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 5.0, 0.1, 4.8, 5.0, 0.0);
expect(intersection).toBeUndefined();
var intersection0 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 5.0, 0.1, 4.8, 5.0, 0.0);
expect(intersection0).toBeUndefined();

var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(10.0, 0.0, 0.0, -10.0, 0.0, 0.0, -8.0, -8.0);
expect(intersection).toBeUndefined();
var intersection1 = Intersections2D.computeLineSegmentLineSegmentIntersection(10.0, 0.0, 0.0, -10.0, 0.0, 0.0, -8.0, -8.0);
expect(intersection1).toBeUndefined();
});

it('returns undefined for parallel lines', function() {
var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, 1.0, 1.0, 1.0, 4.0);
expect(intersection).toBeUndefined();
var intersection0 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, 1.0, 1.0, 1.0, 4.0);
expect(intersection0).toBeUndefined();

var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(1.0, 1.0, 4.0, 4.0, 0.0, 0.0, 3.0, 3.0);
expect(intersection).toBeUndefined();
var intersection1 = Intersections2D.computeLineSegmentLineSegmentIntersection(1.0, 1.0, 4.0, 4.0, 0.0, 0.0, 3.0, 3.0);
expect(intersection1).toBeUndefined();
});

it('returns undefined for coincident lines', function() {
var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, 0.0, 1.0, 0.0, 4.0);
expect(intersection).toBeUndefined();
var intersection0 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, 0.0, 1.0, 0.0, 4.0);
expect(intersection0).toBeUndefined();

var intersection = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 2.0);
expect(intersection).toBeUndefined();
var intersection1 = Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 2.0);
expect(intersection1).toBeUndefined();
});
});
});

0 comments on commit 1d7e177

Please sign in to comment.