Commit 77945c4e authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: Export vrml: fix an issue for 3D shapes having a local offset defined:...

Pcbnew: Export vrml: fix an issue for 3D shapes having a local offset defined: the local offset was not correctly scaled.
parent 8cd77e78
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -300,7 +300,10 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
             * with outlines thickness = 0 is a faster than
             * just draw filled polygons but with outlines thickness = m_ZoneMinThickness
             * So DO NOT use draw filled polygons with outlines having a thickness  > 0
             * Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn
             * Note: Extra segments ( added to joint holes with external outline) flagged by
             * m_utility != 0 are not drawn
             * Note not all polygon libraries provide a flag for these extra-segments, therefore
             * the m_utility member can be always 0
             */
            {
                // Draw outlines:
+7 −6
Original line number Diff line number Diff line
@@ -1111,10 +1111,11 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
            fprintf( aOutputFile, "  rotation %g %g %g %g\n", rot[0], rot[1], rot[2], rot[3] );
        }

        // adjust 3D shape offset position
        int offsetx = vrmlm->m_MatPosition.x;
        int offsety = vrmlm->m_MatPosition.y;
        double offsetz = vrmlm->m_MatPosition.z;
        // adjust 3D shape local offset position
        // they are given in inch, so they are converted in board IU.
        double offsetx = vrmlm->m_MatPosition.x * IU_PER_MILS * 1000.0;
        double offsety = vrmlm->m_MatPosition.y * IU_PER_MILS * 1000.0;
        double offsetz = vrmlm->m_MatPosition.z * IU_PER_MILS * 1000.0;

        if ( isFlipped )
            NEGATE(offsetz);
@@ -1124,8 +1125,8 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
        RotatePoint(&offsetx, &offsety, aModule->GetOrientation());

        fprintf( aOutputFile, "  translation %g %g %g\n",
                 (double) (offsetx + aModule->m_Pos.x) * boardIU2WRML,
                 - (double)(offsety + aModule->m_Pos.y) * boardIU2WRML,    // Y axis is reversed in Pcbnew
                 (offsetx + aModule->m_Pos.x) * boardIU2WRML,
                 - (offsety + aModule->m_Pos.y) * boardIU2WRML,    // Y axis is reversed in Pcbnew
                 offsetz + layer_z[aModule->GetLayer()] * boardIU2WRML);

        fprintf( aOutputFile, "  scale %g %g %g\n",
+2 −1
Original line number Diff line number Diff line
// PolyLine.cpp ... implementation of CPolyLine class from FreePCB.

//
// implementation for kicad and kbool polygon clipping library
// implementation for kicad, using clipper polygon clipping library
// for transformations not handled (at least for Kicad) by boost::polygon
//
#include <cmath>
#include <vector>
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@

#include <vector>

//#include <kbool/include/kbool/booleng.h>
#include <pad_shapes.h>
#include <wx/gdicmn.h>      // for wxPoint definition