other improvements
This commit is contained in:
parent
c99e367512
commit
b53577bdb2
@ -442,16 +442,16 @@ impl FunctionEntry {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let derivative_str = self.function.get_derivative_str();
|
let integral_step =
|
||||||
let step =
|
|
||||||
(settings.integral_max_x - settings.integral_min_x) / (settings.integral_num as f64);
|
(settings.integral_max_x - settings.integral_min_x) / (settings.integral_num as f64);
|
||||||
|
debug_assert!(integral_step > 0.0);
|
||||||
|
|
||||||
let resolution = (settings.max_x - settings.min_x) / (settings.plot_width as f64);
|
let step = (settings.max_x - settings.min_x) / (settings.plot_width as f64);
|
||||||
debug_assert!(resolution > 0.0);
|
debug_assert!(step > 0.0);
|
||||||
|
|
||||||
// Plot back data
|
// Plot back data
|
||||||
if !self.back_data.is_empty() {
|
if !self.back_data.is_empty() {
|
||||||
if self.integral && (resolution >= step) {
|
if self.integral && (step >= integral_step) {
|
||||||
plot_ui.line(
|
plot_ui.line(
|
||||||
self.back_data
|
self.back_data
|
||||||
.iter()
|
.iter()
|
||||||
@ -484,7 +484,7 @@ impl FunctionEntry {
|
|||||||
.clone()
|
.clone()
|
||||||
.to_line()
|
.to_line()
|
||||||
.color(Color32::GREEN)
|
.color(Color32::GREEN)
|
||||||
.name(derivative_str),
|
.name(self.function.get_derivative_str()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,8 +514,7 @@ impl FunctionEntry {
|
|||||||
|
|
||||||
if self.nth_derviative && let Some(ref nth_derviative) = self.nth_derivative_data {
|
if self.nth_derviative && let Some(ref nth_derviative) = self.nth_derivative_data {
|
||||||
plot_ui.line(
|
plot_ui.line(
|
||||||
(*nth_derviative)
|
nth_derviative.clone()
|
||||||
.clone()
|
|
||||||
.to_line()
|
.to_line()
|
||||||
.color(Color32::DARK_RED)
|
.color(Color32::DARK_RED)
|
||||||
.name(self.function.get_nth_derivative_str()),
|
.name(self.function.get_nth_derivative_str()),
|
||||||
@ -525,11 +524,11 @@ impl FunctionEntry {
|
|||||||
// Plot integral data
|
// Plot integral data
|
||||||
match &self.integral_data {
|
match &self.integral_data {
|
||||||
Some(integral_data) => {
|
Some(integral_data) => {
|
||||||
if step > resolution {
|
if integral_step > step {
|
||||||
plot_ui.bar_chart(
|
plot_ui.bar_chart(
|
||||||
BarChart::new(integral_data.0.clone())
|
BarChart::new(integral_data.0.clone())
|
||||||
.color(Color32::BLUE)
|
.color(Color32::BLUE)
|
||||||
.width(step),
|
.width(integral_step),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user