GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Erdroy/VectorMath: VectorMath - SharpDX Inspired C++ highly customizable vector math library. Custom types, double-precision, UpperCase and lowercase component names and more.

BranchesTags
Open more actions menu

Latest commit

 

History

42 Commits
42 Commits

Folders and files

NameName
Last commit message
Last commit date
Source
Source
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

VectorMath

SharpDX Inspired C++ vector math library (scalar only).

Status: Production Ready

VectorMath was designed to be flexible, allows to define vectors using any integer/floating-point type. Just drag and drop source and header files into your project! That's it.

Sample code

View Projection matrix calculation

m_lookAt = m_position + m_forward;
m_view = Matrix::CreateLookAt(m_position, m_lookAt, m_up);
m_projection = Matrix::CreatePerspective(Math::DegreeToRadian * m_fov, Display::GetAspectRatio(), m_nearPlane, m_farPlane);
m_viewProjection = m_view * m_projection;
// ...
auto transformed = Vector3::Transform(somePoint, m_viewProjection);

Vector2/3/4 functionality

const auto someVector = Vector3(0.0f, 2.0f, 1.0f);
auto normalized = Vector3::Normalize(someVector);
auto dot = Vector3::Dot(someVector, normalized);

if(normalized.IsNormalized()) {...}
if(normalized.IsNaN()) {...}
if(normalized.Length() > 2) {...}
// ...

Quaternion functionality

const auto someRotation = Quaternion(Vector3::Up, 50.0f);
auto axis = someRotation.Axis();

if(someRotation.IsNormalized()) {...}
if(someRotation.IsNaN()) {...}
if(someRotation.Length() > 2) {...}
// ...

Note: Quaternions are built with float as their default type and there is no way to change it.

Defining new vector type

using Vector2i = Vector2Base<int>;
using Vector3i = Vector3Base<int>;
using Vector4i = Vector4Base<int>;

Already there are some ready-to-use types defined in the VectorMath.h file.

By default UPPERCASE component naming is enabled, look: Config.h.

Roadmap

  • Disable explicit floating-point functions for integers
  • Get rid of STD
  • SIMD Support
  • Documentation
  • More functions!

Contributions

I do accept PR. Feel free to contribute.

License

MIT

About

VectorMath - SharpDX Inspired C++ highly customizable vector math library. Custom types, double-precision, UpperCase and lowercase component names and more.

Topics

cppmathvectormath

Resources

Readme
MIT license
Activity

Stars

6 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.