All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.graphbuilder.math.func.ModFunction Maven / Gradle / Ivy

Go to download

Implementation of various mathematical curves that define themselves over a set of control points. The API is written in Java. The curves supported are: Bezier, B-Spline, Cardinal Spline, Catmull-Rom Spline, Lagrange, Natural Cubic Spline, and NURBS.

There is a newer version: 1.08
Show newest version
package com.graphbuilder.math.func;

/**
The mod function.
*/
public class ModFunction implements Function {

	public ModFunction() {}

	/**
	Returns the value of x % y, where x = d[0] and y = d[1].  More precisely, the value returned is
	x minus the value of x / y, where x / y is rounded to the closest integer value towards 0.
	*/
	public double of(double[] d, int numParam) {
		return d[0] % d[1];
	}

	/**
	Returns true only for 2 parameters, false otherwise.
	*/
	public boolean acceptNumParam(int numParam) {
		return numParam == 2;
	}

	public String toString() {
		return "mod(x, y)";
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy