29#include <wx/wfstream.h>
30#include <wx/zstream.h>
46#include "vrml_layer.h"
62 const wxString& aFullFileName,
double aMMtoWRMLunit,
63 bool aExport3DFiles,
bool aUseRelativePaths,
64 const wxString& a3D_Subdir,
65 double aXRef,
double aYRef )
68 aFullFileName, aMMtoWRMLunit,
69 aExport3DFiles, aUseRelativePaths,
70 a3D_Subdir, aXRef, aYRef );
81#define ERR_APPROX_MAX_MM 0.005
100 m_OutputPCB( nullptr )
129 COLOR4D boardBody( 0, 0, 0, 0 );
136 if( aColorName.StartsWith( wxT(
"#" ) ) )
144 if(
color.m_ColorName == aColorName )
145 return color.m_Color;
154 wxString colorName = stackupItem->GetColor();
156 switch( stackupItem->GetType() )
159 if( stackupItem->GetBrdLayerId() ==
F_SilkS )
166 if( stackupItem->GetBrdLayerId() ==
F_Mask )
177 if( boardBody ==
COLOR4D( 0, 0, 0, 0 ) )
178 boardBody = layerColor;
180 boardBody = boardBody.
Mix( layerColor, 1.0 - layerColor.
a );
182 boardBody.
a += ( 1.0 - boardBody.
a ) * layerColor.
a / 2;
191 if( boardBody ==
COLOR4D( 0, 0, 0, 0 ) )
196 if( finishName.EndsWith( wxT(
"OSP" ) ) )
200 else if( finishName.EndsWith( wxT(
"IG" ) )
201 || finishName.EndsWith( wxT(
"gold" ) ) )
205 else if( finishName.StartsWith( wxT(
"HAL" ) )
206 || finishName.StartsWith( wxT(
"HASL" ) )
207 || finishName.EndsWith( wxT(
"tin" ) )
208 || finishName.EndsWith( wxT(
"nickel" ) ) )
212 else if( finishName.EndsWith( wxT(
"silver" ) ) )
218 [](
const COLOR4D& aColor,
double aSpecular,
double aAmbient,
double aShiny )
224 spec.
r, spec.
g, spec.
b,
225 aAmbient, 1.0 - aColor.
a, aShiny );
273#define ADD_COLOR( list, r, g, b, a, name ) \
274 list.emplace_back( r/255.0, g/255.0, b/255.0, a, name )
335 if( aWorldScale < 0.001 || aWorldScale > 10.0 )
336 throw( std::runtime_error(
"WorldScale out of range (valid range is 0.001 to 10.0)" ) );
350 m_holes.SetVertexOffsets( aXoff, aYoff );
378 default:
return false;
391 for(
int lcnt = 0; lcnt < 2; lcnt++ )
417 VRML_LAYER* vrmllayer[] =
423 for(
int lcnt = 0; ; lcnt++ )
425 if( vrmllayer[lcnt] ==
nullptr )
438 VRML_LAYER* aLayer,
bool aPlane,
bool aTop,
439 double aTop_z,
double aBottom_z )
442 static const char* shape_boiler[] =
449 " appearance Appearance {\n",
450 " material Material {\n",
454 " geometry IndexedFaceSet {\n",
456 " coord Coordinate {\n",
473 int marker_found = 0, lineno = 0;
475 while( marker_found < 4 )
477 if( shape_boiler[lineno] )
479 aOut_file << shape_boiler[lineno];
485 switch( marker_found )
489 std::streamsize lastPrecision = aOut_file.precision();
490 aOut_file <<
" diffuseColor " << std::setprecision(3);
495 aOut_file <<
" specularColor ";
496 aOut_file << aColor.
spec_red <<
" ";
497 aOut_file << aColor.
spec_grn <<
" ";
498 aOut_file << aColor.
spec_blu <<
"\n";
500 aOut_file <<
" emissiveColor ";
501 aOut_file << aColor.
emit_red <<
" ";
502 aOut_file << aColor.
emit_grn <<
" ";
503 aOut_file << aColor.
emit_blu <<
"\n";
505 aOut_file <<
" ambientIntensity " << aColor.
ambient <<
"\n";
506 aOut_file <<
" transparency " << aColor.
transp <<
"\n";
507 aOut_file <<
" shininess " << aColor.
shiny <<
"\n";
508 aOut_file.precision( lastPrecision );
515 aLayer->WriteVertices( aTop_z, aOut_file,
m_precision );
517 aLayer->Write3DVertices( aTop_z, aBottom_z, aOut_file,
m_precision );
525 aLayer->WriteIndices( aTop, aOut_file );
527 aLayer->Write3DIndices( aOut_file );
730 if( i < copper_layers )
758 for(
int icnt = 0; icnt < aOutlines.
OutlineCount(); icnt++ )
762 int seg = aVlayer->NewContour();
764 for(
int jj = 0; jj < outline.
PointCount(); jj++ )
768 throw( std::runtime_error( aVlayer->GetError() ) );
771 aVlayer->EnsureWinding( seg,
false );
780 wxLogWarning(
_(
"Board outline is malformed. Run DRC for a full analysis." ) );
791 for(
int j = 0; j < outline.
PointCount(); j++ )
809 wxLogError(
_(
"VRML Export Failed: Could not add holes to contours." ) );
819 m_holes.EnsureWinding( seg,
true );
837 via->LayerPair( &top_layer, &bottom_layer );
840 if( top_layer !=
F_Cu && bottom_layer !=
B_Cu )
846 if( hole_radius <= 0 )
863 double minSegLength = M_PI * 2.0 * hole_radius / nsides;
864 double maxSegLength = minSegLength*2.0;
866 m_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
867 m_plated_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
869 m_holes.AddCircle( x, -y, hole_radius,
true,
true );
882 double hole_drill = std::min( hole_drill_w, hole_drill_h );
896 double minSegLength = M_PI * hole_drill / nsides;
897 double maxSegLength = minSegLength*2.0;
899 m_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
900 m_plated_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
918 hole_drill_w * 2.0, hole_drill_h * 2.0,
923 m_holes.AddSlot( hole_x, -hole_y, hole_drill_w * 2.0, hole_drill_h * 2.0,
934 m_plated_holes.AddCircle( hole_x, -hole_y, hole_drill,
true,
false );
938 m_holes.AddCircle( hole_x, -hole_y, hole_drill,
true,
false );
950static void build_quat(
double x,
double y,
double z,
double a,
double q[4] )
952 double sina = sin( a / 2 );
964 rot[3] = acos( q[3] ) * 2;
966 for(
int i = 0; i < 3; i++ )
967 rot[i] = q[i] / sin( rot[3] / 2 );
976 tmp[0] = q2[3] * q1[0] + q2[0] * q1[3] + q2[1] * q1[2] - q2[2] * q1[1];
977 tmp[1] = q2[3] * q1[1] + q2[1] * q1[3] + q2[2] * q1[0] - q2[0] * q1[2];
978 tmp[2] = q2[3] * q1[2] + q2[2] * q1[3] + q2[0] * q1[1] - q2[1] * q1[0];
979 tmp[3] = q2[3] * q1[3] - q2[0] * q1[0] - q2[1] * q1[1] - q2[2] * q1[2];
995 wxCHECK( aFootprint, );
998 wxString footprintBasePath = wxEmptyString;
1014 footprintBasePath = fpRow->
GetFullURI(
true );
1025 auto sM = aFootprint->
Models().begin();
1026 auto eM = aFootprint->
Models().end();
1040 if(
nullptr == mod3d )
1051 double rotx = -sM->m_Rotation.x;
1052 double roty = -sM->m_Rotation.y;
1053 double rotz = -sM->m_Rotation.z;
1063 double q1[4], q2[4], rot[4];
1080 double offsetx = sM->m_Offset.x * offsetFactor;
1081 double offsety = sM->m_Offset.y * offsetFactor;
1082 double offsetz = sM->m_Offset.z * offsetFactor;
1098 wxCHECK( aOutputFile, );
1100 int old_precision = aOutputFile->precision();
1103 wxFileName srcFile =
1107 dstFile.SetName( srcFile.GetName() );
1108 dstFile.SetExt( wxT(
"wrl" ) );
1111 wxDateTime srcModTime = srcFile.GetModificationTime();
1112 wxDateTime destModTime = srcModTime;
1114 destModTime.SetToCurrent();
1116 if( dstFile.FileExists() )
1117 destModTime = dstFile.GetModificationTime();
1119 if( srcModTime != destModTime )
1121 wxString fileExt = srcFile.GetExt();
1122 fileExt.LowerCase();
1126 if( fileExt == wxT(
"wrl" ) )
1128 if( !wxCopyFile( srcFile.GetFullPath(), dstFile.GetFullPath() ) )
1134 else if( fileExt == wxT(
"wrz" ) )
1136 wxFileInputStream input_file_stream( srcFile.GetFullPath() );
1137 if( !input_file_stream.IsOk() || input_file_stream.GetSize() == wxInvalidSize )
1143 wxZlibInputStream zlib_input_stream( input_file_stream, wxZLIB_GZIP );
1144 wxFFileOutputStream output_file_stream( dstFile.GetFullPath() );
1145 if( !zlib_input_stream.IsOk() || !output_file_stream.IsOk() )
1147 output_file_stream.Close();
1152 output_file_stream.Write( zlib_input_stream );
1153 output_file_stream.Close();
1166 (*aOutputFile) <<
"Transform {\n";
1169 if(
std::abs( rot[3] ) > 0.0001745 )
1171 (*aOutputFile) <<
" rotation ";
1172 (*aOutputFile) << rot[0] <<
" " << rot[1] <<
" " << rot[2] <<
" " << rot[3] <<
"\n";
1175 (*aOutputFile) <<
" translation ";
1176 (*aOutputFile) << trans.
x <<
" ";
1177 (*aOutputFile) << trans.
y <<
" ";
1178 (*aOutputFile) << trans.
z <<
"\n";
1180 (*aOutputFile) <<
" scale ";
1181 (*aOutputFile) << sM->m_Scale.x <<
" ";
1182 (*aOutputFile) << sM->m_Scale.y <<
" ";
1183 (*aOutputFile) << sM->m_Scale.z <<
"\n";
1185 (*aOutputFile) <<
" children [\n Inline {\n url \"";
1189 wxFileName tmp = dstFile;
1190 tmp.SetExt( wxT(
"" ) );
1191 tmp.SetName( wxT(
"" ) );
1192 tmp.RemoveLastDir();
1193 dstFile.MakeRelativeTo( tmp.GetPath() );
1196 wxString fn = dstFile.GetFullPath();
1197 fn.Replace( wxT(
"\\" ), wxT(
"/" ) );
1198 (*aOutputFile) <<
TO_UTF8( fn ) <<
"\"\n } ]\n";
1199 (*aOutputFile) <<
" }\n";
1201 aOutputFile->precision( old_precision );
1208 if(
std::abs( rot[3] ) > 0.0001745 )
1212 modelShape->
SetScale(
SGPOINT( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z ) );
1233 const wxString& aFullFileName,
double aMMtoWRMLunit,
1234 bool aExport3DFiles,
bool aUseRelativePaths,
1235 const wxString& a3D_Subdir,
1236 double aXRef,
double aYRef )
1238 if( aProject ==
nullptr )
1241 *aMessages =
_(
"No project when exporting the VRML file");
1259 SetOffset( -aXRef / 2.54, aYRef / 2.54 );
1267 bool success =
true;
1298 catch(
const std::exception& e )
1301 *aMessages <<
_(
"VRML Export Failed:\n" ) <<
FROM_UTF8( e.what() );
1310 bool aExport3DFiles,
bool aUseRelativePaths,
1311 const wxString& a3D_Subdir,
1312 double aXRef,
double aYRef )
1319 aExport3DFiles, aUseRelativePaths,
1320 a3D_Subdir, aXRef, aYRef );
1322 if( !msgs.IsEmpty() )
1323 wxMessageBox( msgs );
1334 if( ! subdir.DirExists() )
1336 if( !wxDir::Make( subdir.GetFullPath() ) )
1337 throw( std::runtime_error(
"Could not create 3D model subdirectory" ) );
1342 if( output_file.fail() )
1344 std::ostringstream ostr;
1345 ostr <<
"Could not open file '" <<
TO_UTF8( aFullFileName ) <<
"'";
1346 throw( std::runtime_error( ostr.str().c_str() ) );
1349 output_file.imbue( std::locale::classic() );
1352 wxString fn = aFullFileName;
1353 fn.Replace( wxT(
"\\" ) , wxT(
"/" ) );
1354 output_file <<
"#VRML V2.0 utf8\n";
1355 output_file <<
"WorldInfo {\n";
1356 output_file <<
" title \"" <<
TO_UTF8( fn ) <<
" - Generated by Pcbnew\"\n";
1357 output_file <<
"}\n";
1358 output_file <<
"Transform {\n";
1359 output_file <<
" scale " << std::setprecision(
m_precision );
1363 output_file <<
" children [\n";
1373 output_file <<
"]\n}\n";
1380 if( colorIdx == -1 )
1406 VRML_LAYER* layer,
double top_z,
bool aTopPlane )
1408 std::vector< double > vertices;
1409 std::vector< int > idxPlane;
1411 if( !( *layer ).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) )
1416 if( ( idxPlane.size() % 3 ) )
1418 throw( std::runtime_error(
"[BUG] index lists are not a multiple of 3 (not a triangle "
1422 std::vector< SGPOINT > vlist;
1423 size_t nvert = vertices.size() / 3;
1426 for(
size_t i = 0; i < nvert; ++i, j+= 3 )
1427 vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
1436 coordIdx.
SetIndices( idxPlane.size(), &idxPlane[0] );
1442 for(
size_t i = 0; i < nvert; ++i )
1447 for(
size_t i = 0; i < nvert; ++i )
1454 if(
nullptr != modelColor )
1465 VRML_LAYER* layer,
double top_z,
double bottom_z )
1467 std::vector< double > vertices;
1468 std::vector< int > idxPlane;
1469 std::vector< int > idxSide;
1471 if( top_z < bottom_z )
1478 if( !( *layer ).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z )
1479 || idxPlane.empty() || idxSide.empty() )
1484 if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
1486 throw( std::runtime_error(
"[BUG] index lists are not a multiple of 3 (not a "
1487 "triangle list)" ) );
1490 std::vector< SGPOINT > vlist;
1491 size_t nvert = vertices.size() / 3;
1494 for(
size_t i = 0; i < nvert; ++i, j+= 3 )
1495 vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
1504 coordIdx.
SetIndices( idxPlane.size(), &idxPlane[0] );
1511 for(
size_t i = 0; i < j; ++i )
1515 for(
size_t i = 0; i < j; ++i )
1521 if(
nullptr != modelColor )
1539 std::vector< int >::iterator sI = idxSide.begin();
1540 std::vector< int >::iterator eI = idxSide.end();
defines the basic data associated with a single 3D model.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
constexpr EDA_IU_SCALE pcbIUScale
@ BS_ITEM_TYPE_SILKSCREEN
@ BS_ITEM_TYPE_DIELECTRIC
@ BS_ITEM_TYPE_SOLDERMASK
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
Manage one layer needed to make a physical board.
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
wxString m_FinishType
The name of external copper finish.
Information pertinent to a Pcbnew printed circuit board.
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
FOOTPRINTS & Footprints()
int GetCopperLayerCount() const
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
VRML_COLOR & GetColor(VRML_COLOR_INDEX aIndex)
static CUSTOM_COLORS_LIST m_MaskColors
SGNODE * m_sgmaterial[VRML_COLOR_LAST]
static CUSTOM_COLORS_LIST m_PasteColors
static KIGFX::COLOR4D m_DefaultSolderPaste
VRML_LAYER m_top_soldermask
bool GetLayer3D(int layer, VRML_LAYER **vlayer)
bool SetScale(double aWorldScale)
SGNODE * getSGColor(VRML_COLOR_INDEX colorIdx)
void ComputeLayer3D_Zpos()
EXPORTER_PCB_VRML(BOARD *aBoard)
SHAPE_POLY_SET m_pcbOutlines
VRML_LAYER m_plated_holes
void SetLayerZ(int aLayer, double aValue)
void ExportVrmlPolygonSet(VRML_LAYER *aVlayer, const SHAPE_POLY_SET &aOutlines)
void create_vrml_shell(IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double top_z, double bottom_z)
void write_triangle_bag(std::ostream &aOut_file, const VRML_COLOR &aColor, VRML_LAYER *aLayer, bool aPlane, bool aTop, double aTop_z, double aBottom_z)
void initStaticColorList()
std::list< SGNODE * > m_components
static KIGFX::COLOR4D m_DefaultSilkscreen
static CUSTOM_COLORS_LIST m_SilkscreenColors
void SetOffset(double aXoff, double aYoff)
double GetLayerZ(int aLayer)
void ExportVrmlPadHole(PAD *aPad)
static CUSTOM_COLORS_LIST m_BoardColors
void create_vrml_plane(IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double aHeight, bool aTopPlane)
bool m_UseInlineModelsInBrdfile
wxString m_Subdir3DFpModels
static KIGFX::COLOR4D m_DefaultBoardBody
static CUSTOM_COLORS_LIST m_FinishColors
static KIGFX::COLOR4D m_DefaultSolderMask
double m_layer_z[PCB_LAYER_ID_COUNT]
bool m_UseRelPathIn3DModelFilename
void ExportVrmlFootprint(FOOTPRINT *aFootprint, std::ostream *aOutputFile)
bool ExportVRML_File(PROJECT *aProject, wxString *aMessages, const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Export a VRML file image of the board.
void ExportFp3DModelsAsLinkedFile(const wxString &aFullFileName)
VRML_LAYER m_bot_soldermask
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST]
void ExportVrmlSolderMask()
void writeLayers(const char *aFileName, OSTREAM *aOutputFile)
void ExportStandardLayers()
static KIGFX::COLOR4D m_DefaultSurfaceFinish
double m_BoardToVrmlScale
IFSG_TRANSFORM m_OutputPCB
void ExportVrmlViaHoles()
S3D_CACHE * m_Cache3Dmodels
Wrapper to expose an API for writing VRML files, without exposing all the many structures used in the...
EXPORTER_VRML(BOARD *aBoard)
EXPORTER_PCB_VRML * pcb_exporter
bool ExportVRML_File(PROJECT *aProject, wxString *aMessages, const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Exports the board and its footprint shapes 3D (vrml files only) as a vrml file.
wxString ResolvePath(const wxString &aFileName, const wxString &aWorkingPath)
Determines the full path of the given file name.
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
bool SetDiffuse(float aRVal, float aGVal, float aBVal)
bool SetSpecular(float aRVal, float aGVal, float aBVal)
bool SetShininess(float aShininess) noexcept
bool SetAmbient(float aRVal, float aGVal, float aBVal)
bool SetTransparency(float aTransparency) noexcept
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
bool NewNode(SGNODE *aParent) override
Function NewNode creates a new node to associate with this wrapper.
IFSG_COORDS is the wrapper for SGCOORDS.
bool NewNode(SGNODE *aParent) override
Function NewNode creates a new node to associate with this wrapper.
bool SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
bool AddCoord(double aXValue, double aYValue, double aZValue)
IFSG_FACESET is the wrapper for the SGFACESET class.
bool NewNode(SGNODE *aParent) override
Function NewNode creates a new node to associate with this wrapper.
bool AddIndex(int aIndex)
Function AddIndex adds a single index to the list.
bool SetIndices(size_t nIndices, int *aIndexList)
Function SetIndices sets the number of indices and creates a copy of the given index data.
bool SetParent(SGNODE *aParent)
Function SetParent sets the parent SGNODE of this object.
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
void Destroy(void)
Function Destroy deletes the object held by this wrapper.
bool AddChildNode(SGNODE *aNode)
Function AddChildNode adds a node as a child owned by this node.
bool AddRefNode(SGNODE *aNode)
Function AddRefNode adds a reference to an existing node which is not owned by (not a child of) this ...
IFSG_NORMALS is the wrapper for the SGNORMALS class.
bool NewNode(SGNODE *aParent) override
Function NewNode creates a new node to associate with this wrapper.
bool AddNormal(double aXValue, double aYValue, double aZValue)
IFSG_SHAPE is the wrapper for the SGSHAPE class.
bool NewNode(SGNODE *aParent) override
Function NewNode creates a new node to associate with this wrapper.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
PAD_DRILL_SHAPE_T GetDrillShape() const
const VECTOR2I & GetDrillSize() const
PAD_ATTRIB GetAttribute() const
VECTOR2I GetPosition() const override
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
bool ExportVRML_File(const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Create the file(s) exporting current BOARD to a VRML file.
Container for project specific data.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
FILENAME_RESOLVER * GetResolver() noexcept
SCENEGRAPH * Load(const wxString &aModelFile, const wxString &aBasePath)
Attempt to load the scene data for a model.
The base class of all Scene Graph nodes.
void SetVector(double aXVal, double aYVal, double aZVal)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST
static constexpr EDA_ANGLE & FULL_CIRCLE
#define ADD_COLOR(list, r, g, b, a, name)
static void build_quat(double x, double y, double z, double a, double q[4])
static void compose_quat(double q1[4], double q2[4], double qr[4])
static void from_quat(double q[4], double rot[4])
static bool g_ColorsLoaded
#define ERR_APPROX_MAX_MM
@ VRML_COLOR_TOP_SOLDMASK
@ VRML_COLOR_BOT_SOLDMASK
a few functions useful in geometry calculations.
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)
collects header files for all SG* wrappers and the API
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
SGLIB_API bool WriteVRML(const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes)
Function WriteVRML writes out the given node and its subnodes to a VRML2 file.
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
SGLIB_API SGVECTOR CalcTriNorm(const SGPOINT &p1, const SGPOINT &p2, const SGPOINT &p3)
Function CalcTriNorm returns the normal vector of a triangle described by vertices p1,...
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated
#define OPEN_OSTREAM(var, name)
#define CLOSE_STREAM(var)
A class to handle a custom color (predefined color) for the color picker dialog.
constexpr double IUTomm(int iu) const
constexpr int mmToIU(double mm) const
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
double DEG2RAD(double deg)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)