blob: 12c33179c25660fadbd9e07df6dbc50a74d00d63 (
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
|
/* Copyright 2015 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "common.h"
#include "math.h"
#include "math_util.h"
#include "vec3.h"
#include "util.h"
void vec3_scalar_mul(vec3_t v, float c)
{
v[X] *= c;
v[Y] *= c;
v[Z] *= c;
}
float vec3_dot(const vec3_t v, const vec3_t w)
{
return v[X] * w[X] + v[Y] * w[Y] + v[Z] * w[Z];
}
float vec3_norm_squared(const vec3_t v)
{
return vec3_dot(v, v);
}
float vec3_norm(const vec3_t v)
{
return sqrtf(vec3_norm_squared(v));
}
|