package com.github.klane.parc;

import org.jblas.DoubleMatrix;

public abstract class BasisCurve implements ParametricCurve {

    protected final int n;
    private DoubleMatrix P;

    public BasisCurve(final int n) {
        this.n = n;
    }

    public BasisCurve(final DoubleMatrix P) {
        this(P.rows-1);
        this.P = P.dup();
    }

    @Override
    public DoubleMatrix eval(final DoubleMatrix t) {
        return this.matrix(t).mmul(this.P);
    }

    public abstract DoubleMatrix matrix(final DoubleMatrix t);
}

@@ -157,13 +157,42 @@
   pr
-ivate
+otected final int d;%0A    protected
  Dou
@@ -238,16 +238,29 @@
 al int n
+, final int d
 ) %7B%0A    
@@ -271,24 +271,44 @@
 this.n = n;%0A
+        this.d = d;%0A
     %7D%0A%0A    p
@@ -369,16 +369,27 @@
 P.rows-1
+, P.columns
 );%0A     

Add dimension variable and make control points protected.