Socket
Socket
Sign inDemoInstall

@mathigon/euclid

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mathigon/euclid - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

dist/angle.d.ts

@@ -44,5 +44,5 @@ import { Arc } from './arc';

shift(x: number, y?: number): Angle;
translate(p: Point): Angle;
translate(p: SimplePoint): Angle;
equals(_a: Angle): boolean;
toString(): string;
}
import { Circle } from './circle';
import { Line } from './line';
import { Point } from './point';
import { GeoShape, TransformMatrix } from './utilities';
import { GeoShape, SimplePoint, TransformMatrix } from './utilities';
/** An arc segment of a circle, with given center, start point and angle. */

@@ -30,3 +30,3 @@ export declare class Arc implements GeoShape {

shift(x: number, y?: number): this;
translate(p: Point): this;
translate(p: SimplePoint): this;
equals(): boolean;

@@ -33,0 +33,0 @@ toString(): string;

@@ -5,3 +5,3 @@ import { Arc } from './arc';

import { Rectangle } from './rectangle';
import { GeoShape, TransformMatrix } from './utilities';
import { GeoShape, SimplePoint, TransformMatrix } from './utilities';
/** A circle with a given center and radius. */

@@ -29,5 +29,5 @@ export declare class Circle implements GeoShape {

shift(x: number, y?: number): Circle;
translate(p: Point): Circle;
translate(p: SimplePoint): Circle;
equals(other: Circle, tolerance?: number): boolean;
toString(): string;
}
import { Line } from './line';
import { Point } from './point';
import { GeoShape, TransformMatrix } from './utilities';
import { GeoShape, SimplePoint, TransformMatrix } from './utilities';
export declare class Ellipse implements GeoShape {

@@ -38,5 +38,5 @@ readonly c: Point;

shift(x: number, y?: number): Ellipse;
translate(p: Point): Ellipse;
translate(p: SimplePoint): Ellipse;
equals(other: Ellipse, tolerance?: number): boolean;
toString(): string;
}

@@ -38,4 +38,6 @@ var __defProp = Object.defineProperty;

Triangle: () => Triangle,
difference: () => difference,
drawCanvas: () => drawCanvas,
drawSVG: () => drawSVG,
intersect: () => intersect,
intersections: () => intersections,

@@ -58,3 +60,5 @@ isAngle: () => isAngle,

toDeg: () => toDeg,
toRad: () => toRad
toRad: () => toRad,
union: () => union,
xor: () => xor
});

@@ -365,2 +369,8 @@ module.exports = __toCommonJS(src_exports);

}
contains(p, tolerance) {
if (!Line.prototype.contains.call(this, p, tolerance))
return false;
const offset = this.offset(p);
return (0, import_fermat3.nearlyEquals)(offset, 0, tolerance) || offset > 0;
}
toString() {

@@ -1015,5 +1025,7 @@ return `ray(${this.p1},${this.p2})`;

var DIFFERENCE = [0, 0, 0, 0, 2, 0, 2, 0, 1, 1, 0, 0, 0, 1, 2, 0];
var XOR = [0, 2, 1, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 1, 2, 0];
var union = (p1, p2) => operate(p1, p2, UNION);
var intersect = (p1, p2) => operate(p1, p2, INTERSECT);
var difference = (p1, p2) => operate(p1, p2, DIFFERENCE);
var xor = (p1, p2) => operate(p1, p2, XOR);

@@ -1020,0 +1032,0 @@ // src/intersection.ts

@@ -14,2 +14,3 @@ export * from './angle';

export * from './types';
export * from './boolean';
export { GeoElement, GeoShape, rad, SimplePoint, TransformMatrix, TWO_PI } from './utilities';

@@ -303,2 +303,8 @@ // src/angle.ts

}
contains(p, tolerance) {
if (!Line.prototype.contains.call(this, p, tolerance))
return false;
const offset = this.offset(p);
return nearlyEquals2(offset, 0, tolerance) || offset > 0;
}
toString() {

@@ -953,5 +959,7 @@ return `ray(${this.p1},${this.p2})`;

var DIFFERENCE = [0, 0, 0, 0, 2, 0, 2, 0, 1, 1, 0, 0, 0, 1, 2, 0];
var XOR = [0, 2, 1, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 1, 2, 0];
var union = (p1, p2) => operate(p1, p2, UNION);
var intersect = (p1, p2) => operate(p1, p2, INTERSECT);
var difference = (p1, p2) => operate(p1, p2, DIFFERENCE);
var xor = (p1, p2) => operate(p1, p2, XOR);

@@ -1906,4 +1914,6 @@ // src/intersection.ts

Triangle,
difference,
drawCanvas,
drawSVG,
intersect,
intersections,

@@ -1926,4 +1936,6 @@ isAngle,

toDeg,
toRad
toRad,
union,
xor
};
//# sourceMappingURL=index.esm.js.map

@@ -49,3 +49,3 @@ import { Point } from './point';

shift(x: number, y?: number): Line;
translate(p: Point): Line;
translate(p: SimplePoint): Line;
equals(other: Line, tolerance?: number): boolean;

@@ -59,2 +59,3 @@ toString(): string;

equals(other: Ray, tolerance?: number): boolean;
contains(p: Point, tolerance?: number): boolean;
toString(): string;

@@ -61,0 +62,0 @@ }

@@ -56,3 +56,3 @@ import { Bounds } from './bounds';

shift(x: number, y?: number): Point;
translate(p: Point): Point;
translate(p: SimplePoint): Point;
equals(other: any, precision?: number): boolean;

@@ -59,0 +59,0 @@ toString(): string;

import { Circle } from './circle';
import { Line, Segment } from './line';
import { Point } from './point';
import { GeoShape, TransformMatrix } from './utilities';
import { GeoShape, SimplePoint, TransformMatrix } from './utilities';
/** A polygon defined by its vertex points. */

@@ -48,3 +48,3 @@ export declare class Polygon implements GeoShape {

shift(x: number, y?: number): this;
translate(p: Point): this;
translate(p: SimplePoint): this;
equals(other: Polygon, tolerance?: number, oriented?: boolean): boolean;

@@ -51,0 +51,0 @@ toString(): string;

@@ -36,5 +36,5 @@ import { Line } from './line';

shift(x: number, y?: number): Rectangle;
translate(p: Point): Rectangle;
translate(p: SimplePoint): Rectangle;
equals(_other: Polygon): boolean;
toString(): string;
}

@@ -28,3 +28,3 @@ import { Line } from './line';

shift(x: number, y?: number): GeoShape;
translate(p: Point): GeoShape;
translate(p: SimplePoint): GeoShape;
}

@@ -31,0 +31,0 @@ export declare const TWO_PI: number;

{
"name": "@mathigon/euclid",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",

@@ -35,17 +35,17 @@ "homepage": "https://mathigon.io/euclid",

"dependencies": {
"@mathigon/core": "1.1.0",
"@mathigon/fermat": "1.1.0"
"@mathigon/core": "1.1.1",
"@mathigon/fermat": "1.1.1"
},
"devDependencies": {
"@types/tape": "4.13.2",
"@typescript-eslint/eslint-plugin": "5.17.0",
"@typescript-eslint/parser": "5.17.0",
"esbuild": "0.14.30",
"eslint": "8.12.0",
"eslint-plugin-import": "2.25.4",
"tape": "5.5.2",
"@typescript-eslint/eslint-plugin": "5.21.0",
"@typescript-eslint/parser": "5.21.0",
"esbuild": "0.14.38",
"eslint": "8.14.0",
"eslint-plugin-import": "2.26.0",
"tape": "5.5.3",
"ts-node": "10.7.0",
"tslib": "2.3.1",
"typescript": "4.6.3"
"tslib": "2.4.0",
"typescript": "4.6.4"
}
}

@@ -5,8 +5,4 @@ {

"packageRules": [{
"packagePatterns": ["eslint"],
"groupName": "lint",
"automerge": true
}, {
"packagePatterns": ["^@mathigon"],
"groupName": "mathigon",
"groupName": "Mathigon",
"schedule": ["at any time"],

@@ -16,9 +12,9 @@ "automerge": true

"packagePatterns": ["ts-node", "^typescript", "tslib"],
"groupName": "typescript",
"groupName": "Typescript",
"automerge": true
}, {
"packagePatterns": ["tape"],
"groupName": "tests",
"packagePatterns": ["tape", "esbuild", "eslint"],
"groupName": "Test and Build",
"automerge": true
}]
}

@@ -163,3 +163,3 @@ // =============================================================================

translate(p: Point) {
translate(p: SimplePoint) {
return new Angle(this.a.translate(p), this.b.translate(p), this.c.translate(p));

@@ -166,0 +166,0 @@ }

@@ -12,3 +12,3 @@ // =============================================================================

import {ORIGIN, Point} from './point';
import {GeoShape, rad, TransformMatrix, TWO_PI} from './utilities';
import {GeoShape, rad, SimplePoint, TransformMatrix, TWO_PI} from './utilities';

@@ -113,3 +113,3 @@

translate(p: Point) {
translate(p: SimplePoint) {
return this.shift(p.x, p.y);

@@ -116,0 +116,0 @@ }

@@ -12,3 +12,3 @@ // =============================================================================

import {Rectangle} from './rectangle';
import {GeoShape, rad, TransformMatrix, TWO_PI} from './utilities';
import {GeoShape, rad, SimplePoint, TransformMatrix, TWO_PI} from './utilities';

@@ -95,3 +95,3 @@

translate(p: Point) {
translate(p: SimplePoint) {
return this.shift(p.x, p.y);

@@ -98,0 +98,0 @@ }

@@ -11,3 +11,3 @@ // =============================================================================

import {ORIGIN, Point} from './point';
import {GeoShape, TransformMatrix, TWO_PI} from './utilities';
import {GeoShape, SimplePoint, TransformMatrix, TWO_PI} from './utilities';

@@ -137,3 +137,3 @@

translate(p: Point) {
translate(p: SimplePoint) {
return new Ellipse(this.c.translate(p), this.a, this.b, this.angle);

@@ -140,0 +140,0 @@ }

@@ -20,2 +20,3 @@ // =============================================================================

export * from './types';
export * from './boolean';
export {GeoElement, GeoShape, rad, SimplePoint, TransformMatrix, TWO_PI} from './utilities';

@@ -143,3 +143,3 @@ // =============================================================================

translate(p: Point) {
translate(p: SimplePoint) {
return this.shift(p.x, p.y);

@@ -173,2 +173,8 @@ }

contains(p: Point, tolerance?: number) {
if (!Line.prototype.contains.call(this, p, tolerance)) return false;
const offset = this.offset(p);
return nearlyEquals(offset, 0, tolerance) || offset > 0;
}
toString() {

@@ -175,0 +181,0 @@ return `ray(${this.p1},${this.p2})`;

@@ -209,3 +209,3 @@ // =============================================================================

translate(p: Point) {
translate(p: SimplePoint) {
return this.shift(p.x, p.y); // Alias for .add()

@@ -212,0 +212,0 @@ }

@@ -14,3 +14,3 @@ // =============================================================================

import {ORIGIN, Point} from './point';
import {findClosest, GeoShape, TransformMatrix, TWO_PI} from './utilities';
import {findClosest, GeoShape, SimplePoint, TransformMatrix, TWO_PI} from './utilities';

@@ -258,3 +258,3 @@

translate(p: Point) {
translate(p: SimplePoint) {
return this.shift(p.x, p.y);

@@ -261,0 +261,0 @@ }

@@ -130,3 +130,3 @@ // =============================================================================

translate(p: Point) {
translate(p: SimplePoint) {
return this.shift(p.x, p.y);

@@ -133,0 +133,0 @@ }

@@ -38,3 +38,3 @@ // =============================================================================

shift(x: number, y?: number): GeoShape;
translate(p: Point): GeoShape;
translate(p: SimplePoint): GeoShape;
}

@@ -41,0 +41,0 @@

@@ -8,3 +8,3 @@ // =============================================================================

import tape from 'tape';
import {Circle, intersections, Line, Point, Polygon, Segment} from '../src';
import {Circle, intersections, Line, Point, Polygon, Ray, Segment} from '../src';

@@ -45,2 +45,9 @@

test.deepEqual([res[0].x, res[0].y, res[1].x, res[1].y], [1, 2, 2, 1]);
const p2 = new Polygon(new Point(0, 0), new Point(100, 0), new Point(100, 100), new Point(0, 100), new Point(0, 50));
const ray = new Ray(new Point(50, 50), new Point(100, 50));
const int = intersections(p2, ray);
test.equal(int.length, 1);
test.deepEqual([int[0].x, int[0].y], [100, 50]);
test.end();

@@ -47,0 +54,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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