1.4.1 • Published 5 years ago

bbox-aspect-ratio v1.4.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Bounding Box Aspect Ratio

Calculate aspect ration from bounding box

🔧 Installation

npm i bbox-aspect-ratio

📦 Usage

import { bBoxAspectRatio, calculateSize, SizeType } from "bbox-aspect-ratio";

// Get aspect ratio
const topRight = [76.20742, 11.59426];
const bottomLeft = [76.86794, 11.95073];
const aspectRatio = bBoxAspectRatio([...topRight, ...bottomLeft]);
console.log(aspectRatio); // [1321, 713]

// Calculate size by width
const sizeByWidth = calculateSize(aspectRatio, 50, SizeType.Width);
console.log(sizeByWidth); // 27 → w: 50, h: 27

// Calculate size by height
const sizeByHeight = calculateSize(aspectRatio, 50, SizeType.Height);
console.log(sizeByWidth); // 93 → w: 93, h: 50
1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago