Class: CurveBuilder

The CurveBuilder class provides static methods for constructing curves.

Constructors

new CurveBuilder()

new CurveBuilder(): CurveBuilder

Returns

CurveBuilder

Methods

arc()

static arc(origin, radius, alpha1, alpha2): Curve

Creates an arc curve.

Parameters

origin: Vector

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

Curve

A Curve object representing the arc curve.


arc3Pnt()

static arc3Pnt(pointA, pointB, pointC): object

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

Parameters

pointA: Vector

The first point.

pointB: Vector

The second point.

pointC: Vector

The third point.

Returns

object

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

center

center: Vector

radius

radius: number

shape

shape: Curve


arcSED()

static arcSED(start, end, direction): object

Constructs an arc of a circle in 3D space.

Parameters

start: Vector

The starting point of the arc.

end: Vector

The ending point of the arc.

direction: Vector

The direction vector of the arc.

Returns

object

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

curve

curve: Curve

plane

plane: Plane

radius

radius: number


bSplineCurve()

static bSplineCurve(pointList, degree, closed): Curve

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

Parameters

pointList: Vector[]

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

Curve

A Curve object representing the constructed B-spline curve.


blendCurve()

static blendCurve(curveA, curveB, factorA, factorB): Curve

Blends two curves together based on the given factors.

Parameters

curveA: Curve

The first curve to blend.

curveB: Curve

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

Curve

A Curve object representing the blended curve.


circle()

static circle(origin, radius): Curve

Creates a circle curve with the given origin and radius.

Parameters

origin: Vector

The origin point of the circle.

radius: number

The radius of the circle.

Returns

Curve

A Curve object representing the circle curve.


circle3Pnt()

static circle3Pnt(pointA, pointB, pointC): object

Constructs a circle from three given points.

Parameters

pointA: Vector

The first point.

pointB: Vector

The second point.

pointC: Vector

The third point.

Returns

object

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

curve

curve: Curve

plane

plane: Plane

radius

radius: number


circleBy2Tan()

static circleBy2Tan(curveA, curveB, point): Curve

Constructs a circle by two tangents.

Parameters

curveA: Curve

The first curve.

curveB: Curve

The second curve.

point: Vector

The circle center point.

Returns

Curve

A new Curve object representing the constructed circle.


circleBy3Tan()

static circleBy3Tan(curveA, curveB, curveC, point): Curve

Constructs a circle by three tangent curves.

Parameters

curveA: Curve

The first curve for tangency constraint.

curveB: Curve

The second curve for tangency constraint.

curveC: Curve

The third curve for tangency constraint.

point: Vector

The circle center point.

Returns

Curve

A new Curve object representing the constructed circle.


circleCNR()

static circleCNR(center, normal, radius): Curve

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

Parameters

center: Vector

The center point of the circle.

normal: Vector

The normal vector of the circle's plane.

radius: number

The radius of the circle.

Returns

Curve

A Curve object representing the constructed circle curve.


connectWithCurve()

static connectWithCurve(start, end, curve): Curve

Connects two points with a curve.

Parameters

start: Vector

The starting point of the curve.

end: Vector

The ending point of the curve.

curve: Curve

The curve to connect the points with.

Returns

Curve

The resulting curve after connecting the points.


curveToSurface()

static curveToSurface(curve): Surface

Converts a curve to a surface.

Parameters

curve: Curve

The curve to convert.

Returns

Surface

The converted surface.


delaunayEdges()

static delaunayEdges(points, plane?): object

Generates Delaunay edges from a set of points.

Parameters

points: Vector[]

An array of Vector objects representing the points.

plane?: Plane

An optional Plane object to set the plane of the curves.

Returns

object

A Curve object representing the generated Delaunay edges.

curves

curves: Curve[]

graph

graph: Map<any, any>


ellipse()

static ellipse(origin, radius1, radius2): Curve

Creates an ellipse curve.

Parameters

origin: Vector

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

Curve

A Curve object representing the ellipse curve.


helix()

static helix(pitch, height, radius1, radius2, center, dir, leftHand): Curve

Generates a helix curve.

Parameters

pitch: number

The pitch of the helix.

height: number

The height of the helix.

radius1: number

The radius at the start of the helix.

radius2: number

The radius at the end of the helix.

center: Vector

The base center point of the helix.

dir: Vector

The direction vector of the helix.

leftHand: boolean

Indicates whether the helix is left-handed or not.

Returns

Curve

A Curve object representing the helix curve.


inCircle()

static inCircle(pointA, pointB, pointC): object

Calculates the incircle of a triangle.

Parameters

pointA: Vector

The first corner of triangle.

pointB: Vector

The second corner of triangle.

pointC: Vector

The third corner of triangle.

Returns

object

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

curve

curve: Curve

plane

plane: Plane

radius

radius: number


inEllipse()

static inEllipse(pointA, pointB, pointC): object

Calculates the inscribed ellipse of a triangle.

Parameters

pointA: Vector

The first corner of triangle.

pointB: Vector

The second corner of triangle.

pointC: Vector

The third corner of triangle.

Returns

object

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

curve

curve: Curve

plane

plane: Plane


line()

static line(start, end): Curve

Creates a straight line curve between two points.

Parameters

start: Vector

The starting point of the line.

end: Vector

The ending point of the line.

Returns

Curve

A Curve object representing the straight line curve.


line2Pln()

static line2Pln(line, planeA, planeB): Curve

Creates a straight line between two planes.

Parameters

line: Curve

The input curve.

planeA: Plane

The first plane to intersect with the input curve.

planeB: Plane

The second plane to intersect with the input curve.

Returns

Curve

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


line4Pnt()

static line4Pnt(line, pointA, pointB): Curve

Creates a straight line from four points.

Parameters

line: Curve

The input curve.

pointA: Vector

The first point to project onto the input curve.

pointB: Vector

The second point to project onto the input curve.

Returns

Curve

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


lineSDL()

static lineSDL(start, direction, length): Curve

Creates a straight line curve in 3D space.

Parameters

start: Vector

The starting point of the line.

direction: Vector

The direction vector of the line.

length: number

The length of the line.

Returns

Curve

A Curve object representing the straight line curve.


modifiedArc()

static modifiedArc(arc, radius, angle?): Curve

Modifies an arc by changing its radius and angle.

Parameters

arc: Curve

The original arc to be modified.

radius: number

The new radius for the arc.

angle?: number

The new angle for the arc. If not provided, the end angle of the original arc will be used.

Returns

Curve

A new Curve object representing the modified arc.


nurbsCurve()

static nurbsCurve(points, degree, closed): Curve

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

Parameters

points: Vector[]

The control points of the curve.

degree: number

The degree of the curve.

closed: boolean

A flag indicating whether the curve is closed.

Returns

Curve

A Curve object representing the NURBS curve.


nurbsCurvePWKD()

static nurbsCurvePWKD(points, weightsList, knotsList, degree): Curve

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

Parameters

points: Vector[]

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

Curve

A Curve object representing the constructed NURBS curve.


polygon()

static polygon(radius, countOfSides, origin): Curve

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: Vector

The origin point of the polygon.

Returns

Curve

A Curve object representing the generated polygon curve.


polygonEdge()

static polygonEdge(start, end, planePoint, countOfSides): object

Generates a polygon from a single edge.

Parameters

start: Vector

The starting point of the edge.

end: Vector

The ending point of the edge.

planePoint: Vector

A point on the plane in which the edge lies.

countOfSides: number

The number of sides of the polygon.

Returns

object

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.

curve

curve: Curve = polygon

inRadius

inRadius: number

origin

origin: Vector = outCircle.plane.origin

outRadius

outRadius: number


polyline()

static polyline(pointList, closed): Curve

Creates a polyline curve from a list of points.

Parameters

pointList: Vector[]

The list of points defining the polyline.

closed: boolean

Indicates whether the polyline is closed or not.

Returns

Curve

A Curve object representing the polyline curve.


rectangle()

static rectangle(origin, width, length): Curve

Creates a rectangle curve.

Parameters

origin: Vector

The origin point of the rectangle.

width: number

The width of the rectangle.

length: number

The length of the rectangle.

Returns

Curve

A Curve object representing the rectangle curve.


rectangle2Pnt()

static rectangle2Pnt(pointA, pointB): Curve

Creates a rectangle curve based on two given points.

Parameters

pointA: Vector

The first corner point of the rectangle.

pointB: Vector

The second corner point of the rectangle.

Returns

Curve

A Curve object representing the rectangle curve.


rectangle3Pnt()

static rectangle3Pnt(aPnt, bPnt, cPnt): Curve

Creates a rectangle in 3D space using three points.

Parameters

aPnt: Vector

The first corner point of the rectangle.

bPnt: Vector

The second corner point of the rectangle.

cPnt: Vector

The third point along the rectangle edge is opposite the first and second points.

Returns

Curve

A Curve object representing the rectangle.


rectangleByCenter()

static rectangleByCenter(center, width, length): Curve

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

Parameters

center: Vector

The center point of the rectangle.

width: number

The width of the rectangle.

length: number

The length of the rectangle.

Returns

Curve

A Curve object representing the rectangle.


star()

static star(origin, radiusIn, radiusOut, countOfSides): Curve

Generates a star-shaped curve.

Parameters

origin: Vector

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

Curve

A Curve object representing the star-shaped curve.


tangentArcs()

static tangentArcs(circle1, circle2, radius): object

Calculates the tangent arcs between two circles.

Parameters

circle1: Curve

The first circle.

circle2: Curve

The second circle.

radius: number

The radius of tangent arcs.

Returns

object

An object containing the tangent lines as tangent1 and tangent2.

arc1

arc1: Curve

arc2

arc2: Curve

Throws

Error if the circle is not of type Circle.

Throws

Error if the circles are not in the same plane.


tangentLines()

static tangentLines(point, circle): object

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

Parameters

point: Vector

The point to calculate the tangent lines from.

circle: Curve

The circle to calculate the tangent lines to.

Returns

object

An object containing the tangent lines as tangent1 and tangent2.

tangent1

tangent1: Curve

tangent2

tangent2: Curve

Throws

Error if the curve is not of type Circle.

Throws

Error if the circle and the point are not in the same plane.


tangentLinesEx()

static tangentLinesEx(circle1, circle2): object

Calculates the tangent lines between two circles.

Parameters

circle1: Curve

The first circle.

circle2: Curve

The second circle.

Returns

object

An object containing the tangent lines as tangent1 and tangent2.

tangent1

tangent1: Curve

tangent2

tangent2: Curve

Throws

Error if the circle is not of type Circle.

Throws

Error if the circles are not in the same plane.


tangentLinesIn()

static tangentLinesIn(circle1, circle2): object

Calculates the tangent lines between two circles.

Parameters

circle1: Curve

The first circle.

circle2: Curve

The second circle.

Returns

object

An object containing the tangent lines as tangent1 and tangent2.

tangent1

tangent1: Curve

tangent2

tangent2: Curve

Throws

Error if the circle is not of type Circle.

Throws

Error if the circles are not in the same plane.


voronoi2D()

static voronoi2D(points, boundary?, plane?): Curve[]

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

Parameters

points: Vector[]

An array of Vector objects representing the points.

boundary?: Curve | Surface | Solid

Optional boundary object (Surface, Solid, or Curve) to constrain the Voronoi diagram.

plane?: Plane

Optional Plane object to project the points onto before computing the Voronoi diagram.

Returns

Curve[]

An array of Curve objects representing the Voronoi diagram.