Download the PHP package hypership/geo without Composer

On this page you can find all versions of the php package hypership/geo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package geo

hypership/geo

Introduction

This library provides features to represent and manipulate geographical objects in a 3D system.

It's initially built to represent several bodies in a galaxy.

It requires PHP 8.1 to use enumerations.

Classes to represent coordinates

These classes allow to represent a point in different 3D coordinates systems.

Each class allows converting to other coordinates systems.

Point3D

Represents a 3D point, identified by a (x, y, z) cartesian coordinates.

PointSpherical

Represents a 3D point, identified by a (r, θ, φ) spherical coordinates, as used in physics and following ISO 80000-2:2019 convention:

This class could be used to denote the elevation instead of inclination as θ, but if so, switch back to the inclination before converting to cylindrical or cartesian coordinates:

PointPolarZ

Represents a 3D point, identified by a (ρ, φ, z) cylindrical coordinates:

This notation follows the ISO 31-11:1992 standard.

Alternatives to represent coordinates

Octocube

Maps 3D coordinates into a cube, divided in 8 sections.

Each section is called sector, numbered from 1 to 8:

   _____ _______
  /  5  /  6  / |
 /- - -/- - -/  |
/_____/____ / | |
|     |     | |/|
|  7  |  8  | / | 2
|_____|_____|/| |
|     |     | |/
|  3  |  4  | /
|_____|_____|/

The point (0, 0, 0) is at the cube center.

*Use the octocube to represent octants

As a 2D plane can be divided into quadrants, a 3D space can be divided in octants. See https://en.wikipedia.org/wiki/Octant_(solid_geometry).

To get the list of sign of an octant, instead of its number, you can use the method getBaseVector.

Gets a point furthermore far away from the centre

If you've a point P and wants to get another point, with the warranties it will go furthermore from the center and never reach another octant (ie the point will belong to the same octant), you can use:

This code will output:

This technique has been tested with map builders, where you need to increase the content built indefinitely.

Helper classes

Math

Methods:

Constants:

Pitfalls

Don't compare floats using == or === operator

When comparing two float numbers, our library takes care to use |a - b| < Ɛ and provide a Math::equals method for that.

In your own code, this is something you also need to do. For example, you want to avoid this kind of scenario:

You can instead use if (Math::equals($point->phi, 0.0)) {}.

Trigonometry and floats create big error margins

A situation where you need to be very careful is when a lot of trigonometry operations are involved. There is one place in our library that especially happens: PointSpherical::distance multiplies several times cosines and sinus by r.r'. The more far away your points is, the more you multiply roundings inserted both by float numbers and cos/sin functions.

An example of such code:

This distance has a 10^-5 error margin.

If you need to compute distances, you'll get the better accuracy using Point3D. The PointPolarZ distance method is also fairly precise.


All versions of geo with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hypership/geo contains the following files

Loading the files please wait ....