UNPKG

threepipe

Version:

A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.

54 lines 2.76 kB
import { BufferGeometry, Mesh, Shape } from 'three'; import { AViewerPluginSync, ThreeViewer } from '../../viewer'; import { IMesh } from '../../core/IObject'; import { PickingPlugin } from '../interaction/PickingPlugin'; import { GeometryGeneratorPlugin } from './GeometryGeneratorPlugin'; /** * ShapeTubeExtrudePlugin * * Provides interactive extrusion of flat geometry along a curve path. * Takes a selected planar mesh, auto-detects its flat axis, extracts a 2D Shape from * the vertices, then extrudes it along a curve using the TubeShape geometry generator. * * Features: * - Extrude any flat geometry along a circle curve * - Auto-detect planar axis (X, Y, or Z) and extract 2D shape * - Configurable shape/tube segments, shape scale, and material splits * - Multi-material support via configurable split positions * * This could also be used as a sample plugin to create custom interactive geometry plugins. * @category Plugins */ export declare class ShapeTubeExtrudePlugin extends AViewerPluginSync { static readonly PluginType = "ShapeTubeExtrudePlugin"; dependencies: (typeof PickingPlugin | typeof GeometryGeneratorPlugin)[]; enabled: boolean; toJSON: any; shapeSegments: number; tubularSegments: number; shapeScaleX: number; shapeScaleY: number; materialSplits: string; horizontalSplits: boolean; extrudeCircleTube: () => Promise<void>; /** * Extrude a mesh's geometry along a curve path. * The mesh must be a flat/planar geometry (aligned to one axis). */ extrudeObject(object: Mesh, curve: any, shapeSegments?: number, tubularSegments?: number, shapeScaleX?: number, shapeScaleY?: number, materialSplits?: string, horizontalSplits?: boolean): void; /** * Programmatic helper to extrude a shape along a curve. */ static ExtrudeShape(viewer: ThreeViewer, shape: Shape, curve: any, shapeSegments?: number, tubularSegments?: number, shapeScaleX?: number, shapeScaleY?: number, materialSplits?: string, horizontalSplits?: boolean): IMesh | undefined; /** * Convert a planar 3D geometry to a 2D Shape by auto-detecting the flat axis. * The geometry must be aligned to one of the principal axes (X, Y, or Z bounding box extent near zero). * * @param geometry - The geometry to convert (must be planar/flat) * @param sort - Whether to sort points starting from the leftmost point * @returns A 2D Shape suitable for extrusion * @throws If geometry has no position attribute, is too large (>500 vertices), or is not axis-aligned planar */ static ConvertGeometryToFlatShape(geometry: BufferGeometry, sort?: boolean): Shape; } //# sourceMappingURL=../../src/plugins/geometry/ShapeTubeExtrudePlugin.d.ts.map