# round-cone-distance

> optimized signed distance function for rounded cones (aka lozenges with different-sized "ends")

Latest version **1.0.11** (published 2021-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install round-cone-distance
pnpm add round-cone-distance
yarn add round-cone-distance
bun add round-cone-distance
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2021-10-20 |
| First published | 2021-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | bonsai3d |
| Maintainers | bonsai3d |
| Keywords | lozenge, signed, distance, field, function, sdf, 3d, cone, raytrace |

## Links

- npm: https://www.npmjs.com/package/round-cone-distance
- Homepage: https://github.com/stonkpunk/my-npm-modules/tree/main/round-cone-distance
- npm.io page: https://npm.io/package/round-cone-distance

## Recent versions

- 1.0.11 (latest) — 2021-10-20
- 1.0.0 — 2021-04-03

## README

# round-cone-distance

Highly optimized signed distance function for rounded cones (aka lozenges with different-sized "ends") in javascript.

Derived from a GLSL distance function by [inigo quilez](https://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm).

![candy corn](https://i.imgur.com/P0Lpb1z.png)

## Installation

```sh
npm i round-cone-distance
```

## Usage

```javascript
var rcd = require('round-cone-distance');

var r0 = 1;
var r1 = 5;
var pointA = [0,0,0];
var pointB = [10,3,-5];

var samplingPoint = [10,10,10];

var distance = rcd.roundConeDistance(samplingPoint, pointA, pointB, r0,r1);
console.log(distance) //12.493968786553904

var distanceSquared = rcd.roundConeDistanceSquared(samplingPoint, pointA, pointB, r0,r1);
console.log(distanceSquared) //248.8507665662628

```

---
_Source: https://npm.io/package/round-cone-distance · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
