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 (sequence of float) – XYZ components of the vector.
v (sequence of float) – XYZ components of the direction.
- Returns
proj_v(u) (list) – The component of u 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]