Skip to content
basic R3 vector
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vectorpy
.gitignore
README.md
setup.py
vectorpy_test.py

README.md

VectorPy

A simple R3 vector (also known as a reimplimentation of the vector class from vpython which can be used without the nessesity to spin up wx or a webserver)

Installation

vectorpy can be installed directly from the cloned source of this repository, or from pypi.

git clone https://github.com/tboudreaux/vectorpy.git
cd vectorpy
python setup.py install

or

pip install vectorpy

Example

Here is a simple example

    from vectorpy import vector

    vector_one = vector(2.3, 0, -5.6)
    vector_two = vector()   # intialize the vector <0, 0, 0>

    vector_three = vector_one + vector_two  # vector addition

    vector_four = vector_one * vector_two # Dot Product

    vector_five = vector_one.cross(vector_two) # v1 x v2 (cross product)

    vector_six = vector_one * 5 # Scaler multiplication

    vector_list = vector_one.aslist()   # cast vector to python list

    length_of_V1 = abs(vector_one)  # Magnitude of vector
    
    print('Vector three is: {}, vector four is: {}'.format(vector_three, vector_four))

There we go.

You can’t perform that action at this time.