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

raycasting-utils

v0.0.214

Published

Fast utilities for ray-casting against triangles or boxes or a distance function / implicit surface

Downloads

21

Readme

raycasting-utils

Fast utilities for ray-casting against sets of triangles, or a set of axis-aligned bounding boxes, or a distance function (implicit surface).

Triangles are organized using bvh-tree-plus

Boxes are organized using rbush-3d

Distance functions are queried using naive marching spheres.

Installation

npm i raycasting-utils

Usage

var rcu = require('raycasting-utils');

// aabb = [[x,y,z],[x,y,z]] //axis aligned bounding box = [minimum pt, maximum pt]
// ray = {point:{x,y,z}, vector: {x,y,z}} //raycasting direction 
// line = [[x,y,z],[x,y,z]] //raycasting direction using line segment coords instead of ray
// triangle = [[x,y,z],[x,y,z],[x,y,z]]

// functions ending with _useLine take a line segment instead of a ray object, but work the same

// rcu.traceDf(ray, df, maxSteps = 256, minDist = 0.05) //returns distance from raycasting distance function df, using marching spheres technique. bail out if dist<minDist 
// rcu.traceDf_useLine

// rcu.aabbsTraceFast([aabb]) => returns function(ray) which returns distance
// rcu.aabbsTraceFast_useLine

// rcu.aabbsTraceBVH([aabb]) => similar to aabbsTraceFast, but converts the boxes to triangles and casts using a BVH instead of the RTree. Usually slower.
// rcu.aabbsTraceBVH_useLine

// rcu.aabb2Triangles(aabb) => convert aabb to list of triangles

// rcu.trianglesTraceFast([tri], backfaceCulling=true) => similar to aabbsTraceFast, but for list of triangles 
// rcu.trianglesTraceFast_useLine

// rcu.trianglesTraceFast_returnIndex => similar to above, but returns {dist, index: indexOfTriangleThatGetsHit or -1}
// rcu.trianglesTraceFast_returnIndex_useLine

// rcu.trianglesTraceFast_colored => returns [dist, color] where color is pulled from triangle.color
// rcu.trianglesTraceFast_colored_useLine

// rcu.aabbs2RTree([aabb]) => convert list of aabbs to rtree, uses `npm rbush-3d`
// rcu.searchRTreeForAabbs(rtree, aabb) => search rtree generated by above, return list of aabbs found intersecting the queried aabb

// rcu.getBvh() => return most recently created BVH object
// rcu.getRtree() => return most recently created RTree object

// "sector" can be used as alias for aabb [ 没有为什么 ]
// rcu.sector2Triangles
// rcu.sectorsTraceBVH
// rcu.sectorsTraceBVH_useLine
// rcu.sectorsTraceFast
// rcu.sectorsTraceFast_useLine
// rcu.sectors2RTree
// rcu.searchRTreeForSectors

stonks