Gimp.Vector3¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
x |
r/w |
the x axis |
|
y |
r/w |
the y axis |
|
z |
r/w |
the z axis |
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gimp.Vector3¶
A three dimensional vector.
- classmethod add(vector1, vector2)¶
- Parameters:
vector1 (
Gimp.Vector3
) – a pointer to the firstGimp.Vector3
.vector2 (
Gimp.Vector3
) – a pointer to the secondGimp.Vector3
.
- Returns:
destination for the resulting
Gimp.Vector3
.- Return type:
result:
Gimp.Vector3
Computes the sum of two 3D vectors. The resulting
Gimp.Vector3
is stored in result.
- classmethod new(x, y, z)¶
- Parameters:
- Returns:
the resulting
Gimp.Vector3
.- Return type:
Creates a
Gimp.Vector3
of coordinate x, y and z.
- classmethod sub(vector1, vector2)¶
- Parameters:
vector1 (
Gimp.Vector3
) – a pointer to the firstGimp.Vector3
.vector2 (
Gimp.Vector3
) – a pointer to the secondGimp.Vector3
.
- Returns:
the destination for the resulting
Gimp.Vector3
.- Return type:
result:
Gimp.Vector3
Computes the difference of two 3D vectors (vector1 minus vector2). The resulting
Gimp.Vector3
is stored in result.
- add_val(vector2)¶
- Parameters:
vector2 (
Gimp.Vector3
) – aGimp.Vector3
.- Returns:
the resulting
Gimp.Vector3
.- Return type:
This function is identical to
Gimp.Vector3.add
() but the vectors are passed by value rather than by reference.
- cross_product(vector2)¶
- Parameters:
vector2 (
Gimp.Vector3
) – a pointer to the secondGimp.Vector3
.- Returns:
The cross product.
- Return type:
Compute the cross product of two vectors. The result is a
Gimp.Vector3
which is orthogonal to both self and vector2. If self and vector2 and parallel, the result will be the nul vector.This function can be used to compute the normal of the plane defined by self and vector2.
- cross_product_val(vector2)¶
- Parameters:
vector2 (
Gimp.Vector3
) – the secondGimp.Vector3
.- Returns:
The cross product.
- Return type:
Identical to [method`Vector3`.cross_product], but the vectors are passed by value rather than by reference.
- inner_product(vector2)¶
- Parameters:
vector2 (
Gimp.Vector3
) – a pointer to the secondGimp.Vector3
.- Returns:
The inner product.
- Return type:
Computes the inner (dot) product of two 3D vectors. This product is zero if and only if the two vectors are orthogonal.
- inner_product_val(vector2)¶
- Parameters:
vector2 (
Gimp.Vector3
) – the secondGimp.Vector3
.- Returns:
The inner product.
- Return type:
Identical to [method`Vector3`.inner_product], but the vectors are passed by value rather than by reference.
- length()¶
-
Computes the length of a 3D vector.
- length_val()¶
-
Identical to [method`Vector3`.length], but the vector is passed by value rather than by reference.
- mul(factor)¶
- Parameters:
factor (
float
) – a scalar.
Multiplies each component of the self by factor. Note that this is equivalent to multiplying the vectors length by factor.
- mul_val(factor)¶
- Parameters:
factor (
float
) – a scalar.- Returns:
the resulting
Gimp.Vector3
.- Return type:
Identical to [method`Vector3`.mul], but the vector is passed by value rather than by reference.
- neg()¶
Negates the self (i.e. negate all its coordinates).
- neg_val()¶
- Returns:
the negated
Gimp.Vector3
.- Return type:
Identical to [method`Vector3`.neg], but the vector is passed by value rather than by reference.
- normalize()¶
Normalizes the self so the length of the self is 1.0. The nul vector will not be changed.
- normalize_val()¶
- Returns:
a
Gimp.Vector3
parallel to self, pointing in the same direction but with a length of 1.0.- Return type:
Identical to [method`Vector3`.normalize], but the vector is passed by value rather than by reference.
- rotate(alpha, beta, gamma)¶
- Parameters:
Rotates the self around the three axis (Z, Y, and X) by alpha, beta and gamma, respectively.
Note that the order of the rotation is very important. If you expect a vector to be rotated around X, and then around Y, you will have to call this function twice. Also, it is often wise to call this function with only one of alpha, beta and gamma non-zero.
- rotate_val(alpha, beta, gamma)¶
- Parameters:
- Returns:
the rotated vector.
- Return type:
Identical to [method`Vector3`.rotate], but the vectors are passed by value rather than by reference.
- set(x, y, z)¶
- Parameters:
Sets the X, Y and Z coordinates of self to x, y and z.
- sub_val(vector2)¶
- Parameters:
vector2 (
Gimp.Vector3
) – aGimp.Vector3
.- Returns:
the resulting
Gimp.Vector3
.- Return type:
This function is identical to
Gimp.Vector3.sub
() but the vectors are passed by value rather than by reference.