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

utils-three-js

v1.0.20

Published

This module helps to build three-js application

Downloads

7

Readme

utils-three-js

A utility library for working with BufferGeometry in Three.js. I have created this library to make it easier to work with BufferGeometry in Three.js.

Installation

You can install utils-three-js using npm:

    npm install utils-three-js

Usage

import { BufferGeoUtils } from 'utils-three-js';

import * as THREE from 'three';

// Create a BufferGeometry

const geometry = new THREE.BoxGeometry();

// Perform operations on the geometry

const positionArray = BufferGeoUtils.getPositionArray(geometry);

const normalArray = BufferGeoUtils.getNormalArray(geometry);

const uvArray = BufferGeoUtils.getUVArray(geometry);

const facePoints = BufferGeoUtils.getFacePoints(geometry,10)

// ...and more

API Documentation

BufferGeoUtils

| Method | Description | Parameters | Returns | |--------------------------|----------------------------------------------------------------------|--------------------------------------------|--------------------------| | isBufferGeometry | Checks if the given geometry is a BufferGeometry. | geometry (THREE.BufferGeometry) | Boolean | | getPositionArray | Returns the position array of the geometry. | geometry (THREE.BufferGeometry) | Array | | getNormalArray | Returns the normal array of the geometry. | geometry (THREE.BufferGeometry) | Array | | getUVArray | Returns the UV array of the geometry. | geometry (THREE.BufferGeometry) | Array | | getIndicesArray | Returns the indices array of the geometry. | geometry (THREE.BufferGeometry) | Array | | getNumberOfFaces | Returns the number of faces in the geometry. | geometry (THREE.BufferGeometry) | Number | | getNumberOfVertices | Returns the number of vertices in the geometry. | geometry (THREE.BufferGeometry) | Number | | getPoint | Returns the point at the given index. | geometry (THREE.BufferGeometry), index (Number) | THREE.Vector3 | | getFacePointIndices | Returns the indices of the points of the face at the given index. | geometry (THREE.BufferGeometry), faceIndex (Number) | Array[Number] | | getFacePoints | Returns the points of the face at the given index. | geometry (THREE.BufferGeometry), faceIndex (Number) | Array[THREE.Vector3] | | getTriangleArea | Returns the area of the triangle with the given points. | p1 (THREE.Vector3), p2 (THREE.Vector3), p3 (THREE.Vector3) | Number | | getSurfaceArea | Returns the surface area of the geometry. | geometry (THREE.BufferGeometry) | Number |

Object3DUtils | Method | Description | Parameters | Returns | |--------------------------|----------------------------------------------------------------------|--------------------------------------------|--------------------------| | getAllMeshes | Returns all meshes of the given object. | object (THREE.Object3D) | Array[THREE.Mesh] | | unGroupAllMeshes | Un-groups all meshes of the given object.(Scaling may not work) If removeMeshTransformation is true, the transformation of the mesh is removed and applied to the geometry | object (THREE.Object3D), removeMeshTransformation (Boolean) (default value is false) | Array[THREE.Mesh] | | deleteMeshWithData | Deletes the mesh and its geometry, material, textures | mesh (THREE.Mesh) | Boolean | | deleteObjectWithData | Deletes the object and its geometry, material, textures. warning - make sure that they are not used by any other mesh | object (THREE.Object3D) | Boolean | | getBoundingBox | Returns the bounding box of the object. | object (THREE.Object3D), inLocalSpace (Boolean) (Optional)(default value is false) | THREE.Box3 | | getClassInstanceObjects| Returns all objects of the object with the given class. | object (THREE.Object3D), objectClass (any) | Array<objectClass> | | isObject | Checks if the given object is an instance of THREE.Object3D. | object (THREE.Object3D) | Boolean | | isMesh | Checks if the given object is an instance of THREE.Mesh. | object (THREE.Object3D) | Boolean |

UtilsMath | Method | Description | Parameters | Returns | |--------------------------|----------------------------------------------------------------------|--------------------------------------------|--------------------------| | removeFloatingPointError| Removes the floating point error of the given value. | value (Number), decimals (Number) (Optional)(default value is 2) | Number | | removeFloatingPointErrorVec3| Removes the floating point error of the given vector. | inVec (THREE.Vector3), inDecimals (Number) (Optional)(default value is 2) | THREE.Vector3 |

License

This project is licensed under the MIT License.