### Struct

# Gimp Vector2

#### Description [src]

    struct GimpVector2 {
      gdouble x;
      gdouble y;
    }

A two dimensional vector.

###### Structure members

`x` | The x axis.
`y` | The y axis.

#### Constructors

###### gimp_vector2_new

Creates a `GimpVector2` of coordinates `x` and `y`.

#### Functions

###### gimp_vector2_add

Computes the sum of two 2D vectors. The resulting `GimpVector2` is stored in `result`.

###### gimp_vector2_sub

Computes the difference of two 2D vectors (`vector1` minus `vector2`). The resulting `GimpVector2` is stored in `result`.

#### Instance methods

###### gimp_vector2_add_val

This function is identical to `gimp_vector2_add()` but the vectors are passed by value rather than by reference.

###### gimp_vector2_cross_product

Compute the cross product of two vectors. The result is a `GimpVector2` which is orthogonal to both `vector1` and `vector2`. If `vector1` and `vector2` are parallel, the result will be the nul vector.

###### gimp_vector2_cross_product_val

Identical to `gimp_vector2_cross_product()`, but the vectors are passed by value rather than by reference.

###### gimp_vector2_inner_product

Computes the inner (dot) product of two 2D vectors. This product is zero if and only if the two vectors are orthogonal.

###### gimp_vector2_inner_product_val

Identical to `gimp_vector2_inner_product()`, but the vectors are passed by value rather than by reference.

###### gimp_vector2_length

Computes the length of a 2D vector.

###### gimp_vector2_length_val

Identical to `gimp_vector2_length()`, but the vector is passed by value rather than by reference.

###### gimp_vector2_mul

Multiplies each component of the `vector` by `factor`. Note that this is equivalent to multiplying the vectors length by `factor`.

###### gimp_vector2_mul_val

Identical to `gimp_vector2_mul()`, but the vector is passed by value rather than by reference.

###### gimp_vector2_neg

Negates the `vector` (i.e. negate all its coordinates).

###### gimp_vector2_neg_val

Identical to `gimp_vector2_neg()`, but the vector is passed by value rather than by reference.

###### gimp_vector2_normal

Compute a normalized perpendicular vector to `vector`.

Available since: 2.8

###### gimp_vector2_normal_val

Identical to `gimp_vector2_normal()`, but the vector is passed by value rather than by reference.

Available since: 2.8

###### gimp_vector2_normalize

Normalizes the `vector` so the length of the `vector` is 1.0. The nul vector will not be changed.

###### gimp_vector2_normalize_val

Identical to `gimp_vector2_normalize()`, but the vector is passed by value rather than by reference.

###### gimp_vector2_rotate

Rotates the `vector` counterclockwise by `alpha` radians.

###### gimp_vector2_rotate_val

Identical to `gimp_vector2_rotate()`, but the vector is passed by value rather than by reference.

###### gimp_vector2_set

Sets the X and Y coordinates of `vector` to `x` and `y`.

###### gimp_vector2_sub_val

This function is identical to `gimp_vector2_sub()` but the vectors are passed by value rather than by reference.