Business

Class: SurfaceBuilder

The SurfaceBuilder class provides static methods for constructing surfaces using various algorithms and operations.

Static Method: surface4Pnt

Creates a surface based on four given points.

Parameters

  • point1 (IVector): The first point.
  • point2 (IVector): The second point.
  • point3 (IVector): The third point.
  • point4 (IVector): The fourth point.

Returns

A new Surface object representing the created surface.

Example

const point1 = new Vector(1, 1, 1);
const point2 = new Vector(1, 1, 1);
const point3 = new Vector(1, 1, 1);
const point4 = new Vector(1, 1, 1);
SurfaceBuilder.surface4Pnt(point1, point2, point3, point4);

Static Method: loft

Creates a lofted surface from the given curves.

Parameters

  • curves (ICurve[]): The curves to loft.
  • degree (number): The degree of the lofted surface.

Returns

A new Surface object representing the lofted surface.

Example

const curves = /* specify a curves */;
const degree = 0.5;
SurfaceBuilder.loft(curves, degree);

Static Method: extrudePoint

Extrudes a curve in a specified direction.

Parameters

  • curve (ICurve): The curve to extrude the point along.
  • direction (IVector): The direction in which to extrude the point.

Returns

A new Surface object representing the extruded surface.

Example

const curve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const direction = new Vector(1, 1, 1);
SurfaceBuilder.extrudePoint(curve, direction);

Static Method: extrudeAlong

Extrudes a base curve along a profile curve to create a surface.

Parameters

  • base (ICurve): No description
  • profileCurve (ICurve): No description

Returns

The resulting surface.

Example

const base = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const profileCurve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
SurfaceBuilder.extrudeAlong(base, profileCurve);

Static Method: sweep

Creates a swept surface by sweeping a set of profiles along a spine curve.

Parameters

  • profiles (ICurve[]): An array of curves representing the profiles to be swept.
  • spine (ICurve): The spine curve along which the profiles will be swept.

Returns

A new Surface object representing the swept surface.

Example

const profiles = /* specify a profiles */;
const spine = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
SurfaceBuilder.sweep(profiles, spine);

Static Method: sweep2

Creates a swept surface by sweeping profiles along two rails.

Parameters

  • profiles (ICurve[]): An array of curves representing the profiles to be swept.
  • rail1 (ICurve): The first rail curve.
  • rail2 (ICurve): The second rail curve.

Returns

A Surface object representing the swept surface.

Example

const profiles = /* specify a profiles */;
const rail1 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const rail2 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
SurfaceBuilder.sweep2(profiles, rail1, rail2);

Static Method: sumSrf

Calculates the sum surface of two curves.

Parameters

  • crv1 (ICurve): The first curve.
  • crv2 (ICurve): The second curve.

Returns

A new Surface object representing the sum surface of the two curves.

Example

const crv1 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const crv2 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
SurfaceBuilder.sumSrf(crv1, crv2);

Static Method: revolve

Revolves a curve around an axis to create a surface.

Parameters

  • curve (ICurve): The curve to revolve.
  • origin (IVector): The origin point of the axis.
  • direction (IVector): The direction vector of the axis.
  • angle (number): The angle of revolution in radians.

Returns

A new Surface object representing the revolved surface.

Example

const curve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const origin = new Vector(1, 1, 1);
const direction = new Vector(1, 1, 1);
const angle = 0.5;
SurfaceBuilder.revolve(curve, origin, direction, angle);

Static Method: pipe

Creates a pipe surface based on the given curve and radius.

Parameters

  • curve (ICurve): The curve to create the pipe from.
  • radius (number): The radius of the pipe.

Returns

A new Surface object representing the pipe surface.

Example

const curve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const radius = 10;
SurfaceBuilder.pipe(curve, radius);

Static Method: pipeVariable

Builds a pipe surface by extruding a curve along a set of radii and parameters.

Parameters

  • curve (ICurve): The curve to be extruded.
  • radii (number[]): An array of radii corresponding to each parameter.
  • parameters (number[]): An array of parameters specifying the position along the curve for each radius.

Returns

A new Surface object representing the resulting pipe surface.

Example

const curve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const radii = /* specify a radii */;
const parameters = /* specify a parameters */;
SurfaceBuilder.pipeVariable(curve, radii, parameters);

Static Method: circleSurface

Creates a circular surface with the given origin and radius.

Parameters

  • origin (IVector): The origin point of the circle.
  • radius (number): The radius of the circle.

Returns

A Surface object representing the circular surface.

Example

const origin = new Vector(1, 1, 1);
const radius = 10;
SurfaceBuilder.circleSurface(origin, radius);

Static Method: rectangularSurface

Creates a rectangular surface with the specified origin, width, and length.

Parameters

  • origin (IVector): The origin point of the surface.
  • width (number): The width of the surface.
  • length (number): The length of the surface.

Returns

A Surface object representing the rectangular surface.

Example

const origin = new Vector(1, 1, 1);
const width = 0.5;
const length = 10;
SurfaceBuilder.rectangularSurface(origin, width, length);

Static Method: surfaceByEdges

Builds a surface by creating a loft between the given curves.

Parameters

  • curveList (ICurve[]): The list of curves to create the surface from.

Returns

A Surface object representing the constructed surface.

Example

const curveList = /* specify a curveList */;
SurfaceBuilder.surfaceByEdges(curveList);

Static Method: surfaceFromCurves

Creates a surface from a list of curves.

Parameters

  • curveList (ICurve[]): The list of curves to create the surface from.

Returns

A Surface object representing the created surface.

Example

const curveList = /* specify a curveList */;
SurfaceBuilder.surfaceFromCurves(curveList);

Static Method: surfaceFromPoints

Creates a surface from a list of points.

Parameters

  • pointList (IVector[]): The list of points to create the surface from.

Returns

A Surface object representing the created surface.

Example

const pointList = /* specify a pointList */;
SurfaceBuilder.surfaceFromPoints(pointList);

Static Method: mesh

Creates a mesh surface from three given points.

Parameters

  • pointA (IVector): The first point of the mesh.
  • pointB (IVector): The second point of the mesh.
  • pointC (IVector): The third point of the mesh.

Returns

A Surface object representing the mesh surface.

Example

const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
const pointC = new Vector(1, 1, 1);
SurfaceBuilder.mesh(pointA, pointB, pointC);

Static Method: delaunayMesh

Generates a Delaunay mesh from the given points.

Parameters

  • points (IVector[]): An array of Vector points.

Returns

An array of Surface objects representing the Delaunay mesh.

Example

const points = /* specify a points */;
SurfaceBuilder.delaunayMesh(points);