pytilities.geometry.vector.Vector

Package pytilities :: Package geometry :: Module vector :: Class Vector |
[hide private]
[frames] | no frames]

# Class Vector

source code

    object --+
             |
            Vector

Known Subclasses:
  - boundvector.BoundVector

    2D Point/Vector

    Class fields:

        - `INFINITY`: immutable Vector of positive infinity
        - `NULL`: immutable Vector (0, 0)

    Instance methods:

        - `move_to`: Set x, y position
        - `move_by`: Move vector by x, y
        - `assign`: Assign values of other vector to this one
        - `copy`: Shallow copy
        - `normalize`: Normalize vector
        - `normalized`: Get a normalized copy of this vector
        - `dot`: Dot product
        - `cross`:
        - `reflect`:

    Instance properties:

        - `x`: Read-write, x position
        - `y`: Read-write, y position
        - `length`: Read-write, length of vector
        - `length_squared`: Read-only, length squared

    Operators:

        str(s)
        s == v
        s != v
        s + v
        s += v
        s - v
        s -= v
        s * n
        s *= n
        s / n
        s /= n
        -s
            self explanatory

        len(s)
            returns 2

        iter(s)
            iterates over its x and y value

        abs(s)
            returns length of vector

Instance Methods | [hide private]
Delegator(profile_name=`'``default``'`, target=None) Construct a delegator with a stored Profile. | source code
__abs__(self) | source code
__add__(self, other) other :: Vector | source code
__copy__(self) | source code
__div__(self, other) other :: number | source code
__eq__(self, other) other :: Vector | source code
__floordiv__(self, other) other :: number | source code
__getattr__(self, name) | source code
__getitem__(self, key) | source code
__iadd__(self, other) other :: Vector | source code
__imul__(self, other) other :: number | source code
__init__(*args, **kwargs) Constructs a 2D Vector | source code
__init_storage(self, storage) | source code
__init_xy(self, x, y) | source code
__iter__(self) Iterates over its x and y value | source code
__len__(self) | source code
__mul__(self, other) other :: number | source code
__neg__(self) | source code
__neq__(self, other) other :: Vector | source code
__pos__(self) | source code
__rdiv__(self, other) other :: number | source code
__rfloordiv__(self, other) other :: number | source code
__rmul__(self, other) other :: number | source code
__rtruediv__(self, other) other :: number | source code
__setitem__(self, key, value) | source code
__str__(self) str(x) | source code
__sub__(self, other) | source code
__truediv__(self, other) other :: number | source code
assign(self, v) Assigns the values of another vector to this vector | source code
copy(self) Returns shallow copy :: Vector | source code
cross(self) | source code
dot(self, other) Get the dot product of this vector with `other` | source code
move_by(self, x, y) Move vector by (x, y) | source code
move_to(self, x, y) Set x, y coords | source code
normalize(self) Normalize vector | source code
normalized(self) Get a normalized copy of this vector | source code
reflect(self, normal) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Static Methods | [hide private]
__init_delegation_profiles(profiles) | source code

Class Variables | [hide private]
| INFINITY = `ImmutableVector(Vector(float("inf"), float("inf")))`
| NULL = `ImmutableVector(Vector(0, 0))`
| _delegator_factory = `<pytilities.delegation.delegatorfactory.D`...``

Properties | [hide private]
| length Read-write, length of vector
| length_squared Read-only, length squared :: float | int
| x Read-write, x position ::float | int
| y Read-write, y position ::float | int
Inherited from `object`: `__class__`

Method Details | [hide private]

### Delegator(profile_name=`'``default``'`, target=None) | source code
Construct a delegator with a stored Profile. Parameters: `profile_name` :: string name of the Profile to use to set up the delegator with `target` = None target of the newly created delegator Returns newly created delegator :: Delegator Raises: `ValueError` when no profile with name `profile_name` exists

### __abs__(self) | source code
Decorators: `@delegated("immutable")`

### __add__(self, other) (Addition operator) | source code
other :: Vector Decorators: `@delegated("immutable")`

### __copy__(self) | source code
Decorators: `@delegated("immutable")`

### __div__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __eq__(self, other) (Equality operator) | source code
other :: Vector Decorators: `@delegated("immutable")`

### __floordiv__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __getattr__(self, name) (Qualification operator) | source code
Decorators: `@delegated("immutable")`

### __getitem__(self, key) (Indexing operator) | source code
Decorators: `@delegated("immutable")`

### __iadd__(self, other) | source code
other :: Vector Decorators: `@delegated()`

### __imul__(self, other) | source code
other :: number Decorators: `@delegated()`

### __init__(*args, **kwargs) (Constructor) | source code
Constructs a 2D Vector Overloaded, parameters: Decorators: `@overloaded((Overload(__init_xy, Param("x", NumberType, default= 0), Param("y", NumberType, default= 0)), Overload(__init_storage, Param("storage"))))` Overrides: object.__init__

### __iter__(self) | source code
Iterates over its x and y value Decorators: `@delegated("immutable")`

### __len__(self) (Length operator) | source code
Decorators: `@delegated("immutable")`

### __mul__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __neg__(self) | source code
Decorators: `@delegated("immutable")`

### __neq__(self, other) | source code
other :: Vector Decorators: `@delegated("immutable")`

### __pos__(self) | source code
Decorators: `@delegated("immutable")`

### __rdiv__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __rfloordiv__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __rmul__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __rtruediv__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### __setitem__(self, key, value) (Index assignment operator) | source code
Decorators: `@delegated()`

### __str__(self) (Informal representation operator) | source code
str(x) Decorators: `@delegated("immutable")` Overrides: object.__str__ (inherited documentation)

### __sub__(self, other) (Subtraction operator) | source code
Decorators: `@delegated("immutable")`

### __truediv__(self, other) | source code
other :: number Decorators: `@delegated("immutable")`

### assign(self, v) | source code
Assigns the values of another vector to this vector v :: Vector -- the other vector Decorators: `@delegated()`

### copy(self) | source code
Returns shallow copy :: Vector Decorators: `@delegated("immutable")`

### cross(self) | source code
Decorators: `@delegated("immutable")`

### dot(self, other) | source code
Get the dot product of this vector with `other` Parameters: `other` :: Vector the other vector Returns :: float | int Decorators: `@delegated("immutable")`

### move_by(self, x, y) | source code
Move vector by (x, y) Parameters: x :: float | int x position y :: float | int y position Decorators: `@delegated()`

### move_to(self, x, y) | source code
Set x, y coords Parameters: x :: float | int x position y :: float | int y position Decorators: `@delegated()`

### normalize(self) | source code
Normalize vector Returns :: Vector Decorators: `@delegated()`

### normalized(self) | source code
Get a normalized copy of this vector Returns :: Vector Decorators: `@delegated("immutable")`

### reflect(self, normal) | source code
Decorators: `@delegated("immutable")`

Class Variable Details | [hide private]

  ### _delegator_factory Value:
      <pytilities.delegation.delegatorfactory.DelegatorFactory object at 0x1
      9fc910>

Property Details | [hide private]

### length Read-write, length of vector Returns :: float | int Set parameters: value :: number new length Get Method: unreachable.length(self) - Read-write, length of vector Set Method: unreachable.length(self, value)

### length_squared Read-only, length squared :: float | int Get Method: unreachable.length_squared(self) - Read-only, length squared :: float | int

### x Read-write, x position ::float | int Get Method: unreachable.x(self) - Read-write, x position ::float | int Set Method: unreachable.x(self, value)

### y Read-write, y position ::float | int Get Method: unreachable.y(self) - Read-write, y position ::float | int Set Method: unreachable.y(self, value)