# bresenham **Repository Path**: ArkTSCentralRepository/bresenham ## Basic Information - **Project Name**: bresenham - **Description**: bresenham 是一个在 ArkTS 中实现的 Bresenham 线算法,用于计算两点之间的整数坐标点。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-21 - **Last Updated**: 2024-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # bresenham 基于[bresenham](https://www.npmjs.com/package/bresenham)原库0.0.4版本进行适配, 所有功能代码已经转换为`ArkTS`文件 ## Install ```sh ohpm install bresenham ``` ## Description [Bresenham's line algorithm](http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) in ArkTS. ## import ```typescript import bresenham as line from 'bresenham'; import { Point } from 'bresenham'; ``` ## API #### bresenham(x0, y0, x1, y1[, fn]) Calls `fn` with points between `(x0, y0)` and `(x1, y1)`. The points have integer coordinates. If `fn` is omitted, an array of points is returned. The algorithm uses no floating point arithmetics, so it's considered to be fast. But JS numbers are not integers, so I'm not sure whether this is a faster approach than the naive algorithm or not. ## License MIT