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

@thi.ng/math

Package Overview
Dependencies
Maintainers
1
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/math - npm Package Compare versions

Comparing version 5.4.11 to 5.5.0

8

CHANGELOG.md
# Change Log
- **Last updated**: 2023-06-14T07:58:51Z
- **Last updated**: 2023-07-14T11:37:51Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,8 @@

## [5.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.5.0) (2023-07-14)
#### 🚀 Features
- add smoothStep01/smootherStep01() ([152f93c](https://github.com/thi-ng/umbrella/commit/152f93c))
### [5.4.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.4.4) (2023-03-02)

@@ -14,0 +20,0 @@

4

package.json
{
"name": "@thi.ng/math",
"version": "5.4.11",
"version": "5.5.0",
"description": "Assorted common math functions & utilities",

@@ -141,3 +141,3 @@ "type": "module",

},
"gitHead": "54e825a976c72067a244cff8725ca98f5416d26d\n"
"gitHead": "88cfe77770f3b07c788301dccefcb9547cd4aff6\n"
}

@@ -1,2 +0,2 @@

import type { FnN2, FnN3 } from "@thi.ng/api";
import type { FnN, FnN2, FnN3 } from "@thi.ng/api";
/**

@@ -13,2 +13,5 @@ * Step/threshold function.

*
* @remarks
* Also see {@link smoothStep01}, {@link smootherStep}.
*
* @param edge - lower threshold

@@ -21,4 +24,14 @@ * @param edge2 - upper threshold

/**
* Specialized version of {@link smoothStep}, assuming edges are 0/1
* respectively and `x` is in [0..1]. No clamping performed.
*
* @param x
*/
export declare const smoothStep01: FnN;
/**
* Similar to {@link smoothStep} but using different, higher degree polynomial.
*
* @remarks
* Also see {@link smootherStep01}.
*
* @param edge -

@@ -30,2 +43,9 @@ * @param edge2 -

/**
* Specialized version of {@link smootherStep}, assuming edges are 0/1
* respectively and `x` is in [0..1]. No clamping performed.
*
* @param x
*/
export declare const smootherStep01: FnN;
/**
* Exponential ramp with variable shape

@@ -32,0 +52,0 @@ *

@@ -13,2 +13,5 @@ import { clamp01 } from "./interval.js";

*
* @remarks
* Also see {@link smoothStep01}, {@link smootherStep}.
*
* @param edge - lower threshold

@@ -19,9 +22,16 @@ * @param edge2 - upper threshold

*/
export const smoothStep = (edge, edge2, x) => {
x = clamp01((x - edge) / (edge2 - edge));
return (3 - 2 * x) * x * x;
};
export const smoothStep = (edge, edge2, x) => smoothStep01(clamp01((x - edge) / (edge2 - edge)));
/**
* Specialized version of {@link smoothStep}, assuming edges are 0/1
* respectively and `x` is in [0..1]. No clamping performed.
*
* @param x
*/
export const smoothStep01 = (x) => x * x * (3 - 2 * x);
/**
* Similar to {@link smoothStep} but using different, higher degree polynomial.
*
* @remarks
* Also see {@link smootherStep01}.
*
* @param edge -

@@ -31,7 +41,11 @@ * @param edge2 -

*/
export const smootherStep = (edge, edge2, x) => {
x = clamp01((x - edge) / (edge2 - edge));
return x * x * x * (x * (x * 6 - 15) + 10);
};
export const smootherStep = (edge, edge2, x) => smootherStep01(clamp01((x - edge) / (edge2 - edge)));
/**
* Specialized version of {@link smootherStep}, assuming edges are 0/1
* respectively and `x` is in [0..1]. No clamping performed.
*
* @param x
*/
export const smootherStep01 = (x) => x * x * x * (x * (x * 6 - 15) + 10);
/**
* Exponential ramp with variable shape

@@ -38,0 +52,0 @@ *

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