diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 01421d9854..7aa39d1262 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -506,7 +506,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) Draw3D_ZaxisCylinder( via->GetStart(), (outer_radius + inner_radius)/2, thickness, outer_radius - inner_radius, - zpos, biu_to_3Dunits ); + zpos - (thickness/2), biu_to_3Dunits ); if( layer >= top_layer ) break; } @@ -515,7 +515,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetShape() ); SetGLColor( color ); int height = g_Parm_3D_Visu.GetLayerZcoordBIU(top_layer) - - g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ); + g_Parm_3D_Visu.GetLayerZcoordBIU( bottom_layer ) - thickness; int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(bottom_layer) + thickness/2; Draw3D_ZaxisCylinder( via->GetStart(), inner_radius + thickness/2, height, diff --git a/3d-viewer/3d_draw_basic_functions.cpp b/3d-viewer/3d_draw_basic_functions.cpp index 4fd075479d..06fbd76100 100644 --- a/3d-viewer/3d_draw_basic_functions.cpp +++ b/3d-viewer/3d_draw_basic_functions.cpp @@ -212,7 +212,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const std::vector& aPolysList, return; // Build the 3D data : vertical side - Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos, false, aBiuTo3DUnits ); + Draw3D_VerticalPolygonalCylinder( polylist, aThickness, aZpos - (aThickness / 2), false, aBiuTo3DUnits ); } diff --git a/3d-viewer/info3d_visu.cpp b/3d-viewer/info3d_visu.cpp index 2a61f0ca04..6fe6c9248b 100644 --- a/3d-viewer/info3d_visu.cpp +++ b/3d-viewer/info3d_visu.cpp @@ -192,3 +192,19 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) m_LayerZcoord[layer_id] = zpos; } } + +/* return the Z position of 3D shapes, in 3D Units + * aIsFlipped: true for modules on Front (top) layer, false + * if on back (bottom) layer + * Note: in draw functions, the copper has a thickness = m_CopperThickness + * Vias and tracks are draw with the top side position = m_CopperThickness/2 + * and the bottom side position = -m_CopperThickness/2 from the Z layer position + */ +double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped ) +{ + if( aIsFlipped ) + return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 ); + else + return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 ); +} + diff --git a/3d-viewer/info3d_visu.h b/3d-viewer/info3d_visu.h index 5677cc9a55..ec2aa74d86 100644 --- a/3d-viewer/info3d_visu.h +++ b/3d-viewer/info3d_visu.h @@ -110,18 +110,11 @@ public: INFO3D_VISU(); /** * function GetModulesZcoord3DIU - * @return the Z coordinate of the module, in 3D Units + * @return the Z position of 3D shapes, in 3D Units * @param aIsFlipped: true for modules on Front (top) layer, false * if on back (bottom) layer - * Used to know the Z position of 3D shapes */ - double GetModulesZcoord3DIU( bool aIsFlipped ) - { - if( aIsFlipped ) - return m_LayerZcoord[ADHESIVE_N_BACK] - m_NonCopperLayerThickness; - else - return m_LayerZcoord[ADHESIVE_N_FRONT] + m_NonCopperLayerThickness; - } + double GetModulesZcoord3DIU( bool aIsFlipped ); /** * function GetLayerZcoordBIU