Download the PHP package nubs/vectorix without Composer

On this page you can find all versions of the php package nubs/vectorix. 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 vectorix

vectorix

A PHP vector library.

Build Status Scrutinizer Code Quality Code Coverage

Latest Stable Version Total Downloads License

Dependency Status

Requirements

This library requires PHP 5.6, or newer.

Installation

This package uses composer so you can just add nubs/vectorix as a dependency to your composer.json file or execute the following command:

Vector

The Vector class represents an immutable Euclidean vector and its associated operations.

All operations on the vector will return a new vector with the results. For example,

The keys of a vector's components are preserved through operations. Because of this, vectors MUST have the same keys in order to use them together. For example,

Creating a Vector

Constructor

The primary method for creating a vector is, of course, the constructor. It takes an array of the components of the vector (e.g., x, y, and z components). Components can be integers, floats, or a combination thereof.

Null Vectors

When needing a null vector (a vector with zero magnitude), this static method makes creating one easy. All of its components will be initialized to the integer 0.

Properties of a Vector

Components

The components method returns the components of the vector with keys kept intact.

Dimension

The dimension of a vector is the number of components in it. This is also referred to as "cardinality".

Length

The length, or magnitude of a vector is the distance from the origin to the point described by the vector.

It is always returned as a floating point number.

Tests

Equality

The isEqual method tests to see if the two vectors are equal. They are only equal if their components are identical (including same keys).

Same Dimension

The isSameDimension method tests to see if the two vectors both have the same dimension.

Same Vector Space

The isSameVectorSpace method tests to see if the two vectors both belong to the same vector space.

The vector space is defined in this library by the dimension of the vectors, and the keys of the vectors' components.

Basic Operations

Addition

The add method performs vector addition. The two vectors must belong to the same vector space.

The result is a new vector where each component is the sum of the corresponding components in the two vectors.

Subtraction

The subtract method performs vector subtraction. The two vectors must belong to the same vector space.

The result is a new vector where each component is the difference of the corresponding components in the two vectors

Scalar Multiplication

The multiplyByScalar function performs scalar multiplication of a vector with a scalar value.

The result is a new vector where each component is the multiplication of that component with the scalar value.

Scalar Division

The divideByScalar function performs scalar division of a vector with a scalar value. This is the same as multiplying the vector by 1 / scalarValue.

Trying to divide by zero will throw an exception.

The result is a new vector where each component is the division of that component with the scalar value.

Dot Product

The dotProduct method performs a dot product between two vectors. The two vectors must belong to the same vector space.

Cross Product

The crossProduct method computes the cross product between two three-dimensional vectors. The resulting vector is perpendicular to the plane containing the two vectors.

Other Operations

Normalization

The normalize method returns the unit vector with the same direction as the original vector.

Projection

The projectOnto method computes the vector projection of one vector onto another. The resulting vector will be colinear with $b.

Scalar Triple Product

The scalarTripleProduct method computes the scalar triple product. This value represents the volume of the parallelepiped defined by the three vectors.

Vector Triple Product

The vectorTripleProduct method computes the vector triple product.

Angle Between Vectors

The angleBetween method computes the angle between two vectors in radians.

License

vectorix is licensed under the MIT license. See LICENSE for the full license text.


All versions of vectorix with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
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 nubs/vectorix contains the following files

Loading the files please wait ....