1- /*
2- * Copyright (c) 2018-19 Martin Prout
3- *
1+ /*
2+ * Copyright (c) 2018-20 Martin Prout
3+ *
44 * This library is free software; you can redistribute it and/or
55 * modify it under the terms of the GNU General Public
66 * License as published by the Free Software Foundation; either
77 * version 3.0 of the License, or (at your option) any later version.
8- *
8+ *
99 * http://creativecommons.org/licenses/LGPL/2.1/
10- *
10+ *
1111 * This library is distributed in the hope that it will be useful,
1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1414 * Lesser General Public License for more details.
15- *
15+ *
1616 * You should have received a copy of the GNU General Public
1717 * License along with this library; if not, write to the Free Software
1818 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3535*/
3636@ JRubyModule (name = "DegLut" )
3737public class Deglut {
38-
38+
3939 /**
4040 * Lookup table for degree cosine/sine, has a fixed precision 1.0
4141 * degrees Quite accurate but imprecise
@@ -49,11 +49,11 @@ public class Deglut {
4949 *
5050 */
5151 private static boolean initialized = false ;
52-
52+
5353 private final static int NINETY = 90 ;
5454 private final static int FULL = 360 ;
5555 private static final long serialVersionUID = -1466528933765940101L ;
56-
56+
5757 /**
5858 * Initialize sin table with values (first quadrant only)
5959 */
@@ -65,19 +65,19 @@ public static final void initTable() {
6565 initialized = true ;
6666 }
6767 }
68-
68+
6969 /**
7070 *
7171 * @param runtime Ruby
7272 */
73-
73+
7474 public static void createDeglut (final Ruby runtime ){
7575 RubyModule deglutModule = runtime .defineModule ("DegLut" );
7676 deglutModule .defineAnnotatedMethods (Deglut .class );
7777 Deglut .initTable ();
7878 }
79-
80-
79+
80+
8181 /**
8282 *
8383 * @param context ThreadContext
@@ -86,7 +86,7 @@ public static void createDeglut(final Ruby runtime){
8686 * @return sin IRubyObject
8787 */
8888 @ JRubyMethod (name = "sin" , module = true )
89-
89+
9090 public static IRubyObject sin (ThreadContext context , IRubyObject recv , IRubyObject other ) {
9191 int thet = (int ) ((RubyInteger )other ).getLongValue ();
9292 while (thet < 0 ) {
@@ -99,7 +99,7 @@ public static IRubyObject sin(ThreadContext context, IRubyObject recv, IRubyObje
9999 ? -SIN_DEG_LUT [y ] : -SIN_DEG_LUT [NINETY - y ];
100100 return context .runtime .newFloat (result );
101101 }
102-
102+
103103 /**
104104 *
105105 * @param context ThreadContext
@@ -119,5 +119,5 @@ public static IRubyObject cos(ThreadContext context, IRubyObject recv, IRubyObje
119119 ? -SIN_DEG_LUT [y ] : (theta < 270 )
120120 ? -SIN_DEG_LUT [NINETY - y ] : SIN_DEG_LUT [y ];
121121 return context .runtime .newFloat (result );
122- }
122+ }
123123}
0 commit comments