New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

citygml-validate-shell

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

citygml-validate-shell - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

77

index.js

@@ -68,3 +68,3 @@ // Note: QIE paper states that only LOD1–3 geometries are to be tested,

var edges = findEdges(shell);
var edgeCounts = countEdges(edges);
var edgeCounts = countMatchingEdges(edges);

@@ -201,3 +201,3 @@ var holes = [];

var edges = findEdges(shell);
var edgeCounts = countEdges(edges);
var edgeCounts = countMatchingEdges(edges);

@@ -293,3 +293,3 @@ var nonManifolds = [];

// Ignore edges of the same polygon
if (edge[2] === polygonIndex) {
if (_.contains(edge[2], polygonIndex)) {
return;

@@ -442,2 +442,4 @@ }

} else {
// TODO: This needs to return all the other polygons that are flipped
// too, otherwise it only returns the first one but there might be more
callback(null, [new Error("GE_S_POLYGON_WRONG_ORIENTATION: When an exterior polygon is viewed from outside the shell the points must be ordered counterclockwise"), outerPolygonIndex]);

@@ -457,6 +459,11 @@ }

var edges = findEdges(shell);
var edgeCounts = countEdges(edges);
var edgesByPolygon = findEdgesByPolygon(edges);
var edgeCounts = countMatchingEdges(edges);
// If an edge count is anything other than 2 then there has to be a polygon
// that has opposite winding to those adjacent to it (ie. flipped normal)
//
// TODO: This isn't robust enough – it fails when polygons aren't properly
// connected, which aren't valid either but aren't part of this test
var flipped = [];

@@ -466,14 +473,36 @@

if (count !== 2) {
// flipped.push(edges[edgeId]);
// At this point we know edges[edgeId][2] contains the indexes for all
// the polygons which have incorrectly-matched edges
_.each(edges[edgeId][2], function(pIndex) {
var pEdges = edgesByPolygon[pIndex];
var polyIndex = edges[edgeId][2];
var polyWinding = polygonWindings[polyIndex];
var pFlipped = true;
// Compare windings (different === failure)
if (polyWinding !== checkWinding) {
if (!_.contains(flipped, polyIndex)) {
// Add polygon index to failures
flipped.push(polyIndex);
// If all edges have a count of 1 then this polygon is flipped,
// otherwise it's valid as it shares edges with other polygons
_.each(pEdges, function(pEdge) {
if (edgeCounts[pEdge] === 2) {
pFlipped = false;
}
});
if (pFlipped) {
if (!_.contains(flipped, pIndex)) {
flipped.push(pIndex);
}
}
}
// REMOVED: Winding checks can't be relied on – winding can be either
// the same or opposite depending on how 2D projection happens
//
// var polyWinding = polygonWindings[pIndex];
//
// // Compare windings (different === failure)
// if (polyWinding !== checkWinding) {
// if (!_.contains(flipped, pIndex)) {
// // Add polygon index to failures
// flipped.push(pIndex);
// }
// }
});
}

@@ -528,4 +557,11 @@ });

var edgeId = prevPoint.toString() + ":" + point.toString();
edges[edgeId] = [prevPoint, point, polygonIndex];
// First time create new edge definition, second time only add polygon
// index to edge
if (!edges[edgeId]) {
edges[edgeId] = [prevPoint, point, [polygonIndex]];
} else {
edges[edgeId][2].push(polygonIndex);
}
prevPoint = point;

@@ -539,4 +575,3 @@ });

// IMPL: Is vertex order always reversed for shared edges? Should we check that here?
var countEdges = function(edges) {
var countMatchingEdges = function(edges) {
var edgeCounts = {};

@@ -573,7 +608,9 @@

_.each(edges, function(edge, edgeId) {
if (!edgesByPolygon[edge[2]]) {
edgesByPolygon[edge[2]] = [];
}
_.each(edge[2], function(pIndex) {
if (!edgesByPolygon[pIndex]) {
edgesByPolygon[pIndex] = [];
}
edgesByPolygon[edge[2]].push(edgeId);
edgesByPolygon[pIndex].push(edgeId);
});
});

@@ -580,0 +617,0 @@

{
"name": "citygml-validate-shell",
"version": "0.1.16",
"version": "0.1.17",
"description": "Validate a CityGML shell against the QIE suite",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc