Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flatten-js/core

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flatten-js/core - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

2

package.json
{
"name": "@flatten-js/core",
"version": "1.2.5",
"version": "1.2.6",
"description": "Javascript library for 2d geometry",

@@ -5,0 +5,0 @@ "main": "dist/main.cjs.js",

@@ -11,2 +11,3 @@ /**

import * as Intersection from "../algorithms/intersection";
import * as Relations from "../algorithms/relation";

@@ -371,10 +372,5 @@ /**

}
if (shape instanceof Flatten.Segment || shape instanceof Flatten.Arc) {
let edge = new Flatten.Edge(shape);
let rel = edge.setInclusion(this);
return rel === Flatten.INSIDE || rel === Flatten.BOUNDARY;
else {
return Relations.cover(this, shape);
}
// TODO: support Box and Circle
}

@@ -381,0 +377,0 @@

@@ -228,2 +228,34 @@ /**

});
it('Can check if contour contains segment (issue #31)', function() {
const points = [
point(306, 306),
point(647, 211),
point(647, 109),
point(147, 109),
point(147, 491),
point(600, 491),
point(600, 401),
point(379, 401),
];
const poly = new Polygon(points);
const lineA = line(point(550, 491), point(500, 401));
const lineB = line(point(520, 491), point(500, 401));
const intersectPointsA = poly.intersect(lineA);
const intersectPointsB = poly.intersect(lineB);
// const constSegmentOutA = new Segment(intersectPointsA[1], intersectPointsA[3]);
expect(poly.contains(segment(intersectPointsA[0], intersectPointsA[1]))).to.be.true;
expect(poly.contains(segment(intersectPointsA[1], intersectPointsA[2]))).to.be.false;
expect(poly.contains(segment(intersectPointsA[2], intersectPointsA[3]))).to.be.true;
expect(poly.contains(segment(intersectPointsA[0], intersectPointsA[2]))).to.be.false;
expect(poly.contains(segment(intersectPointsA[1], intersectPointsA[3]))).to.be.false;
expect(poly.contains(segment(intersectPointsB[0], intersectPointsB[1]))).to.be.true;
expect(poly.contains(segment(intersectPointsB[1], intersectPointsB[2]))).to.be.false;
expect(poly.contains(segment(intersectPointsB[2], intersectPointsB[3]))).to.be.true;
expect(poly.contains(segment(intersectPointsB[0], intersectPointsB[2]))).to.be.false;
expect(poly.contains(segment(intersectPointsB[1], intersectPointsB[3]))).to.be.false;
expect(poly.contains(segment(intersectPointsA[2], intersectPointsB[3]))).to.be.true;
expect(poly.contains(segment(intersectPointsA[2], intersectPointsB[2]))).to.be.true;
});
it('Can measure distance between circle and polygon', function () {

@@ -230,0 +262,0 @@ let points = [

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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