aboutsummaryrefslogtreecommitdiff
path: root/doc/Manual/en/BH_Line.pod
blob: f8c793806baeeafce57d740c9948fe7251aaec43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
=encoding UTF-8


=head1 NAME

BH_Line - a straight line on a plane.


=head1 SYNTAX

 #include <BH/Math.h>

 cc prog.c -o prog -lbh


=head1 DESCRIPTION

The BH_Line module provides functions for working with straight lines on a 
plane. It allows you to calculate the coefficients of a line based on two 
points, find the distance from a point to a line, and determine the closest 
point on the line to a given point.


=head1 API CALLS


=head2 BH_LineFromPoints

 int BH_LineFromPoints(const float a[2],
                       const float b[2],
                       float out[3]);

Calculates the coefficients of a line on a plane based on two points I<a> and 
I<b>.

The I<out> parameter describes the resulting line on the plane.

If successful, the function returns 0, otherwise it returns an error code.


=head2 BH_LineDistance

 float BH_LineDistance(const float line[3],
                       const float point[2]);

Calculates the distance from the point I<point> to the line I<line>.


=head2 BH_LineClosestPoint

 void BH_LineClosestPoint(const float line[3],
                          const float point[2],
                          float out[2]);

Calculates the closest point on the line I<line> to another point I<point>.

The I<out> parameter describes the resulting point.


=head1 SEE ALSO

L<BH>