Skip to content

A lightweight Bezier curve library for multiple programming languages, enabling precise curve evaluations and manipulations.

License

Notifications You must be signed in to change notification settings

GameFusion/Bezier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bezier Curve Library

Quick Install For JavaScript / TypeScript:

To use the @gamefusion/gamefusion-bezier library in your project, install it using npm or yarn:

Using npm:

npm install @gamefusion/gamefusion-bezier

Using yarn:

yarn add @gamefusion/gamefusion-bezier

An ultra-lightweight Bezier curve library for multiple programming languages, enabling precise curve evaluations and manipulations.

Welcome to the Bezier Curve Library, an efficient ultra-lightweight library designed to provide accurate Bezier curve evaluations and manipulations for various programming languages, including C++, C#, JavaScript, and TypeScript.

This library is focused exclusively on Bezier math and has been used extensively for 3D animation, game development, and websites over the past 20 years. With features such as point evaluation on curves, curve intersection calculations, and the ability to manipulate curves using handles, this library is a trusted tool for professionals in animation, gaming, and software development.

Key Features:

  • Point Evaluation: Evaluate specific points on a Bezier curve.
  • Curve Intersection: Calculate intersections between Bezier curves.
  • Handle Manipulation: Use Bezier handles for intuitive curve editing.
  • Multi-Language Support: Available for C++, C#, JavaScript, and TypeScript.
  • Efficient: Optimized for performance with minimal footprint.
  • 20+ Years of Use: Proven and trusted in production systems for two decades.

Installation

To install and use the Bezier Curve Library in your project, follow the instructions based on the language you're working with.

For C++:

  1. Download the library or clone the repository.
  2. Include the Bezier header files in your project.
  3. Link the library with your C++ project.

For C#:

  1. Add a reference to the Bezier namespace in your C# project.

For JavaScript / TypeScript:

  1. Import the library into your JavaScript/TypeScript code:
    import Bezier from 'bezier-library';

Usage Example

// Example in C++
BezierCurve curve({Point(0, 0), Point(1, 2), Point(3, 5)});
auto point = curve.evaluate(0.5);  // Evaluate point at t=0.5
// Example in C#
BezierCurve curve = new BezierCurve(new Point[] { new Point(0, 0), new Point(1, 2), new Point(3, 5) });
var point = curve.Evaluate(0.5);  // Evaluate point at t=0.5
// Example in JavaScript
const curve = new Bezier([new Point(0, 0), new Point(1, 2), new Point(3, 5)]);
let point = curve.evaluate(0.5);  // Evaluate point at t=0.5

Documentation

License

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

Repository

GitHub Repository


Directory Structure for the Project

/bezier-library
│
├── /cpp                          # C++ implementation
│   ├── BezierPath.cpp            # BezierPath implementation in C++
│   ├── BezierPath.h              # Header for BezierPath in C++
│   ├── BezierHandle.cpp          # BezierHandle implementation in C++
│   ├── BezierHandle.h            # Header for BezierHandle in C++
│   ├── Math3D.cpp                # Math3D related functions for C++
│   ├── Math3D.h                  # Header for Math3D
│   ├── Vector3D.cpp              # Vector3D implementation in C++
│   ├── Vector3D.h                # Header for Vector3D
│   ├── List.cpp                  # List container implementation in C++
│   ├── List.h                    # Header for List container
│   ├── Array.cpp                 # Array container implementation in C++
│   └── Array.h                   # Header for Array container
│
├── /csharp                       # C# implementation
│   ├── Bezier.cs                 # BezierCurve class in C#
│   ├── BezierPath.cs             # BezierPath in C#
│   ├── BezierHandle.cs           # BezierHandle in C#
│   ├── Math3D.cs                 # Math3D related functions in C#
│   ├── Vector3D.cs               # Vector3D class in C#
│   ├── List.cs                   # List container in C#
│   └── Array.cs                  # Array container in C#
│
├── /typescript                   # TypeScript implementation
│   └── Bezier.ts                 # Bezier curve class in TypeScript
│
├── /javascript                   # JavaScript implementation
│   └── Bezier.js                 # Bezier curve class in JavaScript
│
├── /tests                        # Unit tests for the library
│   ├── test_bezier_curve.cpp     # C++ test cases
│   ├── test_bezier_curve.cs      # C# test cases
│   ├── test_bezier_curve.js      # JavaScript test cases
│   └── test_bezier_curve.ts      # TypeScript test cases
│
├── /docs                         # Documentation
│   ├── usage.md                  # Usage examples for different languages
│   └── javascript.md             # Javascript documentation details
│
├── /examples                     # Example usage code
│   ├── example_cpp.cpp           # Example usage in C++
│   ├── example_csharp.cs         # Example usage in C#
│   ├── example_js.js             # Example usage in JavaScript
│   └── example_ts.ts             # Example usage in TypeScript
│
├── LICENSE                       # MIT License file
├── README.md                     # Project README file
└── /build                        # Build and configuration files

About

A lightweight Bezier curve library for multiple programming languages, enabling precise curve evaluations and manipulations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •