npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

four-points-controls

v0.1.1

Published

Orients a 3D object using four points in camera space.

Downloads

2

Readme

four-points-controls

Allows you to orient an object in 3D using positions of four points of its local XY plane in the camera plane. Get it from NPM or CDN and then just:

const controls = FourPointsControls( camera, renderer.domElement );
controls.add( mesh ); // your 3D object to orient
scene.add( controls );

Demo

https://makc.github.io/four-points-controls/

API

// camera: an active instance of PerspectiveCamera
// element: optional HTMLElement to add pointer listeners to; if
// not specified, no handles are created and you are responsible
// for updating controls.points values
const controls = FourPointsControls( camera, element );

// four points in the camera plane, set by controls UI if element
// was specified, or by you (both x and y should be normalized to
// -1...1 range
controls.points = [...];

// currently active corner, 0...3 (see exact3 comment below)
const index = controls.currentPoint;

// a method of pose calculation (see below for supported values)
controls.method = ...;

Methods

  • FourPointsControls.exact3
    calculates exact fit of three points and minimizes fourth point reprojection error (this is similar to opencv SOLVEPNP_P3P method); three points used are those around the active corner

  • FourPointsControls.exact3.average
    experimental; calculates approximate fit of four points by averaging the results of FourPointsControls.exact3 for every point

  • FourPointsControls.exact4
    default; calculates exact fit of four points, but sacrifices the transformation orthonormality (this works best with flat or near-flat objects)

  • FourPointsControls.exact4.diamond
    experimental; tweaks the results of FourPointsControls.exact4 to equalize the lengths of X and Y axes

  • FourPointsControls.opencv
    calculates approximate fit of four points using opencv SOLVEPNP_IPPE_SQUARE method (you will need to preload ~9 MB opencv.js build to use this option)