@mlightcad/shx-parser
Version:
A TypeScript library for parsing AutoCAD SHX font files
46 lines (45 loc) • 1.72 kB
TypeScript
import { Point } from './point';
/**
* Represents a circular arc defined by either:
* 1. Start point, end point, and bulge factor
* 2. Center point, radius, start octant, and number of octants to span
*
* For bulge arcs:
* - bulge = (2 * H / D) where H is height from midpoint and D is chord length
* - bulge = 1 represents a semicircle (180 degrees)
* - bulge = 0 represents a straight line
* - |bulge| should not exceed 1
*/
export declare class Arc {
readonly start: Point;
readonly end: Point;
private readonly bulge;
readonly center: Point;
readonly radius: number;
readonly startAngle: number;
readonly endAngle: number;
readonly isClockwise: boolean;
/**
* Creates a bulge-defined arc
* @param start Start point
* @param end End point
* @param bulge Bulge factor (-1 to 1, where 1 is a semicircle)
*/
static fromBulge(start: Point, end: Point, bulge: number): Arc;
/**
* Creates an octant-defined arc
* @param center Center point of the arc
* @param radius Radius of the arc
* @param startOctant Starting octant (0-7)
* @param octantCount Number of octants to span (0-8, where 0 means 8 octants)
* @param isClockwise Whether the arc goes clockwise
*/
static fromOctant(center: Point, radius: number, startOctant: number, octantCount: number, isClockwise: boolean): Arc;
private constructor();
/**
* Tessellates the arc into a series of points that approximate the arc.
* @param circleSpan The angle span between tessellated points (default Math.PI / 18)
* @returns Array of points representing the tessellated arc
*/
tessellate(circleSpan?: number): Point[];
}