Model.hm_diffencodings#
- Model.hm_diffencodings(encodings1, encodings2, encoding_algorithm=0, sphhar_bandwidth=16, sphhar_falloff=2.828427, sphhar_radii=32, sphhar_resolution=64)#
Calculates the distance between two encoded lists representing shapes of geometries. The geometries can be CAD, FE or a mixture. Typically this is the Euclidean distance normalized by the number of entries in the encoding. The encodings are generated by
Model.hm_encodeshape().- Parameters:
encodings1 (hwDoubleList) – The first list of encodings generated by
Model.hm_encodeshape().encodings2 (hwDoubleList) – The second list of encodings generated by
Model.hm_encodeshape().encoding_algorithm (int) –
The optional encoding algorithm to use. Valid values are:
0 - Spherical harmonics (default)
sphhar_bandwidth (int) – Optional, valid for
encoding_algorithm0. (default=16)sphhar_falloff (double) – Optional, valid for
encoding_algorithm0. (default=2.828427)sphhar_radii (int) – Optional, valid for
encoding_algorithm0. (default=32)sphhar_resolution (int) – Optional, valid for
encoding_algorithm0. (default=64)
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:distance (numpy.ndarray)
Example#
Calculate and diff the encodings from all surfaces against all elements#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_encodeshape(entity_collection=hm.Collection(model, ent.Surface)) x = result.encoding _, result = model.hm_encodeshape(entity_collection=hm.Collection(model, ent.Element)) y = result.encoding _, result = model.hm_diffencodings(encodings1=x, encodings2=y) print("distance", result.distance)