vector_component_xy
- compas.geometry.vector_component_xy(u, v)[source]
Compute the component of u in the direction of v, assuming they lie in the XY-plane.
- Parameters
u ([float, float] or [float, float, float] |
compas.geometry.Vector
) – XYZ components of the vector.v ([float, float] or [float, float, float] |
compas.geometry.Vector
) – XYZ components of the direction.
- Returns
[float, float, 0.0] – The component of u in the XY plane, in the direction of v.
Notes
This is similar to computing direction cosines, or to the projection of a vector onto another vector. See the respective Wikipedia pages (1, 2) for more info.
References
- 1
Direction cosine. Available at https://en.wikipedia.org/wiki/Direction_cosine.
- 2
Vector projection. Available at https://en.wikipedia.org/wiki/Vector_projection.
Examples
>>> vector_component_xy([1, 2, 0], [1, 0, 0]) [1.0, 0.0, 0.0]