UNPKG

@bitbybit-dev/core

Version:

Bit By Bit Developers Core CAD API to Program Geometry

52 lines (51 loc) 1.56 kB
/** * Revolved surface functions. * These functions wrap around Verbnurbs library that you can find here http://verbnurbs.com/. * Thanks Peter Boyer for his work. */ export class VerbSurfaceRevolved { constructor(context, math) { this.context = context; this.math = math; } /** * Creates the revolved Nurbs surface * @param inputs Parameters for Nurbs revolved surface * @returns Revolved Nurbs surface */ create(inputs) { return new this.context.verb.geom.RevolvedSurface(inputs.profile, inputs.center, inputs.axis, this.math.degToRad({ number: inputs.angle })); } /** * Get the profile Nurbs curve of the revolved Nurbs surface * @param inputs Revolved Nurbs surface * @returns Nurbs curve */ profile(inputs) { return inputs.revolution.profile(); } /** * Get the center Nurbs curve of the revolved Nurbs surface * @param inputs Revolved Nurbs surface * @returns Center point */ center(inputs) { return inputs.revolution.center(); } /** * Get the rotation axis of the revolved Nurbs surface * @param inputs Revolved Nurbs surface * @returns Axis vector of rotation */ axis(inputs) { return inputs.revolution.axis(); } /** * Get the angle of rotation from revolved Nurbs surface * @param inputs Revolved Nurbs surface * @returns Angle in degrees */ angle(inputs) { return this.math.radToDeg({ number: inputs.revolution.angle() }); } }