Monado OpenXR Runtime
Loading...
Searching...
No Matches
vec.h
Go to the documentation of this file.
1
// Copyright 2019, Philipp Zabel
2
// Copyright 2026, Beyley Cardellio
3
// SPDX-License-Identifier: BSL-1.0
4
/*!
5
* @file
6
* @brief Vector subtraction and normalization, specialized for P3P solving.
7
* @author Philipp Zabel <philipp.zabel@gmail.com>
8
* @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
9
* @ingroup xrt_iface
10
*/
11
12
#pragma once
13
14
#include <math.h>
15
16
17
static
inline
void
18
vec3_normalise(
double
*v)
19
{
20
double
rnorm = 1.0 / sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
21
v[0] *= rnorm;
22
v[1] *= rnorm;
23
v[2] *= rnorm;
24
}
25
26
static
inline
void
27
vec3_sub(
double
*ret,
const
double
*a,
const
double
*b)
28
{
29
ret[0] = a[0] - b[0];
30
ret[1] = a[1] - b[1];
31
ret[2] = a[2] - b[2];
32
}
tracking
constellation
lambdatwist
vec.h
Generated by
1.9.8