包详细信息

geom-merge

vorg10MIT3.0.0

Merge a list of geometries (simplicial complex) into one geometry and concat all other attributes.

geom, merge, simplicial, complex

自述文件

geom-merge

Merge a list of geometries (simplicial complex) into one geometry and concat all other attributes.

Installation

npm install geom-merge

Usage

import merge from "geom-merge";
import { cube, sphere } from "primitive-geometry";

const geometry = merge([cube(), sphere()]);

API

merge(geometries): geometry

Parameters

  • geometries: Array<geometry> – array of geometry objects

Returns

geometry: { positions: TypedArray | Array | Array<[x, y, z]>, cells: TypedArray | Array | Array<[a, b, c]>, ...otherAttributesMergedAndFlattened: TypedArray | Array } - new geometry with cells, and merged/flattened attributes.

Note 1: Each geometry object requires at least positions and cells. Other array-like properties like uvs or normals will be merged and flattened, if available in all geometries. Cells will be chunked if any of the geometries has chunked cells.

Note 2: This module doesn't perform CSG operations

License

MIT. See license file.

更新日志

Changelog

All notable changes to this project will be documented in this file. See commit-and-tag-version for commit guidelines.

3.0.0 (2024-03-21)

Features

  • add support for mixed geometries (d15eab8), closes #3 #4

BREAKING CHANGES

  • returned geometries attributes are flattened