From 24a6c34ac94e45d80d613dc809942956557c72ba Mon Sep 17 00:00:00 2001 From: peud Date: Tue, 11 Mar 2008 22:48:52 +0000 Subject: [PATCH] Add ARC and CIRCLE shapes to 3d-viewer when used at module edge or pcb edge. --- 3d-viewer/3d_draw.cpp | 46 ++++++++++++++++++++++++++++--------------- change_log.txt | 7 +++++++ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index fa0eb65837..bcb92f5f2b 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -325,7 +325,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment ) { glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 ); zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; - switch( segment->m_Shape ) + switch( segment->m_Shape ) { case S_ARC: Draw3D_ArcSegment( x, -y, xf, -yf, w, zpos); @@ -430,7 +430,8 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) /***************************************************/ { - int ux0, uy0, dx, dy, rayon, StAngle, EndAngle; + wxString s; + int dx, dy; double scale, x, y, fx, fy, w, zpos; int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer]; @@ -441,34 +442,47 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0 ); scale = g_Parm_3D_Visu.m_BoardScale; - ux0 = m_Start.x; - uy0 = m_Start.y; dx = m_End.x; dy = m_End.y; zpos = g_Parm_3D_Visu.m_LayerZcoord[m_Layer]; w = m_Width * g_Parm_3D_Visu.m_BoardScale; + x = m_Start.x * g_Parm_3D_Visu.m_BoardScale; + y = m_Start.y * g_Parm_3D_Visu.m_BoardScale; + fx = dx * g_Parm_3D_Visu.m_BoardScale; + fy = dy * g_Parm_3D_Visu.m_BoardScale; - switch( m_Shape ) + + switch( m_Shape ) { case S_SEGMENT: - x = m_Start.x * g_Parm_3D_Visu.m_BoardScale; - y = m_Start.y * g_Parm_3D_Visu.m_BoardScale; - fx = dx * g_Parm_3D_Visu.m_BoardScale; - fy = dy * g_Parm_3D_Visu.m_BoardScale; Draw3D_FilledSegment( x, -y, fx, -fy, w, zpos ); +#if 0 + s.Printf("Draw FilledSegment: %g, %g, %g, %g, %g, %g\n",x,-y,fx,-fy,w,zpos); + printf( CONV_TO_UTF8( s ) ); +#endif break; case S_CIRCLE: - rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) ); - /* TO DO */ + Draw3D_CircleSegment( x, -y, fx, -fy, w, zpos); +#if 0 + s.Printf("Draw Circle: %g, %g, %g, %g, %g, %g\n",x,-y,fx,-fy,w,zpos); + printf( CONV_TO_UTF8( s ) ); +#endif break; case S_ARC: - rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) ); - StAngle = (int) ArcTangente( dy - uy0, dx - ux0 ); - EndAngle = StAngle + m_Angle; - /* TO DO */ - break; + Draw3D_ArcSegment( x, -y, fx, -fy, w, zpos); +#if 0 + s.Printf("Draw Arc: %g, %g, %g, %g, %g, %g\n",x,-y,fx,-fy,w,zpos); + printf( CONV_TO_UTF8( s ) ); +#endif + break; + + default: + s.Printf(wxT("Error: Shape nr %d not implemented!\n"), m_Shape); + printf( CONV_TO_UTF8( s ) ); + + break; } } diff --git a/change_log.txt b/change_log.txt index 3a58e16dbd..19d9d4a5c0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Mar-11 UPDATE Per Uddén +================================================================================ ++3d-viewer + * Fix TODO: Add S_ARC and S_CIRCLE shape render to board edge and module edge. + Ex. Now is a board with arcs at corners showing correctly. + + 2008-Mar-10 UPDATE Dick Hollenbeck ================================================================================ +pcbnew