graphics-3d-geometry
v1.0.0
Published
A TypeScript library for working with 3D geometry, meshes, transformations, and geometric primitives.
Downloads
133
Maintainers
Readme
graphics-3d-geometry
A TypeScript library for working with 3D geometry, meshes, transformations, and geometric primitives.
Status: Early development
Installation
npm install graphics-3d-geometryUsage
import { Cube } from "graphics-3d-geometry";
const cube = new Cube({
size: 2,
});
cube.translate(1, 2, 3);Features
- 3D meshes
- Vertices, edges, and faces
- 3D transformations
- Position, rotation, scale, and pivot
- Axis-aligned bounding boxes
- Geometric primitives
- TypeScript support
Geometry
The library provides basic geometry structures:
EdgeFaceMeshBoundingBox
Transformations
Meshes have an associated Transform that handles:
- Position
- Rotation
- Scale
- Pivot
Example:
const cube = new Cube();
cube.setPosition(2, 0, 0);
cube.rotate(rotation);
cube.setScale(2, 2, 2);Primitives
Ready-to-use geometric primitives are provided as Mesh subclasses.
import { Cube } from "graphics-3d-geometry";
const cube = new Cube();
const rectangularCube = new Cube({
width: 2,
height: 3,
depth: 4,
});Bounding Boxes
const bounds = BoundingBox.fromVertices(mesh.vertices);
const center = bounds.getCenter();Rendering
graphics-3d-geometry focuses on 3D geometry, not rendering.
Rendering functionality such as cameras, projection, rasterization, backface culling, textures, and depth buffering is intended to be handled by a separate renderer library.
Math
This library uses graphics-math for mathematical operations such as vectors, matrices, and angles.
License
MIT
