uvw_lengths

compas.numerical.uvw_lengths(C, X)[source]

Calculates the lengths and co-ordinate differences.

Parameters
  • C (sparse) – Connectivity matrix (m x n).

  • X (array) – Co-ordinates of vertices/points (n x 3).

Returns

  • array – Vectors of co-ordinate differences in x, y and z (m x 3).

  • array – Lengths of members (m x 1).

Examples

>>> from compas.numerical import connectivity_matrix
>>> C = connectivity_matrix([[0, 1], [1, 2]], 'csr')
>>> X = array([[0, 0, 0], [1, 1, 0], [0, 0, 1]])
>>> uvw_lengths(C, X)
(array([[ 1.,  1.,  0.],
       [-1., -1.,  1.]]), array([[1.41421356],
       [1.73205081]]))