formZ SDK | 5.0 API Reference | System | Math

fz_math_3d_project_pt_on_line

Description

Given a 3d line segment (defined by it's start and end points), finds the 3d point on the line segment that is perpendicular to a given 3d point.
Optionally, returned can be :
line_pt : the actual perpendicular point
dist : the distance (dist_squared == FALSE) or squared distance (dist_squared == TRUE) of the original point from the line
kase : bit encoded, where the point lies with respect to the two line points
0x00000000 line_pt in not between line_start and line_end
0x00000001 line_pt is on line_start
0x00000002 line_pt is on line_end
0x00000004 line_pt is between line_start and line_end

Plugin Prototype

fzrt_error_td fz_math_3d_project_pt_on_line(

fz_xyz_td *

line_start,

fz_xyz_td *

line_end,

fz_xyz_td *

pt,

fzrt_boolean

dist_squared,

fz_xyz_td *

line_pt,

double *

dist,

fzrt_int *

kase )

Parameters

line_start [Input]

start point of 3d line segment

line_end [Input]

end point of 3d line segment

pt [Input]

original 3d point

dist_squared [Input]

Is the returned distance squared

line_pt [Result, Optional]

3d point perpendicular to the original point

dist [Result, Optional]

distance of the original point to the line
(squared distance if dist_squared is TRUE)

kase [Result, Optional]

where the perpendicular point lies with respect to the two line points

Returns

Error codes

Availability

5.0.0.0

Example Files

util_math_3d.fsl

See Also

Function Set

fz_math_fset


Defined in

fz_math_api.h