• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1((function atan
2   (signature float
3     (parameters
4       (declare (in) float y_over_x))
5     ((declare () float s)
6      (call asin (var_ref s)
7			  ((expression float *
8			   (var_ref y_over_x)
9			   (expression float rsq
10			    (expression float +
11			     (expression float *
12			      (var_ref y_over_x)
13			      (var_ref y_over_x))
14			     (constant float (1.0)))))))
15      (return (var_ref s))))
16
17   (signature vec2
18     (parameters
19       (declare (in) vec2 y_over_x))
20     ((declare () vec2 s)
21      (call asin (var_ref s)
22			  ((expression vec2 *
23			   (var_ref y_over_x)
24			   (expression vec2 rsq
25			    (expression vec2 +
26			     (expression vec2 *
27			      (var_ref y_over_x)
28			      (var_ref y_over_x))
29			     (constant float (1.0)))))))
30      (return (var_ref s))))
31
32   (signature vec3
33     (parameters
34       (declare (in) vec3 y_over_x))
35     ((declare () vec3 s)
36      (call asin (var_ref s)
37			  ((expression vec3 *
38			   (var_ref y_over_x)
39			   (expression vec3 rsq
40			    (expression vec3 +
41			     (expression vec3 *
42			      (var_ref y_over_x)
43			      (var_ref y_over_x))
44			     (constant float (1.0)))))))
45      (return (var_ref s))))
46
47   (signature vec4
48     (parameters
49       (declare (in) vec4 y_over_x))
50     ((declare () vec4 s)
51      (call asin (var_ref s)
52			  ((expression vec4 *
53			   (var_ref y_over_x)
54			   (expression vec4 rsq
55			    (expression vec4 +
56			     (expression vec4 *
57			      (var_ref y_over_x)
58			      (var_ref y_over_x))
59			     (constant float (1.0)))))))
60      (return (var_ref s))))
61
62  (signature float
63    (parameters
64      (declare (in ) float y)
65      (declare (in ) float x)
66    )
67    (
68      (declare () float r)
69      (if (expression bool >
70           (expression float abs (var_ref x))
71           (expression float * (constant float (1.0e-8)) (expression float abs (var_ref y)))) (
72        (call atan (var_ref r) ((expression float / (var_ref y) (var_ref x))))
73        (if (expression bool < (var_ref x) (constant float (0.000000)) ) (
74          (if (expression bool >= (var_ref y) (constant float (0.000000)) )
75              ((assign (x) (var_ref r) (expression float + (var_ref r) (constant float (3.141593)))))
76              ((assign (x) (var_ref r) (expression float - (var_ref r) (constant float (3.141593))))))
77        )
78        (
79        ))
80      )
81      (
82        (declare () float sgn)
83        (assign (x) (var_ref sgn) (expression float sign (var_ref y)))
84        (assign (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))
85      ))
86
87      (return (var_ref r) )
88    ))
89
90
91
92   (signature vec2
93     (parameters
94       (declare (in) vec2 y)
95       (declare (in) vec2 x))
96     ((declare () vec2 r)
97      (declare () float temp)
98      (call atan (var_ref temp) ((swiz x (var_ref y)) (swiz x (var_ref x))))
99      (assign (x) (var_ref r) (var_ref temp))
100      (call atan (var_ref temp) ((swiz y (var_ref y)) (swiz y (var_ref x))))
101      (assign (y) (var_ref r) (var_ref temp))
102      (return (var_ref r))))
103
104   (signature vec3
105     (parameters
106       (declare (in) vec3 y)
107       (declare (in) vec3 x))
108     ((declare () vec3 r)
109      (declare () float temp)
110      (call atan (var_ref temp) ((swiz x (var_ref y)) (swiz x (var_ref x))))
111      (assign (x) (var_ref r) (var_ref temp))
112      (call atan (var_ref temp) ((swiz y (var_ref y)) (swiz y (var_ref x))))
113      (assign (y) (var_ref r) (var_ref temp))
114      (call atan (var_ref temp) ((swiz z (var_ref y)) (swiz z (var_ref x))))
115      (assign (z) (var_ref r) (var_ref temp))
116      (return (var_ref r))))
117
118   (signature vec4
119     (parameters
120       (declare (in) vec4 y)
121       (declare (in) vec4 x))
122     ((declare () vec4 r)
123      (declare () float temp)
124      (call atan (var_ref temp) ((swiz x (var_ref y)) (swiz x (var_ref x))))
125      (assign (x) (var_ref r) (var_ref temp))
126      (call atan (var_ref temp) ((swiz y (var_ref y)) (swiz y (var_ref x))))
127      (assign (y) (var_ref r) (var_ref temp))
128      (call atan (var_ref temp) ((swiz z (var_ref y)) (swiz z (var_ref x))))
129      (assign (z) (var_ref r) (var_ref temp))
130      (call atan (var_ref temp) ((swiz w (var_ref y)) (swiz w (var_ref x))))
131      (assign (w) (var_ref r) (var_ref temp))
132      (return (var_ref r))))
133
134))
135