formZ SDK | 5.0 API Reference | System | Math

fz_math_2d_isect_line_segs

Description

Calculates the 2d intersection point of two 2d line segments (defined by their start and end points).
The int_kase result indicates how the line segments intersect, if no error occurred. If an error occurred, int_kase is always set to 0x00000000.
The results in int_kase are bit encoded as follows :

bit 0 == 0 lines don't intersect, only their extensions do. Or an error occurred.
bit 0 == 1 a true intersection occurred (intersection point is on either line. i.e. segment check)

Details about the intersection :

0x00000002 int_pt is on line1_start
0x00000004 int_pt is on line1_end
0x00000008 int_pt is between line1_start and line1_end
0x00000010 int_pt is on line2_start
0x00000020 int_pt is on line2_end
0x00000040 int_pt is between line2_start and line2_end

Plugin Prototype

fzrt_error_td fz_math_2d_isect_line_segs(

fz_xy_td *

line1_start,

fz_xy_td *

line1_end,

fz_xy_td *

line2_start,

fz_xy_td *

line2_end,

fz_xy_td *

int_pt,

fzrt_int *

int_kase )

Parameters

line1_start [Input]

start point of 2d line segment 1

line1_end [Input]

end point of 2d line segment 1

line2_start [Input]

start point of 2d line segment 2

line2_end [Input]

end point of 2d line segment 2

int_pt [Result]

2d intersection point of the line segments

int_kase [Result, Optional]

how the line segments interact

Returns

Error codes

Availability

5.0.0.0

Example Files

util_math_2d.fsl

See Also

,, fz_math_3d_isect_lines

Function Set

fz_math_fset


Defined in

fz_math_api.h