Make graphs sparser

This commit is contained in:
serso 2016-04-20 15:56:10 +02:00
parent 557c04df89
commit 65d05ca60d
5 changed files with 32 additions and 19 deletions

Binary file not shown.

View File

@ -29,10 +29,7 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import dagger.Lazy;
import jscl.math.Generic;
import jscl.math.function.Constant;
import jscl.math.function.CustomFunction;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.about.AboutActivity; import org.solovyev.android.calculator.about.AboutActivity;
import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.android.calculator.functions.CppFunction;
@ -50,12 +47,18 @@ import org.solovyev.android.plotter.PlotFunction;
import org.solovyev.android.plotter.Plotter; import org.solovyev.android.plotter.Plotter;
import org.solovyev.common.msg.MessageType; import org.solovyev.common.msg.MessageType;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.List; import dagger.Lazy;
import jscl.math.Generic;
import jscl.math.function.Constant;
import jscl.math.function.CustomFunction;
@Singleton @Singleton
public final class ActivityLauncher { public final class ActivityLauncher {
@ -189,7 +192,7 @@ public final class ActivityLauncher {
final CustomFunction f = new CustomFunction.Builder().setName("").setParameterNames(parameters).setContent(content).create(); final CustomFunction f = new CustomFunction.Builder().setName("").setParameterNames(parameters).setContent(content).create();
final ExpressionFunction ef = new ExpressionFunction(f); final ExpressionFunction ef = new ExpressionFunction(f);
final PlotFunction pf = PlotFunction.create(ef, application); final PlotFunction pf = PlotFunction.create(ef, application);
pf.meshSpec.pointsCount = 100; pf.meshSpec.pointsCount = PlotActivity.POINTS_COUNT;
plotter.get().add(pf); plotter.get().add(pf);
showPlotter(); showPlotter();
} catch (RuntimeException e) { } catch (RuntimeException e) {

View File

@ -26,6 +26,8 @@ import butterknife.ButterKnife;
public class PlotActivity extends BaseActivity { public class PlotActivity extends BaseActivity {
public static final int POINTS_COUNT = 100;
public static class MyFragment extends BaseFragment implements PlotViewFrame.Listener { public static class MyFragment extends BaseFragment implements PlotViewFrame.Listener {
@Inject @Inject

View File

@ -10,8 +10,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import butterknife.Bind;
import jscl.math.function.CustomFunction;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.AppComponent;
@ -24,13 +23,17 @@ import org.solovyev.android.plotter.PlotFunction;
import org.solovyev.android.plotter.PlotIconView; import org.solovyev.android.plotter.PlotIconView;
import org.solovyev.android.plotter.Plotter; import org.solovyev.android.plotter.Plotter;
import org.solovyev.android.plotter.meshes.MeshSpec; import org.solovyev.android.plotter.meshes.MeshSpec;
import uz.shift.colorpicker.LineColorPicker;
import uz.shift.colorpicker.OnColorChangedListener; import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List; import butterknife.Bind;
import jscl.math.function.CustomFunction;
import uz.shift.colorpicker.LineColorPicker;
import uz.shift.colorpicker.OnColorChangedListener;
public class PlotEditFunctionFragment extends BaseFunctionFragment public class PlotEditFunctionFragment extends BaseFunctionFragment
implements SeekBar.OnSeekBarChangeListener { implements SeekBar.OnSeekBarChangeListener {
@ -151,7 +154,7 @@ public class PlotEditFunctionFragment extends BaseFunctionFragment
final Color color = Color.create(colorPicker.getColor()); final Color color = Color.create(colorPicker.getColor());
final int width = MeshSpec.MIN_WIDTH + lineWidthSeekBar.getProgress(); final int width = MeshSpec.MIN_WIDTH + lineWidthSeekBar.getProgress();
final MeshSpec meshSpec = MeshSpec.create(color, width); final MeshSpec meshSpec = MeshSpec.create(color, width);
meshSpec.pointsCount = 100; meshSpec.pointsCount = PlotActivity.POINTS_COUNT;
return meshSpec; return meshSpec;
} }

View File

@ -1,5 +1,14 @@
package jscl.math; package jscl.math;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import jscl.math.function.Constant; import jscl.math.function.Constant;
import jscl.math.function.Fraction; import jscl.math.function.Fraction;
import jscl.math.function.Inverse; import jscl.math.function.Inverse;
@ -14,10 +23,6 @@ import jscl.text.ParserUtils;
import jscl.text.msg.Messages; import jscl.text.msg.Messages;
import jscl.util.ArrayUtils; import jscl.util.ArrayUtils;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
public class Expression extends Generic { public class Expression extends Generic {
protected static final com.google.common.base.Function<Variable, Generic> FACTORIZE_CONVERTER = new com.google.common.base.Function<Variable, Generic>() { protected static final com.google.common.base.Function<Variable, Generic> FACTORIZE_CONVERTER = new com.google.common.base.Function<Variable, Generic>() {
@ -105,7 +110,7 @@ public class Expression extends Generic {
return expression; return expression;
} }
public static Expression valueOf(@Nonnull Double value) { public static Expression valueOf(double value) {
final Expression expression = new Expression(1); final Expression expression = new Expression(1);
Literal literal = new Literal(); Literal literal = new Literal();
literal.init(new DoubleVariable(new NumericWrapper(Real.valueOf(value))), 1); literal.init(new DoubleVariable(new NumericWrapper(Real.valueOf(value))), 1);