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

three-shape-3d

v0.0.27

Published

A generic geometric shape object (line, area, volume) for three.js

Downloads

23

Readme

three-shape-3d

A generic geometric shape object (line, area, volume) for three.js

It's an all-in-one solution for creating and manipulating geometric shapes in three.js.

It's a wrapper around three.js geometry and mesh objects, and provides a simple API for creating and manipulating shapes.

You can create a shape from a set of points and build either a:

  • line
  • area
  • volume

Installation

Install with npm:

npm install three-shape-3d

Install with yarn:

yarn add three-shape-3d

Usage

import { Shape3D } from 'three-shape-3d';
const shape = new Shape3D();
scene.add(shape);

This will create an empty shape. To make anything useful, you need to add points to the shape.

import { Shape3DFactory } from 'three-shape-3d';

// The factory can help you create shapes
const factory = new Shape3DFactory();

// Array of points
const points: THREE.Vector3[] = [];

// Arbitrary points
points.push(new THREE.Vector3(0, 0, 0));
points.push(new THREE.Vector3(20, 0, 0));
points.push(new THREE.Vector3(0, 0, 20));

// Use the factory to create a shape
const shape3d = factory.create({
    shapeType: 'line',
});
shape3d.setFromPoints(points);

Now, if you want to update the shape, you can do so by calling the factory.

// Convert the line shape to a volume shape.
factory.update(shape3D, {
    shapeType: SUPPORTED_SHAPES.VOLUME, // New shape type
    volumeHeight: 10,
});

Line

TODO

Area

TODO

Volume

TODO

Labels

TODO

Angles

TODO

Example

See the examples folder for an example. Or, view the live demo here:

Docs

Auto-generated docs can be found here:

https://andrewisen-tikab.github.io/three-shape-3d/docs/

Status

This is a work in progress. It's not ready for production use.

Design

The design is based on the following:

Design

A line is defined by a set of 3-dimensional vertices. The point between two vertices is called midpoint.

Design

The first vertex is called the startpoint and the last is called the endpoint.

Design

A line can be closed by setting closeLine to true.

Design

An area is a line with three or more vertices.

Design

A volume is an area with a positive height.

Is this library for you?

As stated by the design, this library is for you if you want to create and manipulate geometric shapes in three.js. There are some limitations to what shapes you can create. Any complex shapes are very hard to work with.

Assets

"Simple Metal Fence" by Blender3D

"Wooden barricade" by BlackMike

"New York Scaffolding" by s4shko


```

```

```

```

```

```