Function getOptimizedPoints

  • Simplifies a given set of points using the Ramer-Douglas-Peucker algorithm and rounds the x and y values of the resulting points.

    Parameters

    • fullPoints: [x: number, y: number][]

      The array of points to be simplified. Each point is represented as a pair of numbers: [pos, val].

    • simplify: number

      The maximum allowed perpendicular distance from a point to the line segment.

    • round: number

      The number of decimal places to which point values should be rounded.

    Returns [x: number, y: number][] | null

    The simplified and rounded points, or null if the input was null.

    The function first checks if the input points are null. If they are, it returns null. If they are not null, the function applies the Ramer-Douglas-Peucker algorithm to the points using the specified tolerance. Then it rounds the x and y values of the resulting points to the specified number of decimal places. The x values are always rounded to at least 2 decimal places because they are represented as a percentage.

Generated using TypeDoc