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

change-mat4-coordinate-system

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

change-mat4-coordinate-system

Convert a 4x4 column major matrix from left handed to right handed coordinate system

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

change-mat4-coordinate-system npm version Build Status

Convert a 4x4 column major matrix from left handed to right handed coordinate system

Background / Initial Motivation

Blender exports bone matrices in using a handed coordinate system, but WebGL uses a left handed coordinate system.

I used to know change coordinate systems by changing my final gl_Position's coordinates, but I now need to manipulate coordinates before I get to my vertex shader (to find the location and rotation of a bone so that I can render something on top of it). This module helps me with converting everything to left handed during compile time, so that I don't need to do any coordinate system conversion during runtime.

To Install

$ npm install --save change-mat4-coordinate-system

Usage

var changeMat4Coords = require('change-mat4-coordinate-system')

// Don't worry, both rotations and translations will be converted.
// It's just easier to demonstrate translations here.
var rightHandedMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 5, 1, 1]

var leftHandedMatrix = changeMat4Coords.rightToLeft(rightHandedMatrix)

console.log(leftHandedMatrix)
// [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, -5, 1]

License

MIT

Keywords

FAQs

Package last updated on 19 Jun 2017

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

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