Don't allow nan values for dxf text alignment points to creep in

Literally the only place dxflib decides to default to NaN....
This commit is contained in:
Marek Roszko 2020-11-28 20:13:31 -05:00
parent cc7264c0b9
commit 5e117bfaa5
1 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include <trigo.h> #include <trigo.h>
#include <macros.h> #include <macros.h>
#include <math.h>
#include <board.h> #include <board.h>
#include "common.h" #include "common.h"
@ -563,7 +564,9 @@ void DXF_IMPORT_PLUGIN::addText( const DL_TextData& aData )
{ {
DXF_ARBITRARY_AXIS arbAxis = getArbitraryAxis( getExtrusion() ); DXF_ARBITRARY_AXIS arbAxis = getArbitraryAxis( getExtrusion() );
VECTOR3D refPointCoords = ocsToWcs( arbAxis, VECTOR3D( aData.ipx, aData.ipy, aData.ipz ) ); VECTOR3D refPointCoords = ocsToWcs( arbAxis, VECTOR3D( aData.ipx, aData.ipy, aData.ipz ) );
VECTOR3D secPointCoords = ocsToWcs( arbAxis, VECTOR3D( aData.apx, aData.apy, aData.apz ) ); VECTOR3D secPointCoords = ocsToWcs( arbAxis, VECTOR3D( isnan( aData.apx ) ? 0 : aData.apx,
isnan( aData.apy ) ? 0 : aData.apy,
isnan( aData.apz ) ? 0 : aData.apz ) );
VECTOR2D refPoint( mapX( refPointCoords.x ), mapY( refPointCoords.y ) ); VECTOR2D refPoint( mapX( refPointCoords.x ), mapY( refPointCoords.y ) );
VECTOR2D secPoint( mapX( secPointCoords.x ), mapY( secPointCoords.y ) ); VECTOR2D secPoint( mapX( secPointCoords.x ), mapY( secPointCoords.y ) );