KiCad PCB EDA Suite
panel_prev_3d.cpp File Reference
#include "panel_prev_3d.h"
#include <3d_canvas/eda_3d_canvas.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tools/3d_actions.h>
#include <tools/3d_controller.h>
#include <base_units.h>
#include <bitmaps.h>
#include <board.h>
#include <common_ogl/ogl_attr_list.h>
#include <gal/dpi_scaling.h>
#include <pgm_base.h>
#include <project.h>
#include <settings/common_settings.h>
#include <widgets/infobar.h>

Go to the source code of this file.

Functions

static double rotationFromString (const wxString &aValue)
 Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION. More...
 

Function Documentation

◆ rotationFromString()

static double rotationFromString ( const wxString &  aValue)
static

Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.

Parameters

Definition at line 182 of file panel_prev_3d.cpp.

183 {
184  double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0;
185 
186  if( rotation > MAX_ROTATION )
187  {
188  int n = KiROUND( rotation / MAX_ROTATION );
189  rotation -= MAX_ROTATION * n;
190  }
191  else if( rotation < -MAX_ROTATION )
192  {
193  int n = KiROUND( -rotation / MAX_ROTATION );
194  rotation += MAX_ROTATION * n;
195  }
196 
197  return rotation;
198 }
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
#define MAX_ROTATION
Definition: panel_prev_3d.h:49
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
Definition: base_units.cpp:293

References DEGREES, DoubleValueFromString(), KiROUND(), and MAX_ROTATION.

Referenced by PANEL_PREV_3D::updateOrientation().