Skip to content

Commit

Permalink
Point in triangle should check for on triangle, revert spec changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shehzan10 committed Jan 24, 2019
1 parent 7b4b727 commit 6355a84
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Source/Core/QuantizedMeshTerrainData.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,17 @@ define([
function isPointInsideUVTriangle(u, v, u0, v0, u1, v1, u2, v2) {
var inside = false;

var intersect = ((v0 > v) !== (v1 > v)) && (u < (u1 - u0) * (v - v0) / (v1 - v0) + u0);
var intersect = ((v0 > v) !== (v1 >= v)) && (u <= (u1 - u0) * (v - v0) / (v1 - v0) + u0);
if (intersect) {
inside = !inside;
}

intersect = ((v1 > v) !== (v2 > v)) && (u < (u2 - u1) * (v - v1) / (v2 - v1) + u1);
intersect = ((v1 > v) !== (v2 >= v)) && (u <= (u2 - u1) * (v - v1) / (v2 - v1) + u1);
if (intersect) {
inside = !inside;
}

intersect = ((v2 > v) !== (v0 > v)) && (u < (u0 - u2) * (v - v2) / (v0 - v2) + u2);
intersect = ((v2 > v) !== (v0 >= v)) && (u <= (u0 - u2) * (v - v2) / (v0 - v2) + u2);
if (intersect) {
inside = !inside;
}
Expand Down
2 changes: 1 addition & 1 deletion Specs/Core/sampleTerrainMostDetailedSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defineSuite([
});

it('works for a dodgy point right near the edge of a tile', function() {
var positions = [new Cartographic(0.33179290856829535, 0.7363107781851076)];
var positions = [new Cartographic(0.33179290856829535, 0.7363107781851078)];

return sampleTerrainMostDetailed(worldTerrain, positions).then(function() {
expect(positions[0].height).toBeDefined();
Expand Down
2 changes: 1 addition & 1 deletion Specs/Core/sampleTerrainSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ defineSuite([
});

it('works for a dodgy point right near the edge of a tile', function() {
var positions = [new Cartographic(0.33179290856829535, 0.7363107781851076)];
var positions = [new Cartographic(0.33179290856829535, 0.7363107781851078)];

return sampleTerrain(worldTerrain, 12, positions).then(function() {
expect(positions[0].height).toBeDefined();
Expand Down

0 comments on commit 6355a84

Please sign in to comment.