Skip to content

Commit 6355a84

Browse files
committed
Point in triangle should check for on triangle, revert spec changes
1 parent 7b4b727 commit 6355a84

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Source/Core/QuantizedMeshTerrainData.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -501,17 +501,17 @@ define([
501501
function isPointInsideUVTriangle(u, v, u0, v0, u1, v1, u2, v2) {
502502
var inside = false;
503503

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

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

514-
intersect = ((v2 > v) !== (v0 > v)) && (u < (u0 - u2) * (v - v2) / (v0 - v2) + u2);
514+
intersect = ((v2 > v) !== (v0 >= v)) && (u <= (u0 - u2) * (v - v2) / (v0 - v2) + u2);
515515
if (intersect) {
516516
inside = !inside;
517517
}

Specs/Core/sampleTerrainMostDetailedSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ defineSuite([
7474
});
7575

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

7979
return sampleTerrainMostDetailed(worldTerrain, positions).then(function() {
8080
expect(positions[0].height).toBeDefined();

Specs/Core/sampleTerrainSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ defineSuite([
9393
});
9494

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

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

0 commit comments

Comments
 (0)