Code Monkey home page Code Monkey logo

shape's Introduction

shape

A collection of utility functions for geographical regions:

  • area(shape): returns the geographical area of a shape, as a percentage of the planet's surface area.
  • bounds(shape): returns the bounding quadrangle of a shape (which is, itself, a shape). (This is useful because most functions are much faster for a quadrangle than they are for a polygon.)
  • overlaps(shape1,shape2): returns a boolean representing whether or not two shapes overlap each other. (That is, whether they have at least a point in common.)
  • contains(shape1,shape2): returns a boolean representing whether or not a shape completely contains another. (That is, whether all points of shape2 are also in shape1.)

A shape is an Array of number pairs, representing the latitude and longitude of a point on a planet's surface. The length of the array affects the how the library interprets the shape:

  • An array of length 2 is a point (in the Euclidean sense).
  • An array of length 4 is a quadrangle bounded by the latitudes and longitudes of two points. The latitude and longitude of the first point are assumed to be less than the latitude and longitude of the second.
  • An array of length 6 or more is a polygon bounded the points in order. No particular winding order is assumed, though it is assumed that the polygon is closed: that is, that the first and last points are connected by an edge. (Said another way, one does not need to manually "close" a polygon by specifying the first point at both the beginning and end of the polygon.)

shape's People

Watchers

 avatar

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.