Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@benev/math

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@benev/math

game math toolkit

latest
Source
npmnpm
Version
0.2.0-4
Version published
Maintainers
1
Created
Source

@benev/math

benevolent's typescript math library for games


🍋 CORE

common numerical structures

[!TIP] until real docs are written, see the relevant sourcecode in s/core/

🍏 conventions for all core classes

  • mutable by default.
    operations happen in-place, for efficiency (we're trying to reduce gc churn).
    // allocate a single vector instance
    const vector = new Vec2(0, 0)
      .add({x: 1, y: 2})
      .multiplyBy(2)
    
  • explicit cloning.
    use .clone() to avoid mutating the original.
    // modify a clone (not the original)
    const vector2 = vector
      .clone()
      .normalize()
    
  • underscore-suffixed methods take direct args.
    • methods normally take in other class instances:
      vectorA.add(vectorB)
      
    • but underscore-suffixed methods take raw naked args (helping you avoid making instances)
      vectorA.add_(x, y)
      

🍏 Vec2

🍏 Vec3

🍏 Vec4

🍏 Quat


🍋 TOOLS

handy utilities

[!TIP] until real docs are written, see the relevant sourcecode in s/tools/

🍏 Scalar

🍏 Circular

🍏 Randy

🍏 Noise

🍏 Spline

🍏 Angles

  • Radians
  • Degrees
  • Turns
  • Arcseconds

🍋 SHAPES

geometric concepts

[!TIP] until real docs are written, see the relevant sourcecode in s/shapes/

🍏 2d shapes

  • Edge — a line segment
  • Pill — a fat line segment (like a sausage)
  • Rect — a rectangle
  • Circle — a point with a radius

🍏 3d shapes

  • Segment — a line segment
  • Capsule — a fat line segment (like a hoagie)
  • Box — a cuboid
  • Sphere — a point with a radius

🍋 OPTIMIZERS

spatial optimization data structures

[!TIP] until real docs are written, see the relevant sourcecode in s/optimizers/

🍏 HashMap

🍏 HashSet

🍏 ZenGrid


🍋 PHYSICS

functionality for doing basic physics

[!TIP] until real docs are written, see the relevant sourcecode in s/physics/

🍏 collide2d

🍏 collide3d

🍏 intersect2d

🍏 intersect3d


👼 https://benevolent.games/

star this on github if you use it 👍

Keywords

game

FAQs

Package last updated on 10 Sep 2025

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