aboutsummaryrefslogtreecommitdiff
path: root/doc/Manual/en/BH_Vec2f.pod
blob: f2ec3140322da21a7996fb61cfcb7e62b8668c26 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
=encoding UTF-8


=head1 NAME

BH_Vec2f - two-dimensional real vector


=head1 SYNTAX

 #include <BH/Math/Vec2f.h>

 cc prog.c -o prog -lbh


=head1 DESCRIPTION

The BH_Vec2f module provides a set of functions for working with two-dimensional
vectors. It includes operations for addition, subtraction, multiplication,
scaling, calculating the dot and cross product, as well as normalizing vectors.


=head1 API CALLS


=head2 BH_Vec2fAdd

 void BH_Vec2fAdd(const float a[2],
                  const float b[2],
                  float out[2]);

Calculates the sum of two vectors I<a> and I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fSub

 void BH_Vec2fSub(const float a[2],
                  const float b[2],
                  float out[2]);

Calculates the difference between two vectors I<a> and I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fMul

 void BH_Vec2fMul(const float a[2],
                  const float b[2],
                  float out[2]);

Calculates the result of multiplying two vectors I<a> and I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fScale

 void BH_Vec2fScale(const float a[2],
                    float b,
                    float out[2]);

Calculates the result of multiplying vector I<a> by value I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fMulAdd

 void BH_Vec2fMulAdd(const float a[2],
                     const float b[2],
                     const float c[2],
                     float out[2]);

Calculates the result of the sum I<c> and the product of vectors I<a> and I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fNegate

 void BH_Vec2fNegate(const float in[2],
                     float out[2]);

Calculates the opposite vector from vector I<in>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fDot

 float BH_Vec2fDot(const float a[2],
                   const float b[2]);

Calculates the dot product of vectors I<a> and I<b>.


=head2 BH_Vec2fCross

 float BH_Vec2fCross(const float a[2],
                     const float b[2]);

Calculates the cross product of vectors I<a> and I<b>.


=head2 BH_Vec2fLength

 float BH_Vec2fLength(const float in[2]);

Calculates the length of vector I<in>.


=head2 BH_Vec2fNormal

 void BH_Vec2fNormal(const float in[2],
                     float out[2]);

Calculates the normalized form of vector I<in>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fNormalEx

 float BH_Vec2fNormalEx(const float in[2],
                        float out[2]);

Calculates the normalized form of vector I<in> and returns its original length.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fMin

 void BH_Vec2fMin(const float a[2],
                  const float b[2],
                  float out[2]);

Calculates the element-wise minimum of two vectors I<a> and I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fMax

 void BH_Vec2fMax(const float a[2],
                  const float b[2],
                  float out[2]);

Calculates the element-wise maximum of two vectors I<a> and I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fLerp

 void BH_Vec2fLerp(const float a[2],
                   const float b[2],
                   float t,
                   float out[2]);

Performs linear interpolation between two vectors I<a> and I<b> with parameter
I<t>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fProject

 void BH_Vec2fProject(const float a[2],
                      const float b[2],
                      float out[2]);

Calculates the result of projecting vector I<a> onto vector I<b>.

The I<out> parameter describes the resulting vector.


=head2 BH_Vec2fBarycentric

 void BH_Vec2fBarycentric(const float a[2],
                          const float b[2],
                          const float c[2],
                          float v,
                          float w,
                          float out[2]);

Calculates the vector from the barycentric coordinates I<v>, I<w> and vectors of
points I<a>, I<b>, I<c>.

The calculation is performed using the formula A + v*(B-A) + w*(C-A).

The I<out> parameter describes the resulting vector.


=head1 SEE ALSO

L<BH>