Skip to content
Snippets Groups Projects
Commit 5bd960cc authored by Florian Schültke's avatar Florian Schültke
Browse files

Merge branch 'fix/wing_design_plot_disable' into 'develop'

[FIX] Stops request on matplot++ even if plotOn Flag set to false

See merge request !6
parents df8c758b f5cc0f24
No related branches found
No related tags found
5 merge requests!263Apply 1 suggestion(s) to 1 file(s),!261Reintruduced automatic flight condition selection,!245Apply 1 suggestion(s) to 1 file(s),!233Initial open source version,!6[FIX] Stops request on matplot++ even if plotOn Flag set to false
......@@ -25,7 +25,7 @@
/**
* \brief Generate polygon from spar or controldevice
*
*
* \param surface aerodynamic surface object
* \param object spar or control device object
* \return std::tuple<std::vector<double>,std::vector<double>,std::string> coordinates and object name
......@@ -34,12 +34,12 @@ std::tuple<std::vector<double>,std::vector<double>,std::string> gen_polygon(cons
/**
* \brief RGB and alpha values to Matplot++ format
*
*
* \param r red value between 0 - 255
* \param b blue value between 0 - 255
* \param g green alue between 0 - 255
* \param a alpha value between 0 (invisible) - 1 (solid)
* \return std::array<float,4UL> matplot++ conform color format
* \return std::array<float,4UL> matplot++ conform color format
*/
std::array<float,4UL> rgba(float r, float b, float g, float a) {
return {1-a,r/255,b/255,g/255};
......@@ -61,7 +61,7 @@ std::tuple<std::vector<double>,std::vector<double>,std::string> gen_polygon(cons
/* Spar coordinates positive values normally*/
double from = object.sections.at(0).origin.z() * half_span;
double to = object.sections.at(1).origin.z() * half_span;
/* Chordwise coordinates */
double chord_from_fwd = object.sections.at(0).get_contour().vertex(0).x();
double chord_from_aft = object.sections.at(0).get_contour().vertex(1).x();
......@@ -111,6 +111,11 @@ namespace cantilever {
fs::path Wing::plot_wing_planform() {
/* Plot active */
if (!rtIO->plotOn) {
return "";
}
auto coordinates_xy = geom2::transform::outline_2d(data->wing, geom2::Direction_3(0, 0, 1));
std::deque<double> spanwise;
std::deque<double> chordwise;
......@@ -130,7 +135,7 @@ fs::path Wing::plot_wing_planform() {
auto mac_position_y = geom2::measure::mean_aerodynamic_chord_position(data->wing);
auto mac_position = geom2::measure::offset_LE(data->wing,mac_position_y);
auto mac = geom2::measure::chord(data->wing,mac_position_y);
/* Generate plot */
......@@ -170,8 +175,8 @@ fs::path Wing::plot_wing_planform() {
ax->legend()->inside(true);
ax->legend()->box(true);
ax->legend()->font_size(8);
fs::path plot_path = rtIO->getPlotDir() + "/wing_planfrom.svg";
matplot::save(f, plot_path.string(), "svg");
std::this_thread::sleep_for(std::chrono::milliseconds(500));
......@@ -180,6 +185,10 @@ fs::path Wing::plot_wing_planform() {
}
fs::path Wing::plot_thickness_and_twist_distribution() {
/* Plot active */
if (!rtIO->plotOn) {
return "";
}
std::vector<double> eta;
std::vector<double> thickness_to_chord_ratio;
std::vector<double> twist;
......@@ -244,6 +253,10 @@ fs::path Wing::plot_thickness_and_twist_distribution() {
* \return fs::path
*/
std::vector<fs::path> Wing::plot_airfoils() {
/* Plot active */
if (!rtIO->plotOn) {
return {""};
}
std::map<std::string, std::vector<geom2::Point_2>> airfoils_data{};
std::vector<fs::path> airfoil_plots_path;
......@@ -289,4 +302,4 @@ std::vector<fs::path> Wing::plot_airfoils() {
}
} // namespace cantilever
} // namespace taw
\ No newline at end of file
} // namespace taw
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment