2011-09-30 18:15:37 +00:00
|
|
|
/**
|
2023-01-20 08:45:03 +00:00
|
|
|
* @file am_primitive.cpp
|
2011-09-30 18:15:37 +00:00
|
|
|
*/
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2011-09-23 20:00:30 +00:00
|
|
|
*
|
2017-04-09 14:31:14 +00:00
|
|
|
* Copyright (C) 1992-2017 Jean-Pierre Charras <jp.charras at wanadoo.fr>
|
2011-09-23 20:00:30 +00:00
|
|
|
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2023-01-20 08:45:03 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-09-23 20:00:30 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <trigo.h>
|
2016-06-03 16:42:24 +00:00
|
|
|
#include <convert_basic_shapes_to_polygon.h>
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <math/util.h> // for KiROUND
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gerbview.h>
|
2018-01-29 12:26:58 +00:00
|
|
|
#include <gerber_file_image.h>
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-07-16 20:13:26 +00:00
|
|
|
* Convert a distance given in floating point to our internal units.
|
2011-09-23 20:00:30 +00:00
|
|
|
*/
|
2021-07-16 20:13:26 +00:00
|
|
|
extern int scaletoIU( double aCoord, bool isMetric );
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-16 20:13:26 +00:00
|
|
|
* Translate a point from the aperture macro coordinate system to our
|
2011-09-23 20:00:30 +00:00
|
|
|
* deci-mils coordinate system.
|
2021-07-16 20:13:26 +00:00
|
|
|
*
|
|
|
|
* @return The GerbView coordinate system vector.
|
2011-09-23 20:00:30 +00:00
|
|
|
*/
|
2022-01-01 18:57:44 +00:00
|
|
|
static VECTOR2I mapPt( double x, double y, bool isMetric )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I ret( scaletoIU( x, isMetric ), scaletoIU( y, isMetric ) );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
|
2017-11-11 22:20:19 +00:00
|
|
|
bool AM_PRIMITIVE::IsAMPrimitiveExposureOn( const GERBER_DRAW_ITEM* aParent ) const
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
/*
|
|
|
|
* Some but not all primitives use the first parameter as an exposure control.
|
|
|
|
* Others are always ON.
|
|
|
|
* In a aperture macro shape, a basic primitive with exposure off is a hole in the shape
|
|
|
|
* it is NOT a negative shape
|
|
|
|
*/
|
2023-01-13 17:57:18 +00:00
|
|
|
wxASSERT( m_Params.size() );
|
2016-06-03 16:42:24 +00:00
|
|
|
|
2023-01-13 17:57:18 +00:00
|
|
|
switch( m_Primitive_id )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
case AMP_CIRCLE:
|
|
|
|
case AMP_LINE2:
|
|
|
|
case AMP_LINE20:
|
|
|
|
case AMP_LINE_CENTER:
|
|
|
|
case AMP_LINE_LOWER_LEFT:
|
|
|
|
case AMP_OUTLINE:
|
|
|
|
case AMP_POLYGON:
|
2016-06-03 16:42:24 +00:00
|
|
|
// All have an exposure parameter and can return a value (0 or 1)
|
2023-01-13 17:57:18 +00:00
|
|
|
return m_Params[0].GetValue( aParent->GetDcodeDescr() ) != 0;
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
case AMP_THERMAL: // Exposure is always on
|
|
|
|
case AMP_MOIRE: // Exposure is always on
|
2011-09-23 20:00:30 +00:00
|
|
|
case AMP_EOF:
|
|
|
|
case AMP_UNKNOWN:
|
|
|
|
default:
|
2016-06-03 16:42:24 +00:00
|
|
|
return 1; // All have no exposure parameter and are always 0N return true
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2019-05-22 13:33:48 +00:00
|
|
|
// TODO(snh): Remove hard coded count
|
2017-04-08 15:41:53 +00:00
|
|
|
const int seg_per_circle = 64; // Number of segments to approximate a circle
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2023-01-18 15:35:09 +00:00
|
|
|
void AM_PRIMITIVE::ConvertBasicShapeToPolygon( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer,
|
2022-01-01 06:04:08 +00:00
|
|
|
const VECTOR2I& aShapePos )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
#define TO_POLY_SHAPE \
|
|
|
|
{ \
|
|
|
|
if( polybuffer.size() > 1 ) \
|
|
|
|
{ \
|
|
|
|
aShapeBuffer.NewOutline(); \
|
2021-07-26 19:35:12 +00:00
|
|
|
\
|
2021-07-16 20:13:26 +00:00
|
|
|
for( unsigned jj = 0; jj < polybuffer.size(); jj++ ) \
|
|
|
|
aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y ); \
|
2021-07-26 19:35:12 +00:00
|
|
|
\
|
2021-07-16 20:13:26 +00:00
|
|
|
aShapeBuffer.Append( polybuffer[0].x, polybuffer[0].y ); \
|
|
|
|
} \
|
|
|
|
}
|
2016-06-03 16:42:24 +00:00
|
|
|
|
|
|
|
// Draw the primitive shape for flashed items.
|
2021-07-16 20:13:26 +00:00
|
|
|
// Create a static buffer to avoid a lot of memory reallocation.
|
2022-01-01 06:04:08 +00:00
|
|
|
static std::vector<VECTOR2I> polybuffer;
|
2011-09-23 20:00:30 +00:00
|
|
|
polybuffer.clear();
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I curPos = aShapePos;
|
2011-09-23 20:00:30 +00:00
|
|
|
D_CODE* tool = aParent->GetDcodeDescr();
|
|
|
|
|
2023-01-13 17:57:18 +00:00
|
|
|
switch( m_Primitive_id )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
case AMP_CIRCLE: // Circle, given diameter and position
|
|
|
|
{
|
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "1,1,0.3,0.5, 1.0*"
|
2017-04-08 13:31:29 +00:00
|
|
|
* type (1), exposure, diameter, pos.x, pos.y, <rotation>
|
2017-04-08 15:41:53 +00:00
|
|
|
* <rotation> is a optional parameter: rotation from origin.
|
2011-09-23 20:00:30 +00:00
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
2017-04-08 15:41:53 +00:00
|
|
|
ConvertShapeToPolygon( aParent, polybuffer );
|
2017-04-08 13:31:29 +00:00
|
|
|
|
|
|
|
// shape rotation (if any):
|
2023-01-13 17:57:18 +00:00
|
|
|
if( m_Params.size() >= 5 )
|
2017-04-08 13:31:29 +00:00
|
|
|
{
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[4].GetValue( tool ), DEGREES_T );
|
2017-04-08 13:31:29 +00:00
|
|
|
|
2022-01-18 02:14:09 +00:00
|
|
|
if( !rotation.IsZero() )
|
2017-04-08 13:31:29 +00:00
|
|
|
{
|
2017-04-08 15:41:53 +00:00
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2017-04-08 13:31:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-08 15:41:53 +00:00
|
|
|
|
2017-04-08 13:31:29 +00:00
|
|
|
// Move to current position:
|
2017-04-08 15:41:53 +00:00
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
|
|
|
|
|
|
|
TO_POLY_SHAPE;
|
2021-07-16 20:13:26 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_LINE2:
|
|
|
|
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
|
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
/* Vector Line, Primitive Code 20.
|
|
|
|
* A vector line is a rectangle defined by its line width, start and end points.
|
|
|
|
* The line ends are rectangular.
|
|
|
|
*/
|
2011-09-23 20:00:30 +00:00
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "2,1,0.3,0,0, 0.5, 1.0,-135*"
|
|
|
|
* type (2), exposure, width, start.x, start.y, end.x, end.y, rotation
|
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
|
|
|
ConvertShapeToPolygon( aParent, polybuffer );
|
|
|
|
|
|
|
|
// shape rotation:
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[6].GetValue( tool ), DEGREES_T );
|
2017-04-08 10:53:40 +00:00
|
|
|
|
2022-01-18 02:14:09 +00:00
|
|
|
if( !rotation.IsZero() )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Move to current position:
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
TO_POLY_SHAPE;
|
2021-07-16 20:13:26 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_LINE_CENTER:
|
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
/* Center Line, Primitive Code 21
|
|
|
|
* A center line primitive is a rectangle defined by its width, height, and center point
|
|
|
|
*/
|
2011-09-23 20:00:30 +00:00
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "21,1,0.3,0.03,0,0,-135*"
|
|
|
|
* type (21), exposure, ,width, height, center pos.x, center pos.y, rotation
|
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
|
|
|
ConvertShapeToPolygon( aParent, polybuffer );
|
|
|
|
|
|
|
|
// shape rotation:
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[5].GetValue( tool ), DEGREES_T );
|
2016-06-03 16:42:24 +00:00
|
|
|
|
2022-01-18 02:14:09 +00:00
|
|
|
if( !rotation.IsZero() )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Move to current position:
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
TO_POLY_SHAPE;
|
2021-07-16 20:13:26 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_LINE_LOWER_LEFT:
|
|
|
|
{
|
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "22,1,0.3,0.03,0,0,-135*"
|
|
|
|
* type (22), exposure, ,width, height, corner pos.x, corner pos.y, rotation
|
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
|
|
|
ConvertShapeToPolygon( aParent, polybuffer );
|
|
|
|
|
|
|
|
// shape rotation:
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[5].GetValue( tool ), DEGREES_T );
|
2022-01-18 02:14:09 +00:00
|
|
|
|
|
|
|
if( !rotation.IsZero() )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Move to current position:
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
TO_POLY_SHAPE;
|
2021-07-16 20:13:26 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_THERMAL:
|
|
|
|
{
|
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "7, 0,0,1.0,0.3,0.01,-13*"
|
|
|
|
* type (7), center.x , center.y, outside diam, inside diam, crosshair thickness, rotation
|
|
|
|
* type is not stored in parameters list, so the first parameter is center.x
|
2016-06-03 16:42:24 +00:00
|
|
|
*
|
2021-07-16 20:13:26 +00:00
|
|
|
* The thermal primitive is a ring (annulus) interrupted by four gaps. Exposure is always
|
|
|
|
* on.
|
2011-09-23 20:00:30 +00:00
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
std::vector<VECTOR2I> subshape_poly;
|
2023-01-13 17:57:18 +00:00
|
|
|
curPos += mapPt( m_Params[0].GetValue( tool ), m_Params[1].GetValue( tool ), m_GerbMetric );
|
2016-06-03 16:42:24 +00:00
|
|
|
ConvertShapeToPolygon( aParent, subshape_poly );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// shape rotation:
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[5].GetValue( tool ), DEGREES_T );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
// Because a thermal shape has 4 identical sub-shapes, only one is created in subshape_poly.
|
2011-09-23 20:00:30 +00:00
|
|
|
// We must draw 4 sub-shapes rotated by 90 deg
|
|
|
|
for( int ii = 0; ii < 4; ii++ )
|
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
polybuffer = subshape_poly;
|
2022-01-18 02:14:09 +00:00
|
|
|
EDA_ANGLE sub_rotation = rotation + ANGLE_90 * ii;
|
2016-06-03 16:42:24 +00:00
|
|
|
|
|
|
|
for( unsigned jj = 0; jj < polybuffer.size(); jj++ )
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[jj], -sub_rotation );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Move to current position:
|
2016-06-03 16:42:24 +00:00
|
|
|
for( unsigned jj = 0; jj < polybuffer.size(); jj++ )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
polybuffer[jj] += curPos;
|
|
|
|
polybuffer[jj] = aParent->GetABPosition( polybuffer[jj] );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
TO_POLY_SHAPE;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
case AMP_MOIRE:
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2020-10-05 18:34:33 +00:00
|
|
|
/* Moire, Primitive Code 6
|
|
|
|
* The moire primitive is a cross hair centered on concentric rings (annuli).
|
2016-06-03 16:42:24 +00:00
|
|
|
* Exposure is always on.
|
|
|
|
*/
|
2023-01-13 17:57:18 +00:00
|
|
|
curPos += mapPt( m_Params[0].GetValue( tool ), m_Params[1].GetValue( tool ),
|
2011-09-23 20:00:30 +00:00
|
|
|
m_GerbMetric );
|
|
|
|
|
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "6,0,0,0.125,.01,0.01,3,0.003,0.150,0"
|
2021-07-16 20:13:26 +00:00
|
|
|
* type(6), pos.x, pos.y, diam, penwidth, gap, circlecount, crosshair thickness,
|
|
|
|
* crosshair len, rotation. The type is not stored in parameters list, so the first
|
|
|
|
* parameter is pos.x.
|
2011-09-23 20:00:30 +00:00
|
|
|
*/
|
2023-01-13 17:57:18 +00:00
|
|
|
int outerDiam = scaletoIU( m_Params[2].GetValue( tool ), m_GerbMetric );
|
|
|
|
int penThickness = scaletoIU( m_Params[3].GetValue( tool ), m_GerbMetric );
|
|
|
|
int gap = scaletoIU( m_Params[4].GetValue( tool ), m_GerbMetric );
|
|
|
|
int numCircles = KiROUND( m_Params[5].GetValue( tool ) );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Draw circles:
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I center = aParent->GetABPosition( curPos );
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
// adjust outerDiam by this on each nested circle
|
2021-07-16 20:13:26 +00:00
|
|
|
int diamAdjust = ( gap + penThickness ) * 2;
|
2016-06-03 16:42:24 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
for( int i = 0; i < numCircles; ++i, outerDiam -= diamAdjust )
|
|
|
|
{
|
|
|
|
if( outerDiam <= 0 )
|
|
|
|
break;
|
2016-06-03 16:42:24 +00:00
|
|
|
|
2016-10-13 08:26:49 +00:00
|
|
|
// Note: outerDiam is the outer diameter of the ring.
|
|
|
|
// the ring graphic diameter is (outerDiam - penThickness)
|
|
|
|
if( outerDiam <= penThickness )
|
|
|
|
{ // No room to draw a ring (no room for the hole):
|
|
|
|
// draw a circle instead (with no hole), with the right diameter
|
2020-10-13 10:55:24 +00:00
|
|
|
TransformCircleToPolygon( aShapeBuffer, center, outerDiam / 2, ARC_HIGH_DEF,
|
|
|
|
ERROR_INSIDE );
|
2016-10-13 08:26:49 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-13 10:55:24 +00:00
|
|
|
{
|
2019-05-22 13:33:48 +00:00
|
|
|
TransformRingToPolygon( aShapeBuffer, center, ( outerDiam - penThickness ) / 2,
|
2020-10-13 10:55:24 +00:00
|
|
|
penThickness, ARC_HIGH_DEF, ERROR_INSIDE );
|
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the cross:
|
|
|
|
ConvertShapeToPolygon( aParent, polybuffer );
|
|
|
|
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[8].GetValue( tool ), DEGREES_T );
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
// shape rotation:
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
// Move to current position:
|
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
TO_POLY_SHAPE;
|
|
|
|
break;
|
2021-07-16 20:13:26 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
case AMP_OUTLINE:
|
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
/* Outline, Primitive Code 4
|
2021-07-16 20:13:26 +00:00
|
|
|
* An outline primitive is an area enclosed by an n-point polygon defined by its start
|
|
|
|
* point and n
|
|
|
|
* subsequent points. The outline must be closed, i.e. the last point must be equal to
|
|
|
|
* the start point. There must be at least one subsequent point (to close the outline).
|
|
|
|
* The outline of the primitive is actually the contour (see 2.6) that consists of linear
|
|
|
|
* segments only, so it must conform to all the requirements described for contours.
|
2016-06-03 16:42:24 +00:00
|
|
|
* Warning: Make no mistake: n is the number of subsequent points, being the number of
|
|
|
|
* vertices of the outline or one less than the number of coordinate pairs.
|
|
|
|
*/
|
2011-09-23 20:00:30 +00:00
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "4,1,3,0.0,0.0,0.0,0.5,0.5,0.5,0.5,0.0,-25"
|
2021-07-16 20:13:26 +00:00
|
|
|
* type(4), exposure, corners count, corner1.x, corner.1y, ..., corner1.x, corner.1y,
|
|
|
|
* rotation
|
2011-09-23 20:00:30 +00:00
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
2023-01-13 17:57:18 +00:00
|
|
|
// m_Params[0] is the exposure and m_Params[1] is the corners count after the first corner
|
|
|
|
int numCorners = (int) m_Params[1].GetValue( tool );
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2017-10-24 16:09:33 +00:00
|
|
|
// the shape rotation is the last param of list, after corners
|
2023-01-13 17:57:18 +00:00
|
|
|
int last_prm = m_Params.size() - 1;
|
|
|
|
EDA_ANGLE rotation( m_Params[last_prm].GetValue( tool ), DEGREES_T );
|
2022-01-18 02:14:09 +00:00
|
|
|
VECTOR2I pos;
|
2017-10-24 16:09:33 +00:00
|
|
|
|
|
|
|
// Read points.
|
|
|
|
// Note: numCorners is the polygon corner count, following the first corner
|
|
|
|
// * the polygon is always closed,
|
|
|
|
// * therefore the last XY coordinate is the same as the first
|
2023-01-13 17:57:18 +00:00
|
|
|
int prm_idx = 2; // m_Params[2] is the first X coordinate
|
2020-10-05 18:34:33 +00:00
|
|
|
|
2017-10-24 16:09:33 +00:00
|
|
|
for( int i = 0; i <= numCorners; ++i )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2023-01-13 17:57:18 +00:00
|
|
|
pos.x = scaletoIU( m_Params[prm_idx].GetValue( tool ), m_GerbMetric );
|
2017-10-24 16:09:33 +00:00
|
|
|
prm_idx++;
|
2023-01-13 17:57:18 +00:00
|
|
|
pos.y = scaletoIU( m_Params[prm_idx].GetValue( tool ), m_GerbMetric );
|
2017-10-24 16:09:33 +00:00
|
|
|
prm_idx++;
|
2011-09-23 20:00:30 +00:00
|
|
|
polybuffer.push_back(pos);
|
2017-10-24 16:09:33 +00:00
|
|
|
|
|
|
|
// Guard: ensure prm_idx < last_prm
|
|
|
|
// I saw malformed gerber files with numCorners = number
|
|
|
|
// of coordinates instead of number of coordinates following the first point
|
|
|
|
if( prm_idx >= last_prm )
|
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
2021-07-16 20:13:26 +00:00
|
|
|
|
|
|
|
// rotate polygon and move it to the actual position shape rotation:
|
2011-09-23 20:00:30 +00:00
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2021-07-16 20:13:26 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Move to current position:
|
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
TO_POLY_SHAPE;
|
2021-07-17 06:53:23 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
2016-06-03 16:42:24 +00:00
|
|
|
case AMP_POLYGON:
|
2022-01-18 02:14:09 +00:00
|
|
|
{
|
2016-06-03 16:42:24 +00:00
|
|
|
/* Polygon, Primitive Code 5
|
2021-07-16 20:13:26 +00:00
|
|
|
* A polygon primitive is a regular polygon defined by the number of vertices n, the
|
|
|
|
* center point and the diameter of the circumscribed circle
|
2016-06-03 16:42:24 +00:00
|
|
|
*/
|
2011-09-23 20:00:30 +00:00
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "5,1,0.6,0,0,0.5,25"
|
|
|
|
* type(5), exposure, vertices count, pox.x, pos.y, diameter, rotation
|
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
2023-01-13 17:57:18 +00:00
|
|
|
curPos += mapPt( m_Params[2].GetValue( tool ), m_Params[3].GetValue( tool ), m_GerbMetric );
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
// Creates the shape:
|
|
|
|
ConvertShapeToPolygon( aParent, polybuffer );
|
|
|
|
|
|
|
|
// rotate polygon and move it to the actual position
|
2023-01-13 17:57:18 +00:00
|
|
|
EDA_ANGLE rotation( m_Params[5].GetValue( tool ), DEGREES_T );
|
2022-01-18 02:14:09 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
|
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( polybuffer[ii], -rotation );
|
2011-09-23 20:00:30 +00:00
|
|
|
polybuffer[ii] += curPos;
|
|
|
|
polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] );
|
|
|
|
}
|
2016-06-03 16:42:24 +00:00
|
|
|
|
|
|
|
TO_POLY_SHAPE;
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
2022-01-18 02:14:09 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
case AMP_EOF:
|
|
|
|
// not yet supported, waiting for you.
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AMP_UNKNOWN:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-11 22:20:19 +00:00
|
|
|
void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent,
|
2022-01-01 06:04:08 +00:00
|
|
|
std::vector<VECTOR2I>& aBuffer )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
D_CODE* tool = aParent->GetDcodeDescr();
|
|
|
|
|
2023-01-13 17:57:18 +00:00
|
|
|
switch( m_Primitive_id )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2017-04-08 15:41:53 +00:00
|
|
|
case AMP_CIRCLE:
|
|
|
|
{
|
|
|
|
/* Generated by an aperture macro declaration like:
|
|
|
|
* "1,1,0.3,0.5, 1.0*"
|
|
|
|
* type (1), exposure, diameter, pos.x, pos.y, <rotation>
|
|
|
|
* <rotation> is a optional parameter: rotation from origin.
|
|
|
|
* type is not stored in parameters list, so the first parameter is exposure
|
|
|
|
*/
|
2023-01-13 17:57:18 +00:00
|
|
|
int radius = scaletoIU( m_Params[1].GetValue( tool ), m_GerbMetric ) / 2;
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2021-07-13 08:23:55 +00:00
|
|
|
// A circle primitive can have a 0 size (for instance when used in roundrect macro),
|
|
|
|
// so skip it
|
|
|
|
if( radius <= 0 )
|
|
|
|
break;
|
|
|
|
|
2023-01-13 17:57:18 +00:00
|
|
|
VECTOR2I center = mapPt( m_Params[2].GetValue( tool ), m_Params[3].GetValue( tool ),
|
2022-01-18 02:14:09 +00:00
|
|
|
m_GerbMetric );
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I corner;
|
2022-01-18 02:14:09 +00:00
|
|
|
EDA_ANGLE delta = ANGLE_360 / seg_per_circle; // rot angle in 0.1 degree
|
2017-04-08 15:41:53 +00:00
|
|
|
|
2022-01-18 02:14:09 +00:00
|
|
|
for( EDA_ANGLE angle = ANGLE_0; angle < ANGLE_360; angle += delta )
|
2017-04-08 15:41:53 +00:00
|
|
|
{
|
|
|
|
corner.x = radius;
|
|
|
|
corner.y = 0;
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( corner, angle );
|
2017-04-08 15:41:53 +00:00
|
|
|
corner += center;
|
|
|
|
aBuffer.push_back( corner );
|
|
|
|
}
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
2021-07-16 20:13:26 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
case AMP_LINE2:
|
|
|
|
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
|
|
|
|
{
|
2023-01-13 17:57:18 +00:00
|
|
|
int width = scaletoIU( m_Params[1].GetValue( tool ), m_GerbMetric );
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I start =
|
2023-01-13 17:57:18 +00:00
|
|
|
mapPt( m_Params[2].GetValue( tool ), m_Params[3].GetValue( tool ), m_GerbMetric );
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I end =
|
2023-01-13 17:57:18 +00:00
|
|
|
mapPt( m_Params[4].GetValue( tool ), m_Params[5].GetValue( tool ), m_GerbMetric );
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I delta = end - start;
|
2013-05-01 17:32:36 +00:00
|
|
|
int len = KiROUND( EuclideanNorm( delta ) );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2017-04-08 13:31:29 +00:00
|
|
|
// To build the polygon, we must create a horizontal polygon starting to "start"
|
|
|
|
// and rotate it to have the end point to "end"
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I currpt;
|
2011-09-23 20:00:30 +00:00
|
|
|
currpt.y += width / 2; // Upper left
|
|
|
|
aBuffer.push_back( currpt );
|
|
|
|
currpt.x = len; // Upper right
|
|
|
|
aBuffer.push_back( currpt );
|
|
|
|
currpt.y -= width; // lower right
|
|
|
|
aBuffer.push_back( currpt );
|
2017-04-08 13:31:29 +00:00
|
|
|
currpt.x = 0; // lower left
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( currpt );
|
|
|
|
|
|
|
|
// Rotate rectangle and move it to the actual start point
|
2022-01-16 16:15:07 +00:00
|
|
|
EDA_ANGLE angle( delta );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < 4; ii++ )
|
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( aBuffer[ii], -angle );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer[ii] += start;
|
|
|
|
}
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2017-04-08 10:53:40 +00:00
|
|
|
break;
|
2021-07-16 20:13:26 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
case AMP_LINE_CENTER:
|
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I size =
|
2023-01-13 17:57:18 +00:00
|
|
|
mapPt( m_Params[1].GetValue( tool ), m_Params[2].GetValue( tool ), m_GerbMetric );
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I pos =
|
2023-01-13 17:57:18 +00:00
|
|
|
mapPt( m_Params[3].GetValue( tool ), m_Params[4].GetValue( tool ), m_GerbMetric );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Build poly:
|
|
|
|
pos.x -= size.x / 2;
|
|
|
|
pos.y -= size.y / 2; // Lower left
|
|
|
|
aBuffer.push_back( pos );
|
|
|
|
pos.y += size.y; // Upper left
|
|
|
|
aBuffer.push_back( pos );
|
|
|
|
pos.x += size.x; // Upper right
|
|
|
|
aBuffer.push_back( pos );
|
|
|
|
pos.y -= size.y; // lower right
|
|
|
|
aBuffer.push_back( pos );
|
2021-07-16 20:13:26 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_LINE_LOWER_LEFT:
|
|
|
|
{
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I size =
|
2023-01-13 17:57:18 +00:00
|
|
|
mapPt( m_Params[1].GetValue( tool ), m_Params[2].GetValue( tool ), m_GerbMetric );
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I lowerLeft =
|
2023-01-13 17:57:18 +00:00
|
|
|
mapPt( m_Params[3].GetValue( tool ), m_Params[4].GetValue( tool ), m_GerbMetric );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Build poly:
|
|
|
|
aBuffer.push_back( lowerLeft );
|
|
|
|
lowerLeft.y += size.y; // Upper left
|
|
|
|
aBuffer.push_back( lowerLeft );
|
|
|
|
lowerLeft.x += size.x; // Upper right
|
|
|
|
aBuffer.push_back( lowerLeft );
|
|
|
|
lowerLeft.y -= size.y; // lower right
|
|
|
|
aBuffer.push_back( lowerLeft );
|
2021-07-16 20:13:26 +00:00
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_THERMAL:
|
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from
|
|
|
|
// this first rotated by 90, 180 and 270 deg.
|
2023-01-13 17:57:18 +00:00
|
|
|
// m_Params = center.x (unused here), center.y (unused here), outside diam, inside diam,
|
2021-07-16 20:13:26 +00:00
|
|
|
// crosshair thickness.
|
2023-01-13 17:57:18 +00:00
|
|
|
int outerRadius = scaletoIU( m_Params[2].GetValue( tool ), m_GerbMetric ) / 2;
|
|
|
|
int innerRadius = scaletoIU( m_Params[3].GetValue( tool ), m_GerbMetric ) / 2;
|
2020-01-15 18:33:19 +00:00
|
|
|
|
|
|
|
// Safety checks to guarantee no divide-by-zero
|
|
|
|
outerRadius = std::max( 1, outerRadius );
|
|
|
|
innerRadius = std::max( 1, innerRadius );
|
|
|
|
|
2023-01-13 17:57:18 +00:00
|
|
|
int halfthickness = scaletoIU( m_Params[4].GetValue( tool ), m_GerbMetric ) / 2;
|
2022-01-18 02:14:09 +00:00
|
|
|
EDA_ANGLE angle_start( asin( (double) halfthickness / innerRadius ), RADIANS_T );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
// Draw shape in the first quadrant (X and Y > 0)
|
2022-01-18 02:14:09 +00:00
|
|
|
VECTOR2I pos, startpos;
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Inner arc
|
|
|
|
startpos.x = innerRadius;
|
2022-01-18 02:14:09 +00:00
|
|
|
EDA_ANGLE angle_end = ANGLE_90 - angle_start;
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2022-01-18 02:14:09 +00:00
|
|
|
for( EDA_ANGLE angle = angle_start; angle < angle_end; angle += EDA_ANGLE( 10, DEGREES_T ) )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
pos = startpos;
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( pos, angle );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Last point
|
|
|
|
pos = startpos;
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( pos, angle_end );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
|
|
|
|
// outer arc
|
|
|
|
startpos.x = outerRadius;
|
|
|
|
startpos.y = 0;
|
2022-01-18 02:14:09 +00:00
|
|
|
angle_start = EDA_ANGLE( asin( (double) halfthickness / outerRadius ), RADIANS_T );
|
|
|
|
angle_end = ANGLE_90 - angle_start;
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// First point, near Y axis, outer arc
|
2022-01-18 02:14:09 +00:00
|
|
|
for( EDA_ANGLE angle = angle_end; angle > angle_start; angle -= EDA_ANGLE( 10, DEGREES_T ) )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
pos = startpos;
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( pos, angle );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
}
|
|
|
|
|
|
|
|
// last point
|
|
|
|
pos = startpos;
|
2022-01-01 06:04:08 +00:00
|
|
|
RotatePoint( pos, angle_start );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
|
|
|
|
aBuffer.push_back( aBuffer[0] ); // Close poly
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
case AMP_MOIRE:
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
// A cross hair with n concentric circles. Only the cross is built as
|
|
|
|
// polygon because circles can be drawn easily
|
2023-01-13 17:57:18 +00:00
|
|
|
int crossHairThickness = scaletoIU( m_Params[6].GetValue( tool ), m_GerbMetric );
|
|
|
|
int crossHairLength = scaletoIU( m_Params[7].GetValue( tool ), m_GerbMetric );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Create cross. First create 1/4 of the shape.
|
2021-07-16 20:13:26 +00:00
|
|
|
// Others point are the same, rotated by 90, 180 and 270 deg
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I pos( crossHairThickness / 2, crossHairLength / 2 );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
pos.y = crossHairThickness / 2;
|
|
|
|
aBuffer.push_back( pos );
|
|
|
|
pos.x = -crossHairLength / 2;
|
|
|
|
aBuffer.push_back( pos );
|
|
|
|
pos.y = -crossHairThickness / 2;
|
|
|
|
aBuffer.push_back( pos );
|
|
|
|
|
|
|
|
// Copy the 4 shape, rotated by 90, 180 and 270 deg
|
|
|
|
for( int jj = 1; jj <= 3; jj ++ )
|
|
|
|
{
|
|
|
|
for( int ii = 0; ii < 4; ii++ )
|
|
|
|
{
|
|
|
|
pos = aBuffer[ii];
|
2022-01-18 02:14:09 +00:00
|
|
|
RotatePoint( pos, ANGLE_90 * jj );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
}
|
|
|
|
}
|
2021-07-16 20:13:26 +00:00
|
|
|
|
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case AMP_OUTLINE:
|
|
|
|
// already is a polygon. Do nothing
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AMP_POLYGON: // Creates a regular polygon
|
|
|
|
{
|
2023-01-13 17:57:18 +00:00
|
|
|
int vertexcount = KiROUND( m_Params[1].GetValue( tool ) );
|
|
|
|
int radius = scaletoIU( m_Params[4].GetValue( tool ), m_GerbMetric ) / 2;
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
// rs274x said: vertex count = 3 ... 10, and the first corner is on the X axis
|
|
|
|
if( vertexcount < 3 )
|
|
|
|
vertexcount = 3;
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
if( vertexcount > 10 )
|
|
|
|
vertexcount = 10;
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
for( int ii = 0; ii <= vertexcount; ii++ )
|
|
|
|
{
|
2022-01-01 18:57:44 +00:00
|
|
|
VECTOR2I pos( radius, 0 );
|
2022-01-18 02:14:09 +00:00
|
|
|
RotatePoint( pos, ANGLE_360 * ii / vertexcount );
|
2011-09-23 20:00:30 +00:00
|
|
|
aBuffer.push_back( pos );
|
|
|
|
}
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
2021-07-16 20:13:26 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
case AMP_COMMENT:
|
|
|
|
case AMP_UNKNOWN:
|
|
|
|
case AMP_EOF:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|