@bitbybit-dev/manifold
Version:
Bit By Bit Developers Manifold based CAD Library to Program Geometry
1,149 lines (1,148 loc) • 30.3 kB
TypeScript
import { Base } from "./base-inputs";
export declare namespace Manifold {
type ManifoldPointer = {
hash: number;
type: string;
};
type CrossSectionPointer = {
hash: number;
type: string;
};
type MeshPointer = {
hash: number;
type: string;
};
enum fillRuleEnum {
evenOdd = "EvenOdd",
nonZero = "NonZero",
positive = "Positive",
negative = "Negative"
}
enum manifoldJoinTypeEnum {
square = "Square",
round = "Round",
miter = "Miter"
}
class DecomposedManifoldMeshDto {
numProp: number;
vertProperties: Float32Array;
triVerts: Uint32Array;
mergeFromVert?: Uint32Array;
mergeToVert?: Uint32Array;
runIndex?: Uint32Array;
runOriginalID?: Uint32Array;
runTransform?: Float32Array;
faceID?: Uint32Array;
halfedgeTangent?: Float32Array;
}
class DrawManifoldOrCrossSectionDto<T, M> {
/**
* Provide options without default values
*/
constructor(manifoldOrCrossSection?: T, faceOpacity?: number, faceMaterial?: M, faceColour?: Base.Color, crossSectionColour?: Base.Color, crossSectionWidth?: number, crossSectionOpacity?: number, computeNormals?: boolean);
/**
* Manifold geometry
* @default undefined
*/
manifoldOrCrossSection?: T;
/**
* Face opacity value between 0 and 1
* @default 1
* @minimum 0
* @maximum 1
* @step 0.1
*/
faceOpacity: number;
/**
* Face material
* @default undefined
* @optional true
*/
faceMaterial?: M;
/**
* Hex colour string for face colour
* @default #ff0000
*/
faceColour: Base.Color;
/**
* Hex colour string for cross section drawing
* @default #ff00ff
*/
crossSectionColour: Base.Color;
/**
* Width of cross section lines
* @default 2
*/
crossSectionWidth: number;
/**
* Cross section opacity value between 0 and 1
* @default 1
* @minimum 0
* @maximum 1
* @step 0.1
*/
crossSectionOpacity: number;
/**
* Compute normals for the shape
* @default false
*/
computeNormals: boolean;
}
class DrawManifoldsOrCrossSectionsDto<T, M> {
/**
* Provide options without default values
*/
constructor(manifoldsOrCrossSections?: T[], faceOpacity?: number, faceMaterial?: M, faceColour?: Base.Color, crossSectionColour?: Base.Color, crossSectionWidth?: number, crossSectionOpacity?: number, computeNormals?: boolean);
/**
* Manifold geometry
* @default undefined
*/
manifoldsOrCrossSections?: T[];
/**
* Face material
* @default undefined
* @optional true
*/
faceMaterial?: M;
/**
* Hex colour string for face colour
* @default #ff0000
*/
faceColour: Base.Color;
/**
* Face opacity value between 0 and 1
* @default 1
* @minimum 0
* @maximum 1
* @step 0.1
*/
faceOpacity: number;
/**
* Hex colour string for cross section drawing
* @default #ff00ff
*/
crossSectionColour: Base.Color;
/**
* Width of cross section lines
* @default 2
*/
crossSectionWidth: number;
/**
* Cross section opacity value between 0 and 1
* @default 1
* @minimum 0
* @maximum 1
* @step 0.1
*/
crossSectionOpacity: number;
/**
* Compute normals for the shape
* @default false
*/
computeNormals: boolean;
}
class CreateFromMeshDto {
constructor(mesh?: DecomposedManifoldMeshDto);
/**
* Mesh definition
*/
mesh: DecomposedManifoldMeshDto;
}
class CubeDto {
constructor(center?: boolean, size?: number);
/**
* Place cube on the center
* @default true
*/
center: boolean;
/**
* Size of the cube
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
size: number;
}
class CreateContourSectionDto {
constructor(polygons?: Base.Vector2[][], fillRule?: fillRuleEnum);
/**
* Polygons to use for the contour section
* @default undefined
*/
polygons: Base.Vector2[][];
/**
* Fill rule for the contour section
* @default EvenOdd
*/
fillRule: fillRuleEnum;
}
class SquareDto {
constructor(center?: boolean, size?: number);
/**
* Place cube on the center
* @default false
*/
center: boolean;
/**
* Size of the cube
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
size: number;
}
class SphereDto {
constructor(radius?: number, circularSegments?: number);
/**
* Radius of the sphere
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
radius: number;
/**
* Circular segments of the sphere
* @default 32
* @minimum 0
* @maximum Infinity
* @step 1
*/
circularSegments: number;
}
class CylinderDto {
constructor(height?: number, radiusLow?: number, radiusHigh?: number, circularSegments?: number, center?: boolean);
/**
* Height of the cylinder
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
height: number;
/**
* Radius of the cylinder
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
radiusLow: number;
/**
* Radius of the cylinder
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
radiusHigh: number;
/**
* Circular segments of the cylinder
* @default 32
* @minimum 0
* @maximum Infinity
* @step 1
*/
circularSegments: number;
/**
* Place cylinder on the center
* @default true
*/
center: boolean;
}
class CircleDto {
constructor(radius?: number, circularSegments?: number);
/**
* Radius of the cylinder
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
radius: number;
/**
* Circular segments of the cylinder
* @default 32
* @minimum 0
* @maximum Infinity
* @step 1
*/
circularSegments: number;
}
class RectangleDto {
constructor(length?: number, height?: number, center?: boolean);
/**
* Length of the rectangle
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
length: number;
/**
* Height of the rectangle
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
height: number;
/**
* Place rectangle on the center
* @default false
*/
center: boolean;
}
class ManifoldDto<T> {
constructor(manifold?: T);
/**
* Manifold shape
*/
manifold: T;
}
class CalculateNormalsDto<T> {
constructor(manifold?: T, normalIdx?: number, minSharpAngle?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The property channel in which to store the X
* values of the normals. The X, Y, and Z channels will be sequential. The
* property set will be automatically expanded to include up through normalIdx
* + 2.
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
normalIdx: number;
/**
* Any edges with angles greater than this value will
* remain sharp, getting different normal vector properties on each side of
* the edge. By default, no edges are sharp and all normals are shared. With a
* value of zero, the model is faceted and all normals match their triangle
* normals, but in this case it would be better not to calculate normals at
* all. The value is in degrees.
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
minSharpAngle: number;
}
class CalculateCurvatureDto<T> {
constructor(manifold?: T);
/**
* Manifold shape
*/
manifold: T;
/**
* The property channel index in which to store the
* Gaussian curvature. An index < 0 will be ignored (stores nothing). The
* property set will be automatically expanded to include the channel
* index specified.
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
gaussianIdx: number;
/**
* The property channel index in which to store the mean
* curvature. An index < 0 will be ignored (stores nothing). The property
* set will be automatically expanded to include the channel index
* specified. The mean curvature is a scalar value that describes the
* @default 1
* @minimum 0
* @maximum Infinity
* @step 1
*/
meanIdx: number;
}
class CountDto {
constructor(count?: number);
/**
* Nr to count
*/
count: number;
}
class ManifoldsMinGapDto<T> {
constructor(manifold1?: T, manifold2?: T, searchLength?: number);
/**
* Manifold shape
*/
manifold1: T;
/**
* Manifold shape
*/
manifold2: T;
/**
* Length of the search gap
* @default 100
* @minimum 0
* @maximum Infinity
* @step 10
*/
searchLength: number;
}
class ManifoldRefineToleranceDto<T> {
constructor(manifold?: T, tolerance?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The desired maximum distance between the faceted mesh
* produced and the exact smoothly curving surface. All vertices are exactly
* on the surface, within rounding error.
* @default 1e-6
* @minimum 0
* @maximum Infinity
* @step 1e-7
*/
tolerance: number;
}
class ManifoldRefineLengthDto<T> {
constructor(manifold?: T, length?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* Length of the manifold
* @default 0.1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
length: number;
}
class ManifoldRefineDto<T> {
constructor(manifold?: T, number?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The number of pieces to split every edge into. Must be > 1.
* @default 1
* @minimum 0
* @maximum Infinity
* @step 1
*/
number: number;
}
class ManifoldSmoothByNormalsDto<T> {
constructor(manifold?: T, normalIdx?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The first property channel of the normals. NumProp must be
* at least normalIdx + 3. Any vertex where multiple normals exist and don't
* agree will result in a sharp edge.
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
normalIdx: number;
}
class ManifoldSmoothOutDto<T> {
constructor(manifold?: T, minSharpAngle?: number, minSmoothness?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* Any edges with angles greater
* than this value will remain sharp. The rest will be smoothed to G1
* continuity, with the caveat that flat faces of three or more triangles will
* always remain flat. With a value of zero, the model is faceted, but in this
* case there is no point in smoothing.
* @default 60
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
minSharpAngle: number;
/**
* The smoothness applied to
* sharp angles. The default gives a hard edge, while values > 0 will give a
* small fillet on these sharp edges. A value of 1 is equivalent to a
* minSharpAngle of 180 - all edges will be smooth.
* @default 0
* @minimum 0
* @maximum 1
* @step 0.1
*/
minSmoothness: number;
}
class HullPointsDto<T> {
constructor(points?: T);
/**
* Points to hull
*/
points: T;
}
class SliceDto<T> {
constructor(manifold?: T);
/**
* Manifold shape
*/
manifold: T;
/**
* Height of the slice
* @default 0.5
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
height: number;
}
class MeshDto<T> {
constructor(mesh?: T);
/**
* Mesh
*/
mesh: T;
}
class MeshVertexIndexDto<T> {
constructor(mesh?: T, vertexIndex?: number);
/**
* Mesh
*/
mesh: T;
/**
* Vertex index
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
vertexIndex: number;
}
class MeshTriangleRunIndexDto<T> {
constructor(mesh?: T, triangleRunIndex?: number);
/**
* Mesh
*/
mesh: T;
/**
* Triangle run index
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
triangleRunIndex: number;
}
class MeshHalfEdgeIndexDto<T> {
constructor(mesh?: T, halfEdgeIndex?: number);
/**
* Mesh
*/
mesh: T;
/**
* Half edge index
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
halfEdgeIndex: number;
}
class MeshTriangleIndexDto<T> {
constructor(mesh?: T, triangleIndex?: number);
/**
* Mesh
*/
mesh: T;
/**
* Triangle index
* @default 0
* @minimum 0
* @maximum Infinity
* @step 1
*/
triangleIndex: number;
}
class CrossSectionDto<T> {
constructor(crossSection?: T);
/**
* Cross section
*/
crossSection: T;
}
class CrossSectionsDto<T> {
constructor(crossSections?: T[]);
/**
* Cross sections
*/
crossSections: T[];
}
class ExtrudeDto<T> {
constructor(crossSection?: T);
/**
* Extrude cross section shape
*/
crossSection: T;
/**
* Height of the extrusion
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
height: number;
/**
* Number of divisions
* @default 1
* @minimum 0
* @maximum Infinity
* @step 1
*/
nDivisions: number;
/**
* Twist degrees
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
twistDegrees: number;
/**
* Scale top
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
scaleTopX: number;
/**
* Scale top
* @default 1
* @minimum 0
* @maximum Infinity
* @step 0.1
*/
scaleTopY: number;
/**
* Center the extrusion
* @default true
*/
center: boolean;
}
class RevolveDto<T> {
constructor(crossSection?: T, revolveDegrees?: number, matchProfile?: boolean, circularSegments?: number);
/**
* Revolve cross section shape
*/
crossSection: T;
/**
* Extrude cross section shape
* @default 360
* @minimum 0
* @maximum Infinity
* @step 1
*/
revolveDegrees: number;
/**
* Default manifold library will adjust profile when generating revolved shape. We prefer it to be matching the profile by default. Set to false to use default manifold library behavior.
* @default true
*/
matchProfile: boolean;
/**
* Circular segments
* @default 32
* @minimum 0
* @maximum Infinity
* @step 1
*/
circularSegments: number;
}
class OffsetDto<T> {
constructor(crossSection?: T, delta?: number, joinType?: manifoldJoinTypeEnum, miterLimit?: number, circularSegments?: number);
/**
* Revolve cross section shape
*/
crossSection: T;
/**
* Positive deltas will cause the expansion of outlining contours
* to expand, and retraction of inner (hole) contours. Negative deltas will
* have the opposite effect.
* @default 1
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
delta: number;
/**
* The join type specifying the treatment of contour joins
* (corners).
* @default round
*/
joinType: manifoldJoinTypeEnum;
/**
* The maximum distance in multiples of delta that vertices
* can be offset from their original positions with before squaring is
* applied, **when the join type is Miter** (default is 2, which is the
* minimum allowed). See the [Clipper2
* MiterLimit](http://www.angusj.com/clipper2/Docs/Units/Clipper.Offset/Classes/ClipperOffset/Properties/MiterLimit.htm)
* page for a visual example.
* @default 2
* @minimum 2
* @maximum Infinity
* @step 0.1
*/
miterLimit: number;
/**
* Number of segments per 360 degrees of
* <B>JoinType::Round</B> corners (roughly, the number of vertices that
* will be added to each contour). Default is calculated by the static Quality
* defaults according to the radius.
* @default 32
* @minimum 0
* @maximum Infinity
* @step 1
*/
circularSegments: number;
}
class SimplifyDto<T> {
constructor(crossSection?: T, epsilon?: number);
/**
* Revolve cross section shape
*/
crossSection: T;
/**
* Extrude cross section shape
* @default 1e-6
* @minimum 0
* @maximum Infinity
* @step 1e-7
*/
epsilon: number;
}
class ComposeDto<T> {
constructor(polygons?: T);
/**
* Polygons to compose
*/
polygons: T;
}
class MirrorCrossSectionDto<T> {
constructor(crossSection?: T, normal?: Base.Vector2);
/**
* Manifold shape
*/
crossSection: T;
/**
* The normal vector of the plane to be mirrored over
* @default [1,0]
*/
normal: Base.Vector2;
}
class Scale2DCrossSectionDto<T> {
constructor(crossSection?: T, vector?: Base.Vector2);
/**
* Manifold shape
*/
crossSection: T;
/**
* The normal vector of the plane to be mirrored over
* @default [2,2]
*/
vector: Base.Vector2;
}
class TranslateCrossSectionDto<T> {
constructor(crossSection?: T, vector?: Base.Vector2);
/**
* Manifold shape
*/
crossSection: T;
/**
* The translation vector
* @default undefined
*/
vector: Base.Vector2;
}
class RotateCrossSectionDto<T> {
constructor(crossSection?: T, degrees?: number);
/**
* Manifold shape
*/
crossSection: T;
/**
* The rotation vector in eulers
* @default 45
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
degrees: number;
}
class ScaleCrossSectionDto<T> {
constructor(crossSection?: T, factor?: number);
/**
* Manifold shape
*/
crossSection: T;
/**
* The normal vector of the plane to be mirrored over
* @default 2
*/
factor: number;
}
class TranslateXYCrossSectionDto<T> {
constructor(crossSection?: T, x?: number, y?: number);
/**
* Manifold shape
*/
crossSection: T;
/**
* The translation X axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
x: number;
/**
* The translation Y axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
y: number;
}
class TransformCrossSectionDto<T> {
constructor(crossSection?: T, transform?: Base.TransformMatrix3x3);
/**
* Cross section
*/
crossSection: T;
/**
* The transform matrix to apply
* @default undefined
*/
transform: Base.TransformMatrix3x3;
}
class MirrorDto<T> {
constructor(manifold?: T, normal?: Base.Vector3);
/**
* Manifold shape
*/
manifold: T;
/**
* The normal vector of the plane to be mirrored over
* @default [1,0,0]
*/
normal: Base.Vector3;
}
class Scale3DDto<T> {
constructor(manifold?: T, vector?: Base.Vector3);
/**
* Manifold shape
*/
manifold: T;
/**
* The normal vector of the plane to be mirrored over
* @default [2,2,2]
*/
vector: Base.Vector3;
}
class TranslateDto<T> {
constructor(manifold?: T, vector?: Base.Vector3);
/**
* Manifold shape
*/
manifold: T;
/**
* The translation vector
* @default undefined
*/
vector: Base.Vector3;
}
class TranslateByVectorsDto<T> {
constructor(manifold?: T, vectors?: Base.Vector3[]);
/**
* Manifold shape
*/
manifold: T;
/**
* The translation vector
* @default undefined
*/
vectors: Base.Vector3[];
}
class RotateDto<T> {
constructor(manifold?: T, vector?: Base.Vector3);
/**
* Manifold shape
*/
manifold: T;
/**
* The rotation vector in eulers
* @default undefined
*/
vector: Base.Vector3;
}
class RotateXYZDto<T> {
constructor(manifold?: T, x?: number, y?: number, z?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The rotation vector in eulers on X axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
x: number;
/**
* The rotation vector in eulers on Y axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
y: number;
/**
* The rotation vector in eulers on Z axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
z: number;
}
class ScaleDto<T> {
constructor(manifold?: T, factor?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The normal vector of the plane to be mirrored over
* @default 2
*/
factor: number;
}
class TranslateXYZDto<T> {
constructor(manifold?: T, x?: number, y?: number, z?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* The translation X axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
x: number;
/**
* The translation Y axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
y: number;
/**
* The translation Z axis
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 1
*/
z: number;
}
class TransformDto<T> {
constructor(manifold?: T, transform?: Base.TransformMatrix);
/**
* Manifold shape
*/
manifold: T;
/**
* The transform matrix to apply
* @default undefined
*/
transform: Base.TransformMatrix;
}
class TransformsDto<T> {
constructor(manifold?: T, transforms?: Base.TransformMatrixes);
/**
* Manifold shape
*/
manifold: T;
/**
* The transform matrixes to apply
* @default undefined
*/
transforms: Base.TransformMatrixes;
}
class TwoCrossSectionsDto<T> {
constructor(crossSection1?: T, crossSection2?: T);
/**
* Manifold shape
*/
crossSection1: T;
/**
* Manifold shape
*/
crossSection2: T;
}
class TwoManifoldsDto<T> {
constructor(manifold1?: T, manifold2?: T);
/**
* Manifold shape
*/
manifold1: T;
/**
* Manifold shape
*/
manifold2: T;
}
class SplitManifoldsDto<T> {
constructor(manifoldToSplit?: T, manifoldCutter?: T);
/**
* Manifold that will be split
*/
manifoldToSplit: T;
/**
* Manifold cutter
*/
manifoldCutter: T;
}
class TrimByPlaneDto<T> {
constructor(manifold?: T, normal?: Base.Vector3, originOffset?: number);
/**
* Manifold that will be trimmed
*/
manifold: T;
/**
* The normal vector of the plane to be mirrored over
* @default [1,0,0]
*/
normal: Base.Vector3;
/**
* The offset from the origin
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
originOffset: number;
}
class SplitByPlaneDto<T> {
constructor(manifold?: T, normal?: Base.Vector3, originOffset?: number);
/**
* Manifold that will be split
*/
manifold: T;
/**
* The normal vector of the plane to be mirrored over
* @default [1,0,0]
*/
normal: Base.Vector3;
/**
* The offset from the origin
* @default 0
* @minimum -Infinity
* @maximum Infinity
* @step 0.1
*/
originOffset: number;
}
class SplitByPlaneOnOffsetsDto<T> {
constructor(manifold?: T, normal?: Base.Vector3, originOffsets?: number[]);
/**
* Manifold that will be split
*/
manifold: T;
/**
* The normal vector of the plane to be mirrored over
* @default [1,0,0]
*/
normal: Base.Vector3;
/**
* The offsets from the origin
* @default [0]
*/
originOffsets: number[];
}
class ManifoldsDto<T> {
constructor(manifolds?: T[]);
/**
* Manifolds
*/
manifolds: T[];
}
class ManifoldToMeshDto<T> {
constructor(manifold?: T, normalIdx?: number);
/**
* Manifold shape
*/
manifold: T;
/**
* Optional normal index
*/
normalIdx?: number;
}
class ManifoldsToMeshesDto<T> {
constructor(manifolds?: T[], normalIdx?: number[]);
/**
* Manifold shape
*/
manifolds: T[];
/**
* Optional normal indexes
*/
normalIdx?: number[];
}
class DecomposeManifoldOrCrossSectionDto<T> {
constructor(manifoldOrCrossSection?: T, normalIdx?: number);
/**
* Manifold shape
*/
manifoldOrCrossSection: T;
/**
* Optional normal index
*/
normalIdx?: number;
}
class ManifoldOrCrossSectionDto<T> {
constructor(manifoldOrCrossSection?: T);
/**
* Manifold or cross section
*/
manifoldOrCrossSection: T;
}
class ManifoldsOrCrossSectionsDto<T> {
constructor(manifoldsOrCrossSections?: T[]);
/**
* Manifolds or cross sections
*/
manifoldsOrCrossSections: T[];
}
class DecomposeManifoldsOrCrossSectionsDto<T> {
constructor(manifoldsOrCrossSections?: T[], normalIdx?: number[]);
/**
* Manifold shape
*/
manifoldsOrCrossSections: T[];
/**
* Optional normal indexes
*/
normalIdx?: number[];
}
}