Business

Class: CurveBuilder

The CurveBuilder class provides static methods for constructing curves.

Static Method: line

Creates a straight line curve between two points.

Parameters

  • start (IVector): The starting point of the line.
  • end (IVector): The ending point of the line.

Returns

A Curve object representing the straight line curve.

Example

const start = new Vector(0, 0, 0);
const end = new Vector(1, 1, 1);
CurveBuilder.line(start, end);

Static Method: lineSDL

Creates a straight line curve in 3D space.

Parameters

  • start (IVector): The starting point of the line.
  • direction (IVector): The direction vector of the line.
  • length (number): The length of the line.

Returns

A Curve object representing the straight line curve.

Example

const start = new Vector(0, 0, 0);
const direction = new Vector(1, 1, 1);
const length = 10;
CurveBuilder.lineSDL(start, direction, length);

Static Method: line4Pnt

Creates a straight line from four points.

Parameters

  • line (ICurve): The input curve.
  • pointA (IVector): The first point to project onto the input curve.
  • pointB (IVector): The second point to project onto the input curve.

Returns

A new Curve object representing the straight line passing through the first and second points.

Example

const line = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
CurveBuilder.line4Pnt(line, pointA, pointB);

Static Method: line2Pln

Creates a straight line between two planes.

Parameters

  • line (ICurve): The input curve.
  • planeA (IPlane): The first plane to intersect with the input curve.
  • planeB (IPlane): The second plane to intersect with the input curve.

Returns

A new Curve object representing the straight line between the two planes.

Example

const line = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const planeA = /* specify a planeA */;
const planeB = /* specify a planeB */;
CurveBuilder.line2Pln(line, planeA, planeB);

Static Method: tangentLines

Calculates the tangent lines between a given point and a circle.

Parameters

  • point (IVector): The point to calculate the tangent lines from.
  • circle (ICurve): The circle to calculate the tangent lines to.

Returns

An object containing the tangent lines as tangent1 and tangent2.

Example

const point = new Vector(1, 1, 1);
const circle = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
CurveBuilder.tangentLines(point, circle);

Static Method: tangentLinesIn

Calculates the tangent lines between two circles.

Parameters

  • circle1 (ICurve): The first circle.
  • circle2 (ICurve): The second circle.

Returns

An object containing the tangent lines as tangent1 and tangent2.

Example

const circle1 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const circle2 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
CurveBuilder.tangentLinesIn(circle1, circle2);

Static Method: tangentLinesEx

Calculates the tangent lines between two circles.

Parameters

  • circle1 (ICurve): The first circle.
  • circle2 (ICurve): The second circle.

Returns

An object containing the tangent lines as tangent1 and tangent2.

Example

const circle1 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const circle2 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
CurveBuilder.tangentLinesEx(circle1, circle2);

Static Method: tangentArcs

Calculates the tangent arcs between two circles.

Parameters

  • circle1 (ICurve): The first circle.
  • circle2 (ICurve): The second circle.
  • radius (number): The radius of tangent arcs.

Returns

An object containing the tangent lines as tangent1 and tangent2.

Example

const circle1 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const circle2 = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const radius = 10;
CurveBuilder.tangentArcs(circle1, circle2, radius);

Static Method: circle

Creates a circle curve with the given origin and radius.

Parameters

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

Returns

A Curve object representing the circle curve.

Example

const origin = new Vector(1, 1, 1);
const radius = 10;
CurveBuilder.circle(origin, radius);

Static Method: circle3Pnt

Constructs a circle from three given points.

Parameters

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

Returns

An object containing the constructed circle curve, radius, and plane.

Example

const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
const pointC = new Vector(1, 1, 1);
CurveBuilder.circle3Pnt(pointA, pointB, pointC);

Static Method: circleCNR

Constructs a circular curve in 3D space using the Center-Normal-Radius (CNR) method.

Parameters

  • center (IVector): The center point of the circle.
  • normal (IVector): The normal vector of the circle's plane.
  • radius (number): The radius of the circle.

Returns

A Curve object representing the constructed circle curve.

Example

const center = new Vector(1, 1, 1);
const normal = new Vector(1, 1, 1);
const radius = 10;
CurveBuilder.circleCNR(center, normal, radius);

Static Method: inCircle

Calculates the incircle of a triangle.

Parameters

  • pointA (IVector): The first corner of triangle.
  • pointB (IVector): The second corner of triangle.
  • pointC (IVector): The third corner of triangle.

Returns

An object containing the calculated circle curve, plane, and radius of the circle.

Example

const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
const pointC = new Vector(1, 1, 1);
CurveBuilder.inCircle(pointA, pointB, pointC);

Static Method: circleBy2Tan

Constructs a circle by two tangents.

Parameters

  • curveA (ICurve): The first curve.
  • curveB (ICurve): The second curve.
  • point (IVector): The circle center point.

Returns

A new Curve object representing the constructed circle.

Example

const curveA = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const curveB = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const point = new Vector(1, 1, 1);
CurveBuilder.circleBy2Tan(curveA, curveB, point);

Static Method: circleBy3Tan

Constructs a circle by three tangent curves.

Parameters

  • curveA (ICurve): The first curve for tangency constraint.
  • curveB (ICurve): The second curve for tangency constraint.
  • curveC (ICurve): The third curve for tangency constraint.
  • point (IVector): The circle center point.

Returns

A new Curve object representing the constructed circle.

Example

const curveA = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const curveB = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const curveC = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const point = new Vector(1, 1, 1);
CurveBuilder.circleBy3Tan(curveA, curveB, curveC, point);

Static Method: inEllipse

Calculates the inscribed ellipse of a triangle.

Parameters

  • pointA (IVector): The first corner of triangle.
  • pointB (IVector): The second corner of triangle.
  • pointC (IVector): The third corner of triangle.

Returns

An object containing the generated ellipse curve and the plane it lies on.

Example

const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
const pointC = new Vector(1, 1, 1);
CurveBuilder.inEllipse(pointA, pointB, pointC);

Static Method: ellipse

Creates an ellipse curve.

Parameters

  • origin (IVector): The origin point of the ellipse.
  • radius1 (number): The semi-major radius of the ellipse.
  • radius2 (number): The semi-minor radius of the ellipse.

Returns

A Curve object representing the ellipse curve.

Example

const origin = new Vector(1, 1, 1);
const radius1 = 0.5;
const radius2 = 0.5;
CurveBuilder.ellipse(origin, radius1, radius2);

Static Method: arc

Creates an arc curve.

Parameters

  • origin (IVector): The origin point of the arc.
  • radius (number): The radius of the arc.
  • alpha1 (number): The starting angle of the arc in radians.
  • alpha2 (number): The ending angle of the arc in radians.

Returns

A Curve object representing the arc curve.

Example

const origin = new Vector(1, 1, 1);
const radius = 10;
const alpha1 = 0.5;
const alpha2 = 0.5;
CurveBuilder.arc(origin, radius, alpha1, alpha2);

Static Method: modifiedArc

Modifies an arc by changing its radius and angle.

Parameters

  • arc (ICurve): The original arc to be modified.
  • radius (number): The new radius for the arc.

Returns

A new Curve object representing the modified arc.

Example

const arc = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const radius = 10;
CurveBuilder.modifiedArc(arc, radius);

Static Method: arc3Pnt

Constructs an arc of a circle passing through three given points.

Parameters

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

Returns

An object containing the constructed arc shape, radius, and center.

Example

const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
const pointC = new Vector(1, 1, 1);
CurveBuilder.arc3Pnt(pointA, pointB, pointC);

Static Method: ellipseArc

Constructs an Ellipse Arc.

Parameters

  • origin (IVector): The origin point of the arc.
  • radius1 (number): The semi-major radius of the arc.
  • radius2 (number): The semi-minor radius of the arc.
  • alpha1 (number): The starting angle of the arc in radians.
  • alpha2 (number): The ending angle of the arc in radians.

Returns

A Curve object representing the arc curve.

Example

const origin = new Vector(1, 1, 1);
const radius1 = 0.5;
const radius2 = 0.5;
const alpha1 = 0.5;
const alpha2 = 0.5;
CurveBuilder.ellipseArc(origin, radius1, radius2, alpha1, alpha2);

Static Method: arcSED

Constructs an arc of a circle in 3D space.

Parameters

  • start (IVector): The starting point of the arc.
  • end (IVector): The ending point of the arc.
  • direction (IVector): The direction vector of the arc.

Returns

An object containing the constructed arc curve, radius, and plane.

Example

const start = new Vector(0, 0, 0);
const end = new Vector(1, 1, 1);
const direction = new Vector(1, 1, 1);
CurveBuilder.arcSED(start, end, direction);

Static Method: connectWithCurve

Connects two points with a curve.

Parameters

  • start (IVector): The starting point of the curve.
  • end (IVector): The ending point of the curve.
  • curve (ICurve): The curve to connect the points with.

Returns

The resulting curve after connecting the points.

Example

const start = new Vector(0, 0, 0);
const end = new Vector(1, 1, 1);
const curve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
CurveBuilder.connectWithCurve(start, end, curve);

Static Method: helix

Generates a helix curve.

Returns

A Curve object representing the helix curve.

Example

CurveBuilder.helix();

Static Method: polyline

Creates a polyline curve from a list of points.

Parameters

  • pointList (IVector[]): The list of points defining the polyline.
  • closed (boolean): Indicates whether the polyline is closed or not.

Returns

A Curve object representing the polyline curve.

Example

const pointList = /* specify a pointList */;
const closed = /* specify a closed */;
CurveBuilder.polyline(pointList, closed);

Static Method: bSplineCurve

Constructs a B-spline curve based on the given list of points.

Parameters

  • pointList (IVector[]): The list of points to construct the curve from.
  • degree (number): The degree of the B-spline curve.
  • closed (boolean): Indicates whether the curve should be closed.

Returns

A Curve object representing the constructed B-spline curve.

Example

const pointList = /* specify a pointList */;
const degree = 0.5;
const closed = /* specify a closed */;
CurveBuilder.bSplineCurve(pointList, degree, closed);

Static Method: bezierCurve

Creates a Bézier curve based on the given points.

Parameters

  • pointList (IVector[]): The control points of the curve.

Returns

A Curve object representing the Bézier curve.

Example

const pointList = /* specify a pointList */;
CurveBuilder.bezierCurve(pointList);

Static Method: nurbsCurve

Creates a NURBS curve based on the given points, degree, and closed flag.

Parameters

  • points (IVector[]): The control points of the curve.
  • degree (number): The degree of the curve.
  • closed (boolean): A flag indicating whether the curve is closed.

Returns

A Curve object representing the NURBS curve.

Example

const points = /* specify a points */;
const degree = 0.5;
const closed = /* specify a closed */;
CurveBuilder.nurbsCurve(points, degree, closed);

Static Method: nurbsCurvePWKD

Constructs a NURBS curve using the specified control points, weights, knots, and degree.

Parameters

  • points (IVector[]): The control points of the curve.
  • weightsList (number[]): The weights associated with each control point.
  • knotsList (number[]): The knot vector of the curve.
  • degree (number): The degree of the curve.

Returns

A Curve object representing the constructed NURBS curve.

Example

const points = /* specify a points */;
const weightsList = /* specify a weightsList */;
const knotsList = /* specify a knotsList */;
const degree = 0.5;
CurveBuilder.nurbsCurvePWKD(points, weightsList, knotsList, degree);

Static Method: polygon

Generates a polygon shape with the specified radius and number of sides.

Parameters

  • radius (number): The radius of the polygon.
  • countOfSides (number): The number of sides of the polygon.
  • origin (IVector): The origin point of the polygon.

Returns

A Curve object representing the generated polygon curve.

Example

const radius = 10;
const countOfSides = 0.5;
const origin = new Vector(1, 1, 1);
CurveBuilder.polygon(radius, countOfSides, origin);

Static Method: polygonEdge

Generates a polygon from a single edge.

Parameters

  • start (IVector): The starting point of the edge.
  • end (IVector): The ending point of the edge.
  • planePoint (IVector): A point on the plane in which the edge lies.
  • countOfSides (number): The number of sides of the polygon.

Returns

An object containing the generated polygon curve, the origin of the circle that circumscribes the polygon, the radius of the circumscribed circle, and the radius of the inscribed circle.

Example

const start = new Vector(0, 0, 0);
const end = new Vector(1, 1, 1);
const planePoint = new Vector(1, 1, 1);
const countOfSides = 0.5;
CurveBuilder.polygonEdge(start, end, planePoint, countOfSides);

Static Method: rectangle

Creates a rectangle curve.

Parameters

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

Returns

A Curve object representing the rectangle curve.

Example

const origin = new Vector(1, 1, 1);
const width = 0.5;
const length = 10;
CurveBuilder.rectangle(origin, width, length);

Static Method: rectangle2Pnt

Creates a rectangle curve based on two given points.

Parameters

  • pointA (IVector): The first corner point of the rectangle.
  • pointB (IVector): The second corner point of the rectangle.

Returns

A Curve object representing the rectangle curve.

Example

const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
CurveBuilder.rectangle2Pnt(pointA, pointB);

Static Method: rectangleByCenter

Creates a rectangle by specifying the center point, width, and length.

Parameters

  • center (IVector): The center point of the rectangle.
  • width (number): The width of the rectangle.
  • length (number): The length of the rectangle.

Returns

A Curve object representing the rectangle.

Example

const center = new Vector(1, 1, 1);
const width = 0.5;
const length = 10;
CurveBuilder.rectangleByCenter(center, width, length);

Static Method: rectangle3Pnt

Creates a rectangle in 3D space using three points.

Parameters

  • aPnt (IVector): The first corner point of the rectangle.
  • bPnt (IVector): The second corner point of the rectangle.
  • cPnt (IVector): The third point along the rectangle edge is opposite the first and second points.

Returns

A Curve object representing the rectangle.

Example

const aPnt = new Vector(1, 1, 1);
const bPnt = new Vector(1, 1, 1);
const cPnt = new Vector(1, 1, 1);
CurveBuilder.rectangle3Pnt(aPnt, bPnt, cPnt);

Static Method: star

Generates a star-shaped curve.

Parameters

  • origin (IVector): The origin point of the star.
  • radiusIn (number): The radius of the inner points of the star.
  • radiusOut (number): The radius of the outer points of the star.
  • countOfSides (number): The number of sides of the star.

Returns

A Curve object representing the star-shaped curve.

Example

const origin = new Vector(1, 1, 1);
const radiusIn = 0.5;
const radiusOut = 0.5;
const countOfSides = 0.5;
CurveBuilder.star(origin, radiusIn, radiusOut, countOfSides);

Static Method: blendCurve

Blends two curves together based on the given factors.

Parameters

  • curveA (ICurve): The first curve to blend.
  • curveB (ICurve): The second curve to blend.
  • factorA (number): The blending factor for curveA (0 to 1).
  • factorB (number): The blending factor for curveB (0 to 1).

Returns

A Curve object representing the blended curve.

Example

const curveA = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const curveB = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const factorA = 0.5;
const factorB = 0.5;
CurveBuilder.blendCurve(curveA, curveB, factorA, factorB);

Static Method: delaunayEdges

Generates Delaunay edges from a set of points.

Parameters

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

Returns

A Curve object representing the generated Delaunay edges.

Example

const points = /* specify a points */;
CurveBuilder.delaunayEdges(points);

Static Method: voronoi2D

Computes the Voronoi diagram in 2D for a given set of points.

Parameters

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

Returns

An array of Curve objects representing the Voronoi diagram.

Example

const points = /* specify a points */;
CurveBuilder.voronoi2D(points);

Static Method: curveToSurface

Converts a curve to a surface.

Parameters

  • curve (ICurve): No description

Returns

The converted surface.

Example

const curve = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
CurveBuilder.curveToSurface(curve);