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

@daeinc/geom

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daeinc/geom - npm Package Compare versions

Comparing version 0.8.1 to 0.9.0

8

dist/index.d.ts

@@ -1,4 +0,4 @@

export type Pt = number[];
export type Pts = number[][];
export type GenericObject = Record<string, any>;
export declare type Pt = number[];
export declare type Pts = number[][];
export declare type GenericObject = Record<string, any>;
/**

@@ -62,3 +62,3 @@ * generates an array of paths (excl. original 2 paths)

*/
export declare const generateSmoothPath: (pts: Pts, smoothFactor: number) => number[][];
export declare const generateSmoothPath: (pts: Pts, smoothFactor: number) => import("@thi.ng/vectors").Vec[];
/**

@@ -65,0 +65,0 @@ * atan2() gives angle between [-PI, PI]

import { mix, reflect, roundF, TWO_PI } from "@daeinc/math";
import { interpolateArray as importedInterpolateArray } from "@daeinc/array";
import { add, dot, fromValues, len, mul, normalize, sub } from "gl-vec2";
import { add2 as add, dot2 as dot, mag, mul2 as mul, sub2 as sub, vec2, normalize2 as normalize, } from "@thi.ng/vectors";
/**

@@ -269,11 +269,11 @@ * generates an array of paths (excl. original 2 paths)

export const projectPointOnLine = (pt, line) => {
const ptVec = fromValues(pt[0] - line[1][0], pt[1] - line[1][1]);
const lineVec = fromValues(line[0][0] - line[1][0], line[0][1] - line[1][1]);
const ptVec = vec2(pt[0] - line[1][0], pt[1] - line[1][1]);
const lineVec = vec2(line[0][0] - line[1][0], line[0][1] - line[1][1]);
const prod = dot(ptVec, lineVec);
const proj = prod / len(lineVec);
const projVec = fromValues(proj, proj);
const proj = prod / mag(lineVec);
const projVec = vec2(proj, proj);
const result = normalize(lineVec, lineVec);
mul(result, lineVec, projVec);
add(result, result, line[1]);
return result;
return [result[0], result[1]];
};

@@ -288,6 +288,6 @@ /**

if (axis[0].constructor === Array) {
const projVec = fromValues(...projectPointOnLine(pt, axis));
const distVec = sub([], fromValues(pt[0], pt[1]), projVec);
const projVec = vec2(...projectPointOnLine(pt, axis));
const distVec = sub([], vec2(pt[0], pt[1]), projVec);
const reflVec = sub(projVec, projVec, distVec);
return reflVec;
return [reflVec[0], reflVec[1]];
}

@@ -294,0 +294,0 @@ else {

{
"name": "@daeinc/geom",
"version": "0.8.1",
"version": "0.9.0",
"description": "Geometry utilities",

@@ -15,3 +15,3 @@ "types": "./dist/index.d.ts",

"watch": "tsc --watch",
"test": "jest --watch",
"test": "vitest watch --config ./vitest.config.js",
"demo": "parcel ./demo/index.html --dist-dir ./demo/build --no-source-maps --no-cache",

@@ -25,3 +25,3 @@ "build": "tsc --build --clean && tsc --build"

"@daeinc/math": "^0.5.0",
"gl-vec2": "^1.3.0"
"@thi.ng/vectors": "^7.5.31"
},

@@ -31,6 +31,3 @@ "devDependencies": {

"@daeinc/draw": "^0.2.1",
"@types/gl-vec2": "^1.3.2",
"jest": "^29.3.1",
"jest-canvas-mock": "^2.4.0",
"ts-jest": "^29.0.5"
"vitest": "^0.27.2"
},

@@ -37,0 +34,0 @@ "publishConfig": {

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