Coder Social home page Coder Social logo

seonglae / to-smooth Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 1.0 157 KB

Chaikin's smoothing algorithm extended to a multidimensional library

License: MIT License

TypeScript 100.00%
chaikin smooth polyline linestring multilinestring geojson smoothing smoother algorithm svg

to-smooth's Introduction

To Smooth

Make your lines to curves

undefined

Chaikin's smoothing algorithm for polylines of any dimensions. Impressed by chaikin-smooth but, to-smooth is dimension generalized version of chaikin-smooth with iteration option.

You can use to-smooth instead of chaikin-smooth

From

To


Usage

import smooth from 'to-curve'
import geojson from 'geojson.json'


if (geojson.geometry.type === 'LineString')
  geojson.geometry.coordinates = smooth(geojson.geometry.coordinates)
else if (geojson.geometry.type === 'MultiLineString')
  geojson.geometry.coordinates = geojson.geometry.coordinates.map(points => smooth(points))

Docs

export default function smooth(points, options: {iteration, factor} = {iteration: 1, factor: 0.75})

points

same dimension point array like LineString Coordinates

  • type - Array<Array<number>>

options

  • iteration
    • default - 1
    • description - if this increase, more smoother line return
    • iteration how many algorithm applied
  • factor
    • default - 0.75
    • range - 0.5 - 1
    • do not have to change or assign

License

MIT

to-smooth's People

Contributors

lgtm-migrator avatar renovate-bot avatar renovate[bot] avatar seonglae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lgtm-migrator

to-smooth's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json5
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: node

deps: renovate dependency dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • deps: Update all non-major dependencies (@types/node, typescript)

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/codeql.yml
  • actions/checkout v4
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
npm
package.json
  • @types/node 18.18.6
  • tsup ^7.2.0
  • typescript 5.2.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.