Tachyon (current)
Current Main Branch
src
macros.h
Go to the documentation of this file.
1
/*
2
* macros.h - This file contains macro versions of functions that would be best
3
* used as inlined code rather than function calls.
4
*
5
* (C) Copyright 1994-2022 John E. Stone
6
* SPDX-License-Identifier: BSD-3-Clause
7
*
8
* $Id: macros.h,v 1.7 2022/02/18 17:55:28 johns Exp $
9
*
10
*/
11
12
#define MYMAX(a , b) ((a) > (b) ? (a) : (b))
13
#define MYMIN(a , b) ((a) < (b) ? (a) : (b))
14
15
#define VDOT(return, a, b) \
16
return=(a.x * b.x + a.y * b.y + a.z * b.z); \
17
18
#define RAYPNT(c, a, b) \
19
c.x = a.o.x + ( a.d.x * b ); \
20
c.y = a.o.y + ( a.d.y * b ); \
21
c.z = a.o.z + ( a.d.z * b ); \
22
23
24
#define VSUB(a, b, c) \
25
c.x = (a.x - b.x); \
26
c.y = (a.y - b.y); \
27
c.z = (a.z - b.z); \
28
29
30
#define VCROSS(a, b, c) \
31
c->x = (a->y * b->z) - (a->z * b->y); \
32
c->y = (a->z * b->x) - (a->x * b->z); \
33
c->z = (a->x * b->y) - (a->y * b->x); \
34
Generated by
1.8.14