Model.hm_projectpointtosegmentwithangle#

Model.hm_projectpointtosegmentwithangle(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2, angle)#

Finds the projection point to a specific point on a segment along a specific direction. The result is returned as the point on the straight line that runs from point (px, py, pz) in the calculated direction, and is the point closest to the straight line that runs through points (sx1, sy1, sz1) and (sx2, sy2, sz2).

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 z coordinate of the segment end point.

  • angle (double) – The angle, in degrees, that defines the direction vector in the x-y plane. The angle=0.0 corresponds to the x-direction and angle=90.0 corresponds to the y-direction.

Returns:

Example#

Find the projection of ( 0.0 , 0.0 , 0.0 ) to the segment defined by points ( 1.0 , -1.0 , 0.0 ) and ( 1.0 , 1.0 , 0.0 ) use an angle of 0 ( x - direction )#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_projectpointtosegmentwithangle(
    px=0.0,
    py=0.0,
    pz=0.0,
    sx1=1.0,
    sy1=-1.0,
    sz1=0.0,
    sx2=1.0,
    sy2=1.0,
    sz2=0.0,
    angle=0.0,
)

print("Point: ",result.point)