New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dual-quat-to-mat4

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dual-quat-to-mat4

Convert a dual quaternion into a 4x4 matrix

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-30.77%
Maintainers
2
Weekly downloads
 
Created
Source

dual-quat-to-mat4 npm version Build Status

Convert a 4x4 matrix into a dual quaternion. Useful for skeletal animation

Background / Initial Motivation

dual-quat-to-mat4's initial motivation was to be used to convert a bone's dual quaternion into a matrix in order to use it to position a model relative to your bone.

For example, let's say you have an armature that you blended between two keyframes using skeletal-animation-system. You now want to render a baseball in your armature's hand

  1. Start with some dual quaternion bone data from your character's armature
  2. Grab the dual quaternion for the right hand bone
  3. Convert the right hand bone's dual quaternion into a 4x4 matrix using dual-quat-to-mat4
  4. Use this 4x4 matrix to transform a baseball model view matrix.
  5. Your baseball will now be rendered with it's origin at your right hand bone
  • (Or at some offset from that bone if you factor that into your model view matrix)

To Install

$ npm install --save dual-quat-to-mat4

Usage

var dualQuatToMat4 = require('dual-quat-to-mat4')
var matrix = []
var dualQuat = dualQuatToMat4(matrix, [0, 0, 0, 1, 0, 0, 0, 0])

console.log(matrix)
// [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]

API

dualQuatToMat4(out, dualQuat) -> Array[16]

out

Required

Type: Array[*]

An allocated array that will get elements [0] through [15] set as your output matrix

dualQuat

Required

Type: Array[8]

The dual quaternion that you want to convert into a 4x4 matrix

See Also

References

License

MIT

Keywords

FAQs

Package last updated on 19 Mar 2018

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