Model.hm_triplecos#

Model.hm_triplecos(start, end)#

Get the cosine angle of two vectors.

Parameters:
  • start (hwTriple) – Definition of start vector.

  • end (hwTriple) – Definition of end vector.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • cosine (double) - Cosine angle between start and end vectors

Example#

Calculate the cosine angle between vector with coordinates [ 0.5 , 0.6 , 0.0 ] and vector with coordinates [ 1.0 , 1.0 , 0.0 ]#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_triplecos(start=[0.5, 0.6, 0.0], end=[1.0, 1.0, 0.0])

print("cosine", result.cosine)