package org.geogebra.common.kernel.advanced; import org.geogebra.common.kernel.Kernel; import org.geogebra.common.kernel.arithmetic.Command; import org.geogebra.common.kernel.commands.CommandProcessor; import org.geogebra.common.kernel.geos.GeoElement; import org.geogebra.common.kernel.kernelND.GeoPointND; import org.geogebra.common.main.MyError; /** * AffineRatio[<Point>,<Point>,<Point>] * * @author Victor Franco Espino */ public class CmdAffineRatio extends CommandProcessor { /** * Create new command processor * * @param kernel * kernel */ public CmdAffineRatio(Kernel kernel) { super(kernel); } @Override public GeoElement[] process(Command c) throws MyError { int n = c.getArgumentNumber(); boolean[] ok = new boolean[n]; GeoElement[] arg; switch (n) { case 3: arg = resArgs(c); if ((ok[0] = (arg[0].isGeoPoint())) && (ok[1] = (arg[1].isGeoPoint())) && (ok[2] = (arg[2].isGeoPoint()))) { AlgoAffineRatio affine = new AlgoAffineRatio(cons, c.getLabel(), (GeoPointND) arg[0], (GeoPointND) arg[1], (GeoPointND) arg[2]); GeoElement[] ret = { affine.getResult() }; return ret; } throw argErr(app, c, getBadArg(ok, arg)); default: throw argNumErr(app, c, n); } } }