This commit is contained in:
cyberpwn
2021-08-24 22:28:33 -04:00
parent 432e95e4ec
commit 8df789ae34
84 changed files with 404 additions and 786 deletions

View File

@@ -30,7 +30,7 @@ public class INode {
private double continuity;
public INode() {
this(new Vector(0,0,0));
this(new Vector(0, 0, 0));
}
public INode(INode other) {

View File

@@ -89,15 +89,15 @@ public class KochanekBartelsInterpolation implements PathInterpolation {
* Returns the linear combination of the given coefficients with the nodes adjacent to baseIndex.
*
* @param baseIndex node index
* @param f1 coefficient for baseIndex-1
* @param f2 coefficient for baseIndex
* @param f3 coefficient for baseIndex+1
* @param f4 coefficient for baseIndex+2
* @param f1 coefficient for baseIndex-1
* @param f2 coefficient for baseIndex
* @param f3 coefficient for baseIndex+1
* @param f4 coefficient for baseIndex+2
* @return linear combination of nodes[n-1..n+2] with f1..4
*/
private Vector linearCombination(int baseIndex, double f1, double f2, double f3, double f4) {
final Vector r1 = retrieve(baseIndex - 1).multiply(f1);
final Vector r2 = retrieve(baseIndex ).multiply(f2);
final Vector r2 = retrieve(baseIndex).multiply(f2);
final Vector r3 = retrieve(baseIndex + 1).multiply(f3);
final Vector r4 = retrieve(baseIndex + 2).multiply(f4);
@@ -108,7 +108,7 @@ public class KochanekBartelsInterpolation implements PathInterpolation {
* Retrieves a node. Indexes are clamped to the valid range.
*
* @param index node index to retrieve
* @return nodes[clamp(0, nodes.length-1)]
* @return nodes[clamp(0, nodes.length - 1)]
*/
private Vector retrieve(int index) {
if (index < 0) {
@@ -204,11 +204,11 @@ public class KochanekBartelsInterpolation implements PathInterpolation {
case 1:
// This case is merely a speed-up for a very common case
return arcLengthRecursive(indexLeft, remainderLeft, 1.0)
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
default:
return arcLengthRecursive(indexLeft, remainderLeft, indexRight - 1, 1.0)
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
}
}