formZ SDK | 5.0 API Reference | System | Math

# fz_math_2d_project_pt_on_line_seg

Description

Given a 2d line segment(defined by it's start and end points), finds the 2d point on the line segment that is perpendicular to a given 2d point.
Optionally, returned can be :
dist : the distance (dist_squared == FALSE) or squared distance (dist_squared == TRUE) of the original point from the line segment
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_2d_project_pt_on_line_seg(

fz_xy_td * | line_start,
fz_xy_td * | line_end,
fz_xy_td * | pt,
fzrt_boolean | dist_squared,
fz_xy_td * | line_pt,
double * | dist,
fzrt_int * | kase )

Parameters

line_start [Input]

start point of 2d line segment

line_end [Input]

end point of 2d line segment

pt [Input]

original 2d point

dist_squared [Input]

whether or not the returned distance should be squared

line_pt [Result, Optional]

2d point perpendicular to the original point

dist [Result, Optional]

distance of the original point from the line segment
(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_2d.fsl

See Also

Function Set

fz_math_fset

Defined in

fz_math_api.h