Model.hm_xformvectoratpointtolocal#
- Model.hm_xformvectoratpointtolocal(x, y, z, system, node)#
Returns the three local components of a globally defined vector.
This function can be used in conjunction with
Model.hm_xformvectoratpointtoglobal()to convert a vector from one coordinate system to another.- Parameters:
x (double) – The x value should be given relative to the global coordinate system.
y (double) – The y value should be given relative to the global coordinate system.
z (double) – The z value should be given relative to the global coordinate system.
system (Entity) –
The object describing the system entity.
If
systemis a rectangular system,x,yandzare returned. Ifsystemis a cylindrical system, r, t, and z must be used forx,yandz. Ifsystemis a spherical system, r, t, and p must be used forx,yandz.node (Entity) – The object describing the node entity.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:localComponents (numpy.ndarray)
Example#
Convert the vector ( 1,0,0 ) at base node with ID 10 defined in rectangular system with ID 5 to the cylindrical system with ID 8#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_xformvectoratpointtoglobal( x=1.0, y=0.0, z=0.0, system=ent.System(model, 5), node=ent.Node(model, 10) ) x_glob = result.globalComponents[0] y_glob = result.globalComponents[1] z_glob = result.globalComponents[2] _, result = model.hm_xformvectoratpointtolocal( x=x_glob, y=y_glob, z=z_glob, system=ent.System(model, 8), node=ent.Node(model, 10) ) print("localComponents",result.localComponents)