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

camera-project

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camera-project

project 3D point into 2D window space

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
444
decreased by-22.11%
Maintainers
1
Weekly downloads
 
Created
Source

camera-project

stable

Projects a 3D world point into 2D window space.

var mat4 = require('gl-mat4')
var project = require('camera-project')

//projection * view matrix
var combinedProjView = mat4.multiply([], projection, view)

//viewport bounds
var viewport = [x, y, width, height]

//3D world point
var point = [0, -1, 2.5]

//vec4 output
var output = []

project(output, point, viewport, combinedProjView)

The output z component contains the window space depth, and w is the value of (1 / clip.w). Assumes depth range is 0 to 1.

Usage

NPM

vec4 = project(out, point, viewport, combined)

Projects the 3D point into window space using the viewport bounds (screen x, y, width, height) and combined matrix (result of multiplying projection * view matrices).

The result is stored in out and returned.

See Also

License

MIT, see LICENSE.md for details.

Keywords

FAQs

Package last updated on 14 May 2015

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