Model.hm_projectpointonsegment#
- Model.hm_projectpointonsegment(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2)#
Returns the closest point to a specific point on a finite segment.
- Parameters:
px (double) – The x coordinate of the point.
py (double) – The y coordinate of the point.
pz (double) – The z coordinate of the point.
sx1 (double) – The x coordinate of the segment start point.
sy1 (double) – The y coordinate of the segment start point.
sz1 (double) – The z coordinate of the segment start point.
sx2 (double) – The x coordinate of the segment end point.
sy2 (double) – The y coordinate of the segment end point.
sz2 (double) – The y coordinate of the segment end point.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:closestPoint (numpy.ndarray)
Example#
Find the closest point to the point ( 0.0,0.0,0.0 ) on the finite segment .#import hm import hm.entities as ent model = hm.Model() _, result = model.hm_projectpointonsegment( px=0.0, py=0.0, pz=0.0, sx1=-1.0, sy1=2.0, sz1=0.0, sx2=1.0, sy2=2.0, sz2=0.0 ) print("ClosestPoint: ",result.closestPoint) # In this case the output is [0.0 2.0 0.0]