/** * OOXML DrawingML guide formula evaluator — core types and evaluation. * * Implements the formula system defined in ISO/IEC 29500-1 §20.1.9.11 (fmla) * for `a:gd` guide definitions used in preset and custom geometries. */ /** * A single guide definition parsed from an `a:gd` XML element. * * Guides are named variables whose values are computed by evaluating * a formula expression against the current variable context. */ export interface GeometryGuide { /** Guide variable name (e.g. `"adj"`, `"g0"`, `"x1"`). */ name: string; formula: string; } /** Shape dimensions used as built-in variables for formula evaluation. */ export interface GeometryContext { /** Shape width in EMU. */ w: number; /** Shape height in EMU. */ h: number; } /** * Internal representation of a parsed formula: an operator token * followed by zero or more operand tokens (either numeric literals * or variable references). */ interface ParsedFormula { op: string; /** Operand tokens — numeric literal strings or variable names. */ args: string[]; } /** * OOXML angle unit scale factor. * * OOXML represents angles in 60,000ths of a degree (e.g. 5400000 = 90 degrees). */ export declare const ANGLE_SCALE = 60000; /** * Convert an OOXML angle value (in 60,000ths of a degree) to radians. * * @param ooxmlAngle - Angle in OOXML units (60,000ths of a degree). * @returns The equivalent angle in radians. */ export declare function angleToRadians(ooxmlAngle: number): number; /** * Parse a raw formula string into its operator and argument tokens. * * Formula strings are whitespace-separated tokens where the first token * is the operator and the rest are operands. For example: * `"*\/ w adj 100000"` parses to `{ op: "*\/", args: ["w", "adj", "100000"] }`. * * @param fmla - The raw formula string from the `@_fmla` XML attribute. * @returns The parsed formula with operator and argument tokens. */ export declare function parseFormula(fmla: string): ParsedFormula; /** * Resolve a single operand token to a numeric value. * * The token is first tested as a numeric literal. If that fails, * it is looked up as a variable name in the provided context. * Unknown variables resolve to 0 defensively. * * @param token - A numeric literal string or variable name. * @param variables - The current variable context. * @returns The resolved numeric value. */ export declare function resolveOperand(token: string, variables: Map): number; /** * Evaluate a single parsed formula against the current variable context. * * Implements all OOXML DrawingML formula operators as defined in * ISO/IEC 29500-1 section 20.1.9.11, including arithmetic (`+-`, `*\/`, `+/`), * trigonometric (`sin`, `cos`, `tan`, `atan`, `at2`), conditional (`?:`), * clamping (`pin`), modulus (`mod`), and combined trig functions (`cat2`, `sat2`). * * @param parsed - The parsed formula (operator + argument tokens). * @param vars - The current variable context (guide names mapped to values). * @returns The computed numeric result. */ export declare function evaluateFormula(parsed: ParsedFormula, vars: Map): number; export {}; //# sourceMappingURL=guide-formula-eval.d.ts.map