Socket
Socket
Sign inDemoInstall

@js-draw/math

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-draw/math - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

7

dist/cjs/shapes/Path.d.ts

@@ -87,2 +87,9 @@ import LineSegment2 from './LineSegment2';

closedRoughlyIntersects(rect: Rect2): boolean;
/**
* Returns a path that outlines `rect`.
*
* If `lineWidth` is given, the resultant path traces a `lineWidth` thick
* border around `rect`. Otherwise, the resultant path is just the border
* of `rect`.
*/
static fromRect(rect: Rect2, lineWidth?: number | null): Path;

@@ -89,0 +96,0 @@ private cachedStringVersion;

10

dist/cjs/shapes/Path.js

@@ -492,5 +492,9 @@ "use strict";

}
// Returns a path that outlines [rect]. If [lineWidth] is not given, the resultant path is
// the outline of [rect]. Otherwise, the resultant path represents a line of width [lineWidth]
// that traces [rect].
/**
* Returns a path that outlines `rect`.
*
* If `lineWidth` is given, the resultant path traces a `lineWidth` thick
* border around `rect`. Otherwise, the resultant path is just the border
* of `rect`.
*/
static fromRect(rect, lineWidth = null) {

@@ -497,0 +501,0 @@ const commands = [];

@@ -35,2 +35,11 @@ import LineSegment2 from './LineSegment2';

getClosestPointOnBoundaryTo(target: Point2): Vec3;
/**
* Returns `true` iff all points in this rectangle are within `distance` from `point`:
*
* If $R$ is the set of points in this rectangle, returns `true` iff
* $$
* \forall {\bf a} \in R, \|\texttt{point} - {\bf a}\| < \texttt{radius}
* $$
*/
isWithinRadiusOf(radius: number, point: Point2): boolean;
get corners(): Point2[];

@@ -37,0 +46,0 @@ get maxDimension(): number;

@@ -141,2 +141,17 @@ "use strict";

}
/**
* Returns `true` iff all points in this rectangle are within `distance` from `point`:
*
* If $R$ is the set of points in this rectangle, returns `true` iff
* $$
* \forall {\bf a} \in R, \|\texttt{point} - {\bf a}\| < \texttt{radius}
* $$
*/
isWithinRadiusOf(radius, point) {
if (this.maxDimension > radius) {
return false;
}
const squareRadius = radius * radius;
return this.corners.every(corner => corner.minus(point).magnitudeSquared() < squareRadius);
}
get corners() {

@@ -169,3 +184,3 @@ return [

get center() {
return this.topLeft.plus(this.size.times(0.5));
return Vec2_1.Vec2.of(this.x + this.w / 2, this.y + this.h / 2);
}

@@ -172,0 +187,0 @@ // Returns edges in the order

@@ -87,2 +87,9 @@ import LineSegment2 from './LineSegment2';

closedRoughlyIntersects(rect: Rect2): boolean;
/**
* Returns a path that outlines `rect`.
*
* If `lineWidth` is given, the resultant path traces a `lineWidth` thick
* border around `rect`. Otherwise, the resultant path is just the border
* of `rect`.
*/
static fromRect(rect: Rect2, lineWidth?: number | null): Path;

@@ -89,0 +96,0 @@ private cachedStringVersion;

@@ -35,2 +35,11 @@ import LineSegment2 from './LineSegment2';

getClosestPointOnBoundaryTo(target: Point2): Vec3;
/**
* Returns `true` iff all points in this rectangle are within `distance` from `point`:
*
* If $R$ is the set of points in this rectangle, returns `true` iff
* $$
* \forall {\bf a} \in R, \|\texttt{point} - {\bf a}\| < \texttt{radius}
* $$
*/
isWithinRadiusOf(radius: number, point: Point2): boolean;
get corners(): Point2[];

@@ -37,0 +46,0 @@ get maxDimension(): number;

{
"name": "@js-draw/math",
"version": "1.6.1",
"version": "1.7.0",
"description": "A math library for js-draw. ",

@@ -31,3 +31,3 @@ "types": "./dist/mjs/lib.d.ts",

"devDependencies": {
"@js-draw/build-tool": "^1.6.1",
"@js-draw/build-tool": "^1.7.0",
"@types/bezier-js": "4.1.0",

@@ -49,3 +49,3 @@ "@types/jest": "29.5.5",

],
"gitHead": "00f1a0ab34de40bec100d5c18657f947895bfaed"
"gitHead": "e7d8a68e6a5ae3063de9c1f033ed8f08c567b393"
}

@@ -647,5 +647,9 @@ import { toRoundedString, toStringOfSamePrecision } from '../rounding';

// Returns a path that outlines [rect]. If [lineWidth] is not given, the resultant path is
// the outline of [rect]. Otherwise, the resultant path represents a line of width [lineWidth]
// that traces [rect].
/**
* Returns a path that outlines `rect`.
*
* If `lineWidth` is given, the resultant path traces a `lineWidth` thick
* border around `rect`. Otherwise, the resultant path is just the border
* of `rect`.
*/
public static fromRect(rect: Rect2, lineWidth: number|null = null): Path {

@@ -652,0 +656,0 @@ const commands: PathCommand[] = [];

@@ -193,2 +193,19 @@ import LineSegment2 from './LineSegment2';

/**
* Returns `true` iff all points in this rectangle are within `distance` from `point`:
*
* If $R$ is the set of points in this rectangle, returns `true` iff
* $$
* \forall {\bf a} \in R, \|\texttt{point} - {\bf a}\| < \texttt{radius}
* $$
*/
public isWithinRadiusOf(radius: number, point: Point2) {
if (this.maxDimension > radius) {
return false;
}
const squareRadius = radius * radius;
return this.corners.every(corner => corner.minus(point).magnitudeSquared() < squareRadius);
}
public get corners(): Point2[] {

@@ -228,3 +245,3 @@ return [

public get center() {
return this.topLeft.plus(this.size.times(0.5));
return Vec2.of(this.x + this.w / 2, this.y + this.h / 2);
}

@@ -231,0 +248,0 @@

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