Views and conversions
2 components
as_vec2
View other as a vec2 with given dtype.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
np.ndarray
|
Array to consider |
required |
dtype |
n.dtype
|
Dtype of results (force) |
None
|
Returns:
Type | Description |
---|---|
vec2
|
view or copy of other. |
Source code in glm/vec234.py
to_vec2
Convert other to a vec2 with following convention:
- v -> vec2 : v[::2] -> v[i],v[i+1]
- vec2 -> vec2 : x,y -> x,y
- vec3 -> vec2 : x,y,z -> x,y
- vec4 -> vec2 : x,y,z,w -> x/w,y/w
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
np.ndarray
|
Array to consider |
required |
dtype |
n.dtype
|
Dtype of results (force) |
None
|
Returns:
Type | Description |
---|---|
vec2
|
copy of other. |
Source code in glm/vec234.py
3 components
as_vec3
View other as a vec3 with given dtype
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
np.array)
|
Array to consider |
required |
dtype |
np.dtype
|
Dtype of the results |
None
|
Returns:
Type | Description |
---|---|
vec3
|
view or copy of other. |
Source code in glm/vec234.py
to_vec3
Convert other to a vec3 with followign convention:
- v -> vec3 : v[::3] -> v[i],v[i+1],v[i+2]
- vec2 -> vec3 : x,y -> x,y,0
- vec3 -> vec3 : x,y,z -> x,y,z
- vec4 -> vec3 : x,y,z,w -> x/w,y/w,z/w
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
np.ndarray
|
Array to consider |
required |
dtype |
np.dtype
|
Dtype of the results |
None
|
Returns:
Type | Description |
---|---|
vec3
|
copy of other. |
Source code in glm/vec234.py
4 components
as_vec4
View other as a vec4 with given dtype
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
np.ndarray
|
Array to consider |
required |
dtype |
np.dtype
|
Dtype of the results (force) |
None
|
Returns:
Type | Description |
---|---|
vec4
|
view or copy of other. |
Source code in glm/vec234.py
to_vec4
Convert other to a vec4 with following convention
- v -> vec4 : v[::4] -> v[i],v[i+1],v[i+2],v[i+3]
- vec2 -> vec4 : x,y -> x,y,0,1
- vec3 -> vec4 : x,y,z -> x,y,z,1
- vec4 -> vec4 : x,y,z,w -> x,y,z,w
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
np.ndarray
|
Array to consider |
required |
dtype |
np.dtype
|
Dtype of the results (force) |
None
|
Returns:
Type | Description |
---|---|
vec4
|
copy of other |