mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-11 09:51:06 +00:00
Share One Build Plate Tilt Up-Direction Helper Across the GUI
The bed gravity arrow, volume rendering and the painter/support gizmos each rebuilt the tilt up-vector from build_plate_tilt_x/y; use one helper that also tolerates presets without the keys.
This commit is contained in:
@@ -81,6 +81,7 @@
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/I18N.hpp"
|
||||
#include "libslic3r/PresetBundle.hpp"
|
||||
@@ -9812,5 +9813,17 @@ bool is_support_filament(int extruder_id, bool strict_check)
|
||||
return support_option->get_at(0);
|
||||
};
|
||||
|
||||
Vec3d build_plate_tilt_up_direction()
|
||||
{
|
||||
const DynamicPrintConfig &cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
const auto *opt_x = cfg.option<ConfigOptionFloat>("build_plate_tilt_x");
|
||||
const auto *opt_y = cfg.option<ConfigOptionFloat>("build_plate_tilt_y");
|
||||
const double tilt_x = opt_x != nullptr ? opt_x->value : 0.;
|
||||
const double tilt_y = opt_y != nullptr ? opt_y->value : 0.;
|
||||
if (tilt_x == 0. && tilt_y == 0.)
|
||||
return Vec3d::UnitZ();
|
||||
return Vec3d(std::tan(Geometry::deg2rad(tilt_y)), std::tan(Geometry::deg2rad(tilt_x)), 1.).normalized();
|
||||
}
|
||||
|
||||
} // GUI
|
||||
} //Slic3r
|
||||
|
||||
Reference in New Issue
Block a user