npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xc-task-optimizer

v0.3.0

Published

Simple free-flight task course optimizer algorithm

Readme

@xc-task/task-optimizer

Optimized-course algorithm used in [Task creator][https://github.com/ToninoTarsi/task-creator].

This package does one thing only: given task turnpoints with lat/lng/radius/type metadata, it computes the optimized course through cylinders and line goals.

Design choices

  • the UTM zone is chosen from the first turnpoint unless overridden
  • the goal line is built perpendicular to the inbound leg
  • if the point before a line goal is repeated at the same position, the previous distinct turnpoint is used for the inbound heading
  • the start turnpoint mode is inferred: entry if the next point is inside the start radius, otherwise exit
  • optimization happens in projected UTM coordinates, while returned leg distances are recomputed geodesically

Install

npm install @nstcactus/xc-task-optimizer

Usage

import { optimizeTask } from '@nstcactus/xc-task-optimizer';

const result = optimizeTask([
  { lat: 43.3577, lng: 12.749416666666665, radius: 400, type: 'takeoff' },
  { lat: 43.239716666666666, lng: 12.81445, radius: 6000, type: 'start' },
  { lat: 43.239716666666666, lng: 12.81445, radius: 1000, type: 'turnpoint' },
  { lat: 42.98833333333334, lng: 12.778883333333335, radius: 1000, type: 'turnpoint' },
  { lat: 43.479419444444446, lng: 12.60806111111111, radius: 1000, type: 'turnpoint' },
  { lat: 43.34445, lng: 12.724450000000001, radius: 1000, type: 'end-of-speed-section' },
  { lat: 43.34445, lng: 12.724450000000001, radius: 400, type: 'goal' },
]);

console.log(result.planarDistanceMeters);
console.log(result.optimizedPoints);

API

optimizeTask(turnpoints, options?)

Returns:

  • optimizedPoints: optimized lat/lng points, one per input turnpoint
  • optimizedTurnpoints: normalized turnpoints with their optimized point attached
  • legDistancesMeters: geodesic leg distances between optimized points
  • cumulativeDistancesMeters: running geodesic distance totals
  • planarDistanceMeters: legacy optimization objective in UTM meters
  • geodesicDistanceMeters: sum of geodesic leg distances
  • utmZone: chosen or forced UTM zone
  • hemisphere: hemisphere used for UTM conversion
  • goalLine: returned only for line goals

inferStartMode(turnpoints)

Runs the legacy start-direction inference without performing the full optimization.

computeGoalLine(turnpoints, goalIndex)

Returns the rendered geometry of a line goal as { start, end } in lat/lng.

Development

Build:

npm run build

Run tests:

npm run test

Run example:

npm run example