ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/g3vector.h
Revision: 2.2
Committed: Tue Aug 18 15:02:53 2015 UTC (8 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, rad5R0, rad5R1, HEAD
Changes since 2.1: +1 -0 lines
Log Message:
Added RCCS id's to new source files (forgotten during initial check-in)

File Contents

# User Rev Content
1 greg 2.2 /* RCSid $Id$ */
2 greg 2.1 /*
3     ** Author: Christian Reetz ([email protected])
4     */
5     #ifndef __G3VECTOR_H
6     #define __G3VECTOR_H
7    
8     #ifdef __cplusplus
9     extern "C" {
10     #endif
11    
12    
13     #include <stdio.h>
14    
15     #include "gbasic.h"
16     #include "fvect.h"
17    
18     typedef g3Float* g3Vec;
19    
20     #define g3v_angle(v1,v2) (acos(g3v_dot((v1),(v2))))
21    
22    
23     g3Vec g3v_create();
24     void g3v_free(g3Vec v);
25     g3Vec g3v_copy(g3Vec dest,g3Vec src);
26     g3Vec g3v_zero(g3Vec v);
27    
28     g3Vec g3v_set(g3Vec v,g3Float x,g3Float y,g3Float z);
29     g3Vec g3v_sane(g3Vec v);
30    
31     g3Vec g3v_fromrad(g3Vec v,FVECT rv);
32     void g3v_torad(FVECT rv,g3Vec v);
33    
34     /*
35     ** Orderering is done component wise, with decreasing significance
36     ** Returns -1, 0 or 1 if v1 is less, equal or greater than v2
37     */
38     int g3v_epsorder(g3Vec v1,g3Vec v2);
39    
40     /*
41     ** Returns true if v1 and v2 are epsilon equal
42     */
43     int g3v_epseq(g3Vec v1,g3Vec v2);
44    
45     int g3v_epszero(g3Vec v);
46    
47     /* Euclidean length of vector */
48     g3Float g3v_length(g3Vec v);
49    
50     /*
51     ** Common operations on vectors. All routines returns zero on errors or
52     ** the result as a g3Float
53     */
54     g3Float g3v_dot(g3Vec v1,g3Vec v2);
55     g3Vec g3v_scale(g3Vec res,g3Vec v,g3Float sc);
56     g3Vec g3v_normalize(g3Vec v);
57     g3Vec g3v_cross(g3Vec res,g3Vec v1,g3Vec v2);
58     g3Vec g3v_sub(g3Vec res,g3Vec v1,g3Vec v2);
59     g3Vec g3v_add(g3Vec res,g3Vec v1,g3Vec v2);
60    
61     g3Vec g3v_rotate(g3Vec res,g3Vec v,g3Vec rnorm,g3Float ang);
62    
63     g3Vec g3v_print(g3Vec v,FILE* fp);
64     int g3v_read(g3Vec v,FILE* fp);
65    
66     #ifdef __cplusplus
67     }
68     #endif
69    
70     #endif