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