npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lzimul/vector3d

v1.1.1

Published

Vector3D

Downloads

313

Readme

📦 Vector3D

GitHub stars GitHub forks GitHub license TypeScript npm License: MIT

A robust and type-safe 3D vector math library for JavaScript and TypeScript projects.

🎯 Why Choose Vector3D?

Vector3D provides a comprehensive and intuitive API for performing common 3D vector operations. Built with TypeScript, it offers strong type safety, enhancing code reliability and developer experience. This library is designed for performance and ease of integration into any project requiring efficient 3D mathematical computations, from game development to graphics applications.

✨ Features

  • Vector Initialization: Easily create 3D vectors from components or other vectors.
  • Basic Arithmetic: Perform addition, subtraction, multiplication, and division of vectors and scalars.
  • Scalar Operations: Scale, negate, and clamp vector components.
  • Geometric Calculations: Compute dot products, cross products, magnitudes (lengths), distances, and normalize vectors.
  • Comparison: Check for vector equality with optional tolerance.
  • Utility Methods: Clone vectors, set components, and provide immutable operations for safer state management.
  • Type-Safe API: Fully written in TypeScript for robust development and compile-time error checking.

🚀 Installation

To use Vector3D in your project, install it via npm:

npm install @lzimul/vector3d

📖 Quick Start

Import the @lzimul/vector3d class and start performing 3D operations.

import { Vector3D } from '@lzimul/vector3d'; // Assuming main export

// Create vectors
const vecA = new Vector3D(1, 2, 3);
const vecB = new Vector3D(4, 5, 6);

// Perform addition
const sum = vecA.add(vecB); // Returns a new Vector3D (5, 7, 9)

// Calculate dot product
const dotProduct = vecA.dot(vecB); // Returns a number (1*4 + 2*5 + 3*6 = 32)

// Normalize a vector
const normalizedVecA = vecA.normalize();

// Get magnitude (length)
const magnitude = vecA.magnitude();

// Chain operations
const result = new Vector3D(10, 20, 30)
    .subtract(vecA)
    .scale(0.5)
    .add(normalizedVecA);

console.log('Vector A:', vecA.toString());
console.log('Vector B:', vecB.toString());
console.log('Sum:', sum.toString());
console.log('Dot Product:', dotProduct);
console.log('Normalized A:', normalizedVecA.toString());
console.log('Magnitude A:', magnitude);
console.log('Chained Result:', result.toString());

📚 API Documentation

Detailed API documentation, including all methods, parameters, and examples, can be generated using TypeDoc.

To generate the documentation locally:

  1. Clone the repository.
  2. Install development dependencies: npm install
  3. Run the docs script: npm run docs

The generated documentation will be available in the docs directory.

📁 Project Structure

Vector3D/
├── .github/                 # GitHub specific configurations (e.g., workflows, issue templates)
├── .idea/                   # IDE (IntelliJ/WebStorm) project configuration
├── src/                     # Source code directory for the Vector3D library
│   └── (vector-related files) # e.g., index.ts, Vector3D.ts, operations.ts
├── .gitignore               # Specifies intentionally untracked files to ignore
├── .prettierrc              # Prettier configuration for code formatting
├── LICENSE                  # MIT License file
├── README.md                # Project README file
├── SECURITY.md              # Security policy documentation
├── eslint.config.js         # ESLint configuration for code linting
├── package-lock.json        # npm lock file, detailing dependency tree
├── package.json             # Project metadata, scripts, and dependencies
├── tsconfig.json            # TypeScript compiler configuration
└── typedoc.json             # TypeDoc configuration for API documentation generation

🛠️ Tech Stack

  • Language: TypeScript
  • Package Manager: npm
  • Build Tool: TypeScript Compiler
  • Testing: Jest
  • Linting: ESLint
  • Formatting: Prettier
  • Documentation: TypeDoc

🔧 Development

Prerequisites

  • Node.js (LTS recommended)
  • npm (comes with Node.js)

Installation for Development

  1. Clone the repository

    git clone https://github.com/lZiMUl/Vector3D.git
    cd Vector3D
  2. Install dependencies

    npm install

Available Scripts

| Command | Description |

| :-------------- | :---------------------------------------------- |

| npm run build | Compiles the TypeScript source code to JavaScript. |

| npm run test | Runs the test suite using Jest. |

| npm run lint | Lints the codebase using ESLint. |

| npm run format| Formats the code using Prettier. |

| npm run docs | Generates API documentation using TypeDoc. |

Building the Library

To compile the TypeScript source files into JavaScript, run:

npm run build

This will output the compiled files to the dist directory.

🧪 Testing

The project uses Jest for testing. To run the tests:

npm run test

🤝 Contributing to Vector3D

We welcome contributions! If you have suggestions for improvements, new features, or bug fixes, please open an issue or submit a pull request.

Please ensure your code adheres to the project's coding style and passes all tests and linting checks.

Contribution Guidelines:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Make your changes.
  4. Run tests (npm run test) and linting (npm run lint).
  5. Commit your changes (git commit -am 'feat: Add new feature').
  6. Push to the branch (git push origin feature/your-feature).
  7. Open a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by various vector math libraries in game development and graphics.
  • Built with modern TypeScript tooling for a robust development experience.

📞 Support & Contact


⭐ Star this repo if you find it helpful!

Made with ❤️ by lZiMUl