New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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

Geometry utilities

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
increased by4900%
Maintainers
1
Weekly downloads
 
Created
Source

@daeinc/geom

A collection of gemetry-related functions. Breaking changes expected in the future.

Installation

npm i @daeinc/geom

then

import { blendPath } from "@daeinc/geom";

Functions

type Pt = number[];
type Pts = number[][];
type GenericObject = Record<string, any>;

const blendPath: (
  path1: Pts,
  path2: Pts,
  numBlends: number,
  guidePath?: Pts
) => number[][][];

const createShapeFunc: (
  pts: Pts,
  anchor?: Pt
) => (x: number, y: number, w: number, h: number) => Pts;

const dist: (pt1: Pt, pt2: Pt) => number;

const distSq: (pt1: Pt, pt2: Pt) => number;

const extrudePath: (
  path: Pts,
  numPointsToExtrude: number,
  offset: Pt,
  mode?: "start" | "end" | "both",
  shapeFunc?: () => Pts
) => number[][];

const generateSmoothPath: (pts: Pts, smoothFactor: number) => number[][];

const getPathLength: (path: Pts) => number;

const getSegmentLengths: (pts: Pts) => number[];

const interpolateArray: (
  arrStart: number[],
  arrTarget: number[],
  t: number
) => number[];

const interpolatePath: (
  pathStart: Pts,
  pathTarget: Pts,
  t: number
) => number[][];

const interpolateObject: (
  objStart: GenericObject,
  objTarget: GenericObject,
  t: number
) => GenericObject;

const interpolate: <T>(
  start: T,
  target: T,
  t: number
) => number | GenericObject | T;

const projectPointOnLine: (pt: Pt, line: Pts) => Pt;

const reflectPoint: (pt: Pt, axis: Pt | Pts) => Pt;

const reflectPath: (pts: Pts, axis: Pt | Pts) => Pts;

const scalePoint: (pt: Pt, size: Pt) => Pt;

const scalePath: (path: Pts, size: Pt) => Pts;

To Dos

  • reconcile the use of both Float32Array(gl-vec2) and regular array
  • add Canvas mock tests

License

MIT

FAQs

Package last updated on 13 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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