Skip to content

Commit

Permalink
fix javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
monkstone committed Feb 3, 2016
1 parent ec65fc3 commit cae7b6f
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 77 deletions.
4 changes: 2 additions & 2 deletions ext/monkstone/ColorUtil.java → src/monkstone/ColorUtil.java
@@ -1,7 +1,7 @@
/**
* The purpose of this uilit is to allow ruby-processing users to use an alternative
* The purpose of this utility is to allow ruby-processing users to use an alternative
* to processing.org color their sketches (to cope with ruby FixNumber vs java int)
* Copyright (C) 2015 Martin Prout. This tool is free software; you can
* Copyright (C) 2015-16 Martin Prout. This tool is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
Expand Down
12 changes: 8 additions & 4 deletions ext/monkstone/MathTool.java → src/monkstone/MathTool.java
@@ -1,7 +1,7 @@
/**
* The purpose of this tool is to allow ruby-processing users to use an alternative
* to processing.org map, lerp and norm methods in their sketches
* Copyright (C) 2015 Martin Prout. This tool is free software; you can
* Copyright (C) 2015-16 Martin Prout. This tool is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
Expand All @@ -27,6 +27,10 @@

public class MathTool extends RubyObject {

private static final long serialVersionUID = 4427564758225746633L;



/**
*
* @param runtime
Expand Down Expand Up @@ -107,7 +111,7 @@ public static IRubyObject mapProcessing(ThreadContext context, IRubyObject recv,
* @param context
* @param recv
* @param args args[2] should be between 0 and 1.0 if not returns start or stop
* @return
* @return lerp value
*/
@JRubyMethod(name = "lerp", rest = true, module = true)
public static IRubyObject lerpP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Expand All @@ -127,7 +131,7 @@ public static IRubyObject lerpP(ThreadContext context, IRubyObject recv, IRubyOb
* @param context
* @param recv
* @param args
* @return
* @return norm value
*/
@JRubyMethod(name = "norm", rest = true, module = true)
public static IRubyObject normP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Expand All @@ -143,7 +147,7 @@ public static IRubyObject normP(ThreadContext context, IRubyObject recv, IRubyOb
* @param context
* @param recv
* @param args
* @return
* @return strict normalized value ie 0..1.0
*/
@JRubyMethod(name = "norm_strict", rest = true, module = true)
public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Expand Down
@@ -1,6 +1,6 @@
/**
* The purpose of this class is to load the MathTool into ruby-processing runtime
* Copyright (C) 2015 Martin Prout. This code is free software; you can
* Copyright (C) 2015-16 Martin Prout. This code is free software; you can
* redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
Expand Down
Expand Up @@ -214,7 +214,7 @@ public Jvector mouse2sphere(double x, double y) {
*
* @param vector
* @param axis
* @return
* @return constrained vector
*/
public Jvector constrainVector(Jvector vector, Jvector axis) {
Jvector res = vector.sub(axis.mult(axis.dot(vector)));
Expand Down Expand Up @@ -251,7 +251,7 @@ public void dispose() {
/**
*
* @param obj
* @return
* @return java boolean
*/
@Override
public boolean equals(Object obj) {
Expand All @@ -276,7 +276,7 @@ public boolean equals(Object obj) {

/**
*
* @return
* @return has code int
*/
@Override
public int hashCode() {
Expand Down
File renamed without changes.
Expand Up @@ -51,7 +51,7 @@ public enum Constrain {

/**
* Numeric value of constrained axis
* @return
* @return index int
*/
public int index() {
return index;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Martin Prout
* Copyright (C) 2015-16 Martin Prout
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -72,7 +72,7 @@ public Jvector(Jvector vect) {
/**
*
* @param other
* @return
* @return subtracted vector
*/
public Jvector sub(Jvector other) {
return new Jvector(this.x - other.x, this.y - other.y, this.z - other.z);
Expand All @@ -81,15 +81,15 @@ public Jvector sub(Jvector other) {
/**
*
* @param scalar
* @return
* @return subtracted vector
*/
public Jvector mult(double scalar) {
return new Jvector(this.x * scalar, this.y * scalar, this.z * scalar);
}

/**
*
* @return
* @return magnitude float
*/
public double mag() {
return Math.sqrt(x * x + y * y + z * z);
Expand All @@ -98,7 +98,7 @@ public double mag() {
/**
* The usual normalize
*
* @return this
* @return this Jvector
*/
public Jvector normalize() {
double mag = Math.sqrt(x * x + y * y + z * z);
Expand All @@ -111,7 +111,7 @@ public Jvector normalize() {
/**
*
* @param other
* @return
* @return new dot product
*/
public double dot(Jvector other) {
return x * other.x + y * other.y + z * other.z;
Expand All @@ -120,7 +120,7 @@ public double dot(Jvector other) {
/**
*
* @param other
* @return
* @return new cross product
*/
public Jvector cross(Jvector other) {
double xc = y * other.z - z * other.y;
Expand All @@ -132,7 +132,7 @@ public Jvector cross(Jvector other) {
/**
*
* @param other
* @return
* @return boolean
*/
public boolean equals(Jvector other) {
if (other instanceof Jvector) {
Expand All @@ -152,7 +152,7 @@ public boolean equals(Jvector other) {
/**
*
* @param obj
* @return
* @return boolean
*/
@Override
public boolean equals(Object obj) {
Expand All @@ -174,7 +174,7 @@ public boolean equals(Object obj) {

/**
*
* @return
* @return has int
*/
@Override
public int hashCode() {
Expand Down
Expand Up @@ -90,7 +90,7 @@ public void set(Quaternion q) {
*
* @param q1
* @param q2
* @return
* @return new Quaternion
*/
public static Quaternion mult(Quaternion q1, Quaternion q2) {
double w = q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z;
Expand Down
@@ -1,6 +1,5 @@
package monkstone.arcball;

import java.io.IOException;
import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyModule;
Expand All @@ -19,6 +18,8 @@
@JRubyClass(name = "ArcBall")
public class Rarcball extends RubyObject {

private static final long serialVersionUID = -8164248008668234947L;

/**
*
* @param runtime
Expand Down
File renamed without changes.
Expand Up @@ -87,7 +87,7 @@ public void stroke(int col) {

/**
* Access applet if we must
* @return
* @return app PApplet
*/
public processing.core.PApplet app() {
return this.app;
Expand Down
Expand Up @@ -22,26 +22,27 @@ public class Deglut extends RubyObject {
*
* @author Martin Prout <martin_p@lineone.net>
*/
static final double[] sinDegLut = new double[91];
static final double[] SIN_DEG_LUT = new double[91];
/**
*
*/
public static final double TO_RADIANS = (double) (Math.PI / 180);
public static final double TO_RADIANS = Math.PI / 180;
/**
*
*/
private static boolean initialized = false;

private final static int NINETY = 90;
private final static int FULL = 360;
private static final long serialVersionUID = -1466528933765940101L;

/**
* Initialise sin table with values (first quadrant only)
*/
public static final void initTable() {
if (initialized == false) {
for (int i = 0; i <= NINETY; i++) {
sinDegLut[i] = Math.sin(TO_RADIANS * i);
SIN_DEG_LUT[i] = Math.sin(TO_RADIANS * i);
}
initialized = true;
}
Expand Down Expand Up @@ -74,7 +75,7 @@ private Deglut(Ruby runtime, RubyClass klass) {
* @param context
* @param klazz
* @param other
* @return
* @return sin float
*/
@JRubyMethod(name = "sin", meta = true)

Expand All @@ -85,9 +86,9 @@ public static IRubyObject sin(ThreadContext context, IRubyObject klazz, IRubyObj
}
int theta = thet % FULL;
int y = theta % NINETY;
double result = (theta < NINETY) ? sinDegLut[y] : (theta < 180)
? sinDegLut[NINETY - y] : (theta < 270)
? -sinDegLut[y] : -sinDegLut[NINETY - y];
double result = (theta < NINETY) ? SIN_DEG_LUT[y] : (theta < 180)
? SIN_DEG_LUT[NINETY - y] : (theta < 270)
? -SIN_DEG_LUT[y] : -SIN_DEG_LUT[NINETY - y];
return context.getRuntime().newFloat(result);
}

Expand All @@ -96,7 +97,7 @@ public static IRubyObject sin(ThreadContext context, IRubyObject klazz, IRubyObj
* @param context
* @param klazz
* @param other
* @return
* @return cos float
*/
@JRubyMethod(name = "cos", meta = true)
public static IRubyObject cos(ThreadContext context, IRubyObject klazz, IRubyObject other) {
Expand All @@ -106,9 +107,9 @@ public static IRubyObject cos(ThreadContext context, IRubyObject klazz, IRubyObj
}
int theta = thet % FULL;
int y = theta % NINETY;
double result = (theta < NINETY) ? sinDegLut[NINETY - y] : (theta < 180)
? -sinDegLut[y] : (theta < 270)
? -sinDegLut[NINETY - y] : sinDegLut[y];
double result = (theta < NINETY) ? SIN_DEG_LUT[NINETY - y] : (theta < 180)
? -SIN_DEG_LUT[y] : (theta < 270)
? -SIN_DEG_LUT[NINETY - y] : SIN_DEG_LUT[y];
return context.getRuntime().newFloat(result);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cae7b6f

Please sign in to comment.