/** NOTE: the connection from java to matlab */ public RCvalue java2Matlab() throws EvalException { if (rc == null) { if (poly != null) { Value[] v = new Value[poly.degree()]; for (int i = 0; i < v.length; i++) { Point pt = poly.point(i); assert pt.type() == CohoDouble.type : "The result type is not CohoDouble, it is " + pt.type(); // if(pt.type()!=CohoDouble.type){ // throw new RuntimeException("The result type is not CohoDouble, it is "+pt.type() ); // } v[i] = RCvalue.factory() .create( new Value[] { DoubleValue.factory() .create(new Double(((CohoDouble) pt.x()).doubleValue()), null), DoubleValue.factory() .create(new Double(((CohoDouble) pt.y()).doubleValue()), null) }, false); } rc = (RCvalue) (RCvalue.factory().create(v, true)); } else { // empty polygon rc = (RCvalue) (RCvalue.factory().create(new Value[0], true)); } } return (rc); }