KiCad PCB EDA Suite
CINFO3D_VISU Class Reference

Class CINFO3D_VISU Helper class to handle information needed to display 3D board. More...

#include <cinfo3d_visu.h>

Public Member Functions

 CINFO3D_VISU ()
 
 ~CINFO3D_VISU ()
 
void Set3DCacheManager (S3D_CACHE *aCachePointer)
 Set3DCacheManager - Update the Cache manager pointer. More...
 
S3D_CACHEGet3DCacheManager () const
 Get3DCacheManager - Return the 3d cache manager pointer. More...
 
bool GetFlag (DISPLAY3D_FLG aFlag) const
 GetFlag - get a configuration status of a flag. More...
 
void SetFlag (DISPLAY3D_FLG aFlag, bool aState)
 SetFlag - set the status of a flag. More...
 
bool Is3DLayerEnabled (PCB_LAYER_ID aLayer) const
 Is3DLayerEnabled - Check if a layer is enabled. More...
 
bool ShouldModuleBeDisplayed (MODULE_ATTR_T aModuleAttributs) const
 ShouldModuleBeDisplayed - Test if module should be displayed in relation to attributs and the flags. More...
 
void SetBoard (BOARD *aBoard)
 SetBoard - Set current board to be rendered. More...
 
const BOARDGetBoard () const
 GetBoard - Get current board to be rendered. More...
 
void InitSettings (REPORTER *aStatusTextReporter)
 InitSettings - Function to be called by the render when it need to reload the settings for the board. More...
 
double BiuTo3Dunits () const
 BiuTo3Dunits - Board integer units To 3D units. More...
 
const CBBOXGetBBox3DU () const
 GetBBox3DU - Get the bbox of the pcb board. More...
 
float GetEpoxyThickness3DU () const
 GetEpoxyThickness3DU - Get the current epoxy thickness. More...
 
float GetNonCopperLayerThickness3DU () const
 GetNonCopperLayerThickness3DU - Get the current non copper layers thickness. More...
 
float GetCopperThickness3DU () const
 GetCopperThickness3DU - Get the current copper layer thickness. More...
 
int GetCopperThicknessBIU () const
 GetCopperThicknessBIU - Get the current copper layer thickness. More...
 
wxSize GetBoardSizeBIU () const
 GetBoardSizeBIU - Get the board size. More...
 
wxPoint GetBoardPosBIU () const
 GetBoardPosBIU - Get the board size. More...
 
const SFVEC3FGetBoardCenter3DU () const
 GetBoardCenter - the board center position in 3d units. More...
 
float GetModulesZcoord3DIU (bool aIsFlipped) const
 GetModulesZcoord3DIU - Get the position of the module in 3d integer units considering if it is flipped or not. More...
 
void CameraSetType (CAMERA_TYPE aCameraType)
 CameraSetType - Set the camera type to use. More...
 
CCAMERACameraGet () const
 CameraGet - get current camera in use. More...
 
GRID3D_TYPE GridGet () const
 GridGet - get the current grid. More...
 
void GridSet (GRID3D_TYPE aGridType)
 GridSet - set the current grid. More...
 
void RenderEngineSet (RENDER_ENGINE aRenderEngine)
 RenderEngineSet. More...
 
RENDER_ENGINE RenderEngineGet () const
 RenderEngineGet. More...
 
void MaterialModeSet (MATERIAL_MODE aMaterialMode)
 MaterialModeSet. More...
 
MATERIAL_MODE MaterialModeGet () const
 MaterialModeGet. More...
 
const SHAPE_POLY_SETGetBoardPoly () const
 GetBoardPoly - Get the current polygon of the epoxy board. More...
 
SFVEC3F GetLayerColor (PCB_LAYER_ID aLayerId) const
 GetLayerColor - get the technical color of a layer. More...
 
SFVEC3F GetItemColor (int aItemId) const
 GetItemColor - get the technical color of a layer. More...
 
SFVEC3F GetColor (COLOR4D aColor) const
 GetColor. More...
 
float GetLayerTopZpos3DU (PCB_LAYER_ID aLayerId) const
 GetLayerTopZpos3DU - Get the top z position. More...
 
float GetLayerBottomZpos3DU (PCB_LAYER_ID aLayerId) const
 GetLayerBottomZpos3DU - Get the bottom z position. More...
 
const MAP_CONTAINER_2DGetMapLayers () const
 GetMapLayers - Get the map of container that have the objects per layer. More...
 
const MAP_CONTAINER_2DGetMapLayersHoles () const
 GetMapLayersHoles -Get the map of container that have the holes per layer. More...
 
const CBVHCONTAINER2DGetThroughHole_Outer () const
 GetThroughHole_Outer - Get the inflated ThroughHole container. More...
 
const SHAPE_POLY_SETGetThroughHole_Outer_poly () const
 GetThroughHole_Outer_poly -. More...
 
const SHAPE_POLY_SETGetThroughHole_Outer_poly_NPTH () const
 GetThroughHole_Outer_poly_NPTH -. More...
 
const CBVHCONTAINER2DGetThroughHole_Vias_Outer () const
 GetThroughHole_Vias_Outer -. More...
 
const CBVHCONTAINER2DGetThroughHole_Vias_Inner () const
 GetThroughHole_Vias_Inner -. More...
 
const SHAPE_POLY_SETGetThroughHole_Vias_Outer_poly () const
 GetThroughHole_Vias_Outer_poly -. More...
 
const SHAPE_POLY_SETGetThroughHole_Vias_Inner_poly () const
 GetThroughHole_Vias_Inner_poly -. More...
 
const CBVHCONTAINER2DGetThroughHole_Inner () const
 GetThroughHole_Inner - Get the ThroughHole container. More...
 
const SHAPE_POLY_SETGetThroughHole_Inner_poly () const
 GetThroughHole_Inner_poly -. More...
 
unsigned int GetStats_Nr_Vias () const
 GetStats_Nr_Vias - Get statistics of the nr of vias. More...
 
unsigned int GetStats_Nr_Holes () const
 GetStats_Nr_Holes - Get statistics of the nr of holes. More...
 
float GetStats_Med_Via_Hole_Diameter3DU () const
 GetStats_Med_Via_Hole_Diameter3DU - Average diameter of the via holes. More...
 
float GetStats_Med_Hole_Diameter3DU () const
 GetStats_Med_Hole_Diameter3DU - Average diameter of holes. More...
 
float GetStats_Med_Track_Width () const
 GetStats_Med_Track_Width - Average width of the tracks. More...
 
unsigned int GetNrSegmentsCircle (float aDiameter3DU) const
 GetNrSegmentsCircle. More...
 
unsigned int GetNrSegmentsCircle (int aDiameterBIU) const
 GetNrSegmentsCircle. More...
 
double GetCircleCorrectionFactor (int aNrSides) const
 GetCircleCorrectionFactor - computes a angle correction factor used when creating circles. More...
 
const MAP_POLYGetPolyMap () const
 GetPolyMap - Get maps of polygons's layers. More...
 
const MAP_POLYGetPolyMapHoles_Inner () const
 
const MAP_POLYGetPolyMapHoles_Outer () const
 

Public Attributes

SFVEC3D m_BgColorBot
 background bottom color More...
 
SFVEC3D m_BgColorTop
 background top color More...
 
SFVEC3D m_BoardBodyColor
 in realistic mode: FR4 board color More...
 
SFVEC3D m_SolderMaskColorBot
 in realistic mode: solder mask color ( bot ) More...
 
SFVEC3D m_SolderMaskColorTop
 in realistic mode: solder mask color ( top ) More...
 
SFVEC3D m_SolderPasteColor
 in realistic mode: solder paste color More...
 
SFVEC3D m_SilkScreenColorBot
 in realistic mode: SilkScreen color ( bot ) More...
 
SFVEC3D m_SilkScreenColorTop
 in realistic mode: SilkScreen color ( top ) More...
 
SFVEC3D m_CopperColor
 in realistic mode: copper color More...
 

Private Member Functions

void createBoardPolygon ()
 
void createLayers (REPORTER *aStatusTextReporter)
 
void destroyLayers ()
 
COBJECT2DcreateNewTrack (const TRACK *aTrack, int aClearanceValue) const
 
void createNewPadWithClearance (const D_PAD *aPad, CGENERICCONTAINER2D *aDstContainer, wxSize aClearanceValue) const
 
COBJECT2DcreateNewPadDrill (const D_PAD *aPad, int aInflateValue)
 
void AddPadsShapesWithClearanceToContainer (const MODULE *aModule, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aInflateValue, bool aSkipNPTHPadsWihNoCopper)
 
void AddGraphicsShapesWithClearanceToContainer (const MODULE *aModule, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aInflateValue)
 
void AddShapeWithClearanceToContainer (const TEXTE_PCB *aTextPCB, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue)
 
void AddShapeWithClearanceToContainer (const DRAWSEGMENT *aDrawSegment, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue)
 
void AddShapeWithClearanceToContainer (const DIMENSION *aDimension, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue)
 
void AddSolidAreasShapesToContainer (const ZONE_CONTAINER *aZoneContainer, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId)
 
void TransformArcToSegments (const wxPoint &aCentre, const wxPoint &aStart, double aArcAngle, int aCircleToSegmentsCount, int aWidth, CGENERICCONTAINER2D *aDstContainer, const BOARD_ITEM &aBoardItem)
 
void buildPadShapeThickOutlineAsSegments (const D_PAD *aPad, CGENERICCONTAINER2D *aDstContainer, int aWidth)
 
void buildPadShapeThickOutlineAsPolygon (const D_PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, int aWidth) const
 
void transformPadsShapesWithClearanceToPolygon (const PADS &aPads, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, bool aSkipNPTHPadsWihNoCopper) const
 
void transformGraphicModuleEdgeToPolygonSet (const MODULE *aModule, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer) const
 
void buildPadShapePolygon (const D_PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue) const
 

Private Attributes

BOARDm_board
 Current board. More...
 
S3D_CACHEm_3d_model_manager
 pointer to the 3d model manager More...
 
std::vector< bool > m_drawFlags
 options flags to render the board More...
 
GRID3D_TYPE m_3D_grid_type
 Stores the current grid type. More...
 
RENDER_ENGINE m_render_engine
 render engine currently on use More...
 
MATERIAL_MODE m_material_mode
 mode to render the 3d shape models material More...
 
wxPoint m_boardPos
 center board actual position in board units More...
 
wxSize m_boardSize
 board actual size in board units More...
 
SFVEC3F m_boardCenter
 3d center position of the pcb board in 3d units More...
 
CBBOX m_boardBoundingBox
 3d bounding box of the pcb board in 3d units More...
 
MAP_POLY m_layers_poly
 It contains polygon contours for each layer. More...
 
MAP_POLY m_layers_outer_holes_poly
 It contains polygon contours for holes of each layer (outer holes) More...
 
MAP_POLY m_layers_inner_holes_poly
 It contains polygon contours for holes of each layer (inner holes) More...
 
SHAPE_POLY_SET m_through_outer_holes_poly_NPTH
 It contains polygon contours for (just) non plated through holes (outer cylinder) More...
 
SHAPE_POLY_SET m_through_outer_holes_poly
 It contains polygon contours for through holes (outer cylinder) More...
 
SHAPE_POLY_SET m_through_inner_holes_poly
 It contains polygon contours for through holes (inner cylinder) More...
 
SHAPE_POLY_SET m_through_outer_holes_vias_poly
 It contains polygon contours for through holes vias (outer cylinder) More...
 
SHAPE_POLY_SET m_through_inner_holes_vias_poly
 It contains polygon contours for through holes vias (inner cylinder) More...
 
SHAPE_POLY_SET m_board_poly
 PCB board outline polygon. More...
 
MAP_CONTAINER_2D m_layers_container2D
 It contains the 2d elements of each layer. More...
 
MAP_CONTAINER_2D m_layers_holes2D
 It contains the holes per each layer. More...
 
CBVHCONTAINER2D m_through_holes_outer
 It contains the list of throughHoles of the board, the radius of the hole is inflated with the copper tickness. More...
 
CBVHCONTAINER2D m_through_holes_inner
 It contains the list of throughHoles of the board, the radius is the inner hole. More...
 
CBVHCONTAINER2D m_through_holes_vias_outer
 It contains the list of throughHoles vias of the board, the radius of the hole is inflated with the copper tickness. More...
 
CBVHCONTAINER2D m_through_holes_vias_inner
 It contains the list of throughHoles vias of the board, the radius of the hole. More...
 
unsigned int m_copperLayersCount
 Number of copper layers actually used by the board. More...
 
double m_biuTo3Dunits
 Normalization scale to convert board internal units to 3D units to normalize 3D units between -1.0 and +1.0. More...
 
float m_layerZcoordTop [PCB_LAYER_ID_COUNT]
 Top (End) Z position of each layer (normalized) More...
 
float m_layerZcoordBottom [PCB_LAYER_ID_COUNT]
 Bottom (Start) Z position of each layer (normalized) More...
 
float m_copperThickness3DU
 Copper thickness (normalized) More...
 
float m_epoxyThickness3DU
 Epoxy thickness (normalized) More...
 
float m_nonCopperLayerThickness3DU
 Non copper layers thickness. More...
 
CCAMERAm_currentCamera
 Holds a pointer to current camera in use. More...
 
CTRACK_BALL m_trackBallCamera
 
float m_calc_seg_min_factor3DU
 min factor used for cicle segment approximation calculation More...
 
float m_calc_seg_max_factor3DU
 max factor used for cicle segment approximation calculation More...
 
unsigned int m_stats_nr_tracks
 Number of tracks in the board. More...
 
float m_stats_track_med_width
 Track average width. More...
 
unsigned int m_stats_nr_vias
 Nr of vias. More...
 
float m_stats_via_med_hole_diameter
 Computed medium diameter of the via holes in 3D units. More...
 
unsigned int m_stats_nr_holes
 number of holes in the board More...
 
float m_stats_hole_med_diameter
 Computed medium diameter of the holes in 3D units. More...
 

Static Private Attributes

static const wxChar * m_logTrace = wxT( "KI_TRACE_EDA_CINFO3D_VISU" )
 Trace mask used to enable or disable the trace output of this class. More...
 

Detailed Description

Class CINFO3D_VISU Helper class to handle information needed to display 3D board.

Definition at line 70 of file cinfo3d_visu.h.

Constructor & Destructor Documentation

◆ CINFO3D_VISU()

CINFO3D_VISU::CINFO3D_VISU ( )

Definition at line 51 of file cinfo3d_visu.cpp.

51  :
54 {
55  wxLogTrace( m_logTrace, wxT( "CINFO3D_VISU::CINFO3D_VISU" ) );
56 
57  m_board = NULL;
60  m_drawFlags.resize( FL_LAST, false );
61 
64 
65  m_boardPos = wxPoint();
66  m_boardSize = wxSize();
67  m_boardCenter = SFVEC3F( 0.0f );
68 
70 
71  m_layers_container2D.clear();
72  m_layers_holes2D.clear();
75 
77  m_epoxyThickness3DU = 0.0f;
78  m_copperThickness3DU = 0.0f;
80  m_biuTo3Dunits = 1.0;
81 
83  m_stats_nr_vias = 0;
85  m_stats_nr_holes = 0;
88 
91 
92 
93  memset( m_layerZcoordTop, 0, sizeof( m_layerZcoordTop ) );
94  memset( m_layerZcoordBottom, 0, sizeof( m_layerZcoordBottom ) );
95 
98  SetFlag( FL_SHOW_BOARD_BODY, true );
103  SetFlag( FL_ZONE, true );
104  SetFlag( FL_SILKSCREEN, true );
105  SetFlag( FL_SOLDERMASK, true );
106 
107  m_BgColorBot = SFVEC3D( 0.4, 0.4, 0.5 );
108  m_BgColorTop = SFVEC3D( 0.8, 0.8, 0.9 );
109  m_BoardBodyColor = SFVEC3D( 0.4, 0.4, 0.5 );
110  m_SolderMaskColorTop = SFVEC3D( 0.1, 0.2, 0.1 );
111  m_SolderMaskColorBot = SFVEC3D( 0.1, 0.2, 0.1 );
112  m_SolderPasteColor = SFVEC3D( 0.4, 0.4, 0.4 );
113  m_SilkScreenColorTop = SFVEC3D( 0.9, 0.9, 0.9 );
114  m_SilkScreenColorBot = SFVEC3D( 0.9, 0.9, 0.9 );
115  m_CopperColor = SFVEC3D( 0.75, 0.61, 0.23 );
116 }
CBBOX m_boardBoundingBox
3d bounding box of the pcb board in 3d units
Definition: cinfo3d_visu.h:547
wxPoint m_boardPos
center board actual position in board units
Definition: cinfo3d_visu.h:535
SFVEC3D m_CopperColor
in realistic mode: copper color
Definition: cinfo3d_visu.h:505
SFVEC3D m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
Definition: cinfo3d_visu.h:500
float m_calc_seg_min_factor3DU
min factor used for cicle segment approximation calculation
Definition: cinfo3d_visu.h:634
MATERIAL_MODE m_material_mode
mode to render the 3d shape models material
Definition: cinfo3d_visu.h:529
SFVEC3D m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
Definition: cinfo3d_visu.h:501
float m_calc_seg_max_factor3DU
max factor used for cicle segment approximation calculation
Definition: cinfo3d_visu.h:637
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: cinfo3d_visu.h:63
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
unsigned int m_stats_nr_holes
number of holes in the board
Definition: cinfo3d_visu.h:655
SFVEC3D m_BgColorBot
background bottom color
Definition: cinfo3d_visu.h:497
SFVEC3D m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
Definition: cinfo3d_visu.h:504
float m_nonCopperLayerThickness3DU
Non copper layers thickness.
Definition: cinfo3d_visu.h:624
std::vector< bool > m_drawFlags
options flags to render the board
Definition: cinfo3d_visu.h:520
CBVHCONTAINER2D m_through_holes_inner
It contains the list of throughHoles of the board, the radius is the inner hole.
Definition: cinfo3d_visu.h:591
float m_stats_via_med_hole_diameter
Computed medium diameter of the via holes in 3D units.
Definition: cinfo3d_visu.h:652
SFVEC3D m_BgColorTop
background top color
Definition: cinfo3d_visu.h:498
MAP_CONTAINER_2D m_layers_container2D
It contains the 2d elements of each layer.
Definition: cinfo3d_visu.h:580
float m_epoxyThickness3DU
Epoxy thickness (normalized)
Definition: cinfo3d_visu.h:621
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:499
float m_stats_hole_med_diameter
Computed medium diameter of the holes in 3D units.
Definition: cinfo3d_visu.h:658
SFVEC3D m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
Definition: cinfo3d_visu.h:503
#define NULL
unsigned int m_stats_nr_vias
Nr of vias.
Definition: cinfo3d_visu.h:649
Use all material properties from model file.
SFVEC3F m_boardCenter
3d center position of the pcb board in 3d units
Definition: cinfo3d_visu.h:541
wxSize m_boardSize
board actual size in board units
Definition: cinfo3d_visu.h:538
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
glm::dvec3 SFVEC3D
Definition: xv3d_types.h:48
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: cinfo3d_visu.h:666
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
Definition: cinfo3d_visu.h:502
CCAMERA & m_currentCamera
Holds a pointer to current camera in use.
Definition: cinfo3d_visu.h:630
S3D_CACHE * m_3d_model_manager
pointer to the 3d model manager
Definition: cinfo3d_visu.h:514
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
float m_copperThickness3DU
Copper thickness (normalized)
Definition: cinfo3d_visu.h:618
float m_stats_track_med_width
Track average width.
Definition: cinfo3d_visu.h:646
unsigned int m_copperLayersCount
Number of copper layers actually used by the board.
Definition: cinfo3d_visu.h:605
MAP_CONTAINER_2D m_layers_holes2D
It contains the holes per each layer.
Definition: cinfo3d_visu.h:583
RENDER_ENGINE m_render_engine
render engine currently on use
Definition: cinfo3d_visu.h:526
float m_layerZcoordBottom[PCB_LAYER_ID_COUNT]
Bottom (Start) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:615
CTRACK_BALL m_trackBallCamera
Definition: cinfo3d_visu.h:631
GRID3D_TYPE m_3D_grid_type
Stores the current grid type.
Definition: cinfo3d_visu.h:523
float m_layerZcoordTop[PCB_LAYER_ID_COUNT]
Top (End) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:612
CBVHCONTAINER2D m_through_holes_outer
It contains the list of throughHoles of the board, the radius of the hole is inflated with the copper...
Definition: cinfo3d_visu.h:587
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
void Reset()
Function Reset reset the bounding box to zero and de-initialized it.
Definition: cbbox.cpp:98
unsigned int m_stats_nr_tracks
Number of tracks in the board.
Definition: cinfo3d_visu.h:643

References CGENERICCONTAINER2D::Clear(), FL_LAST, FL_MODULE_ATTRIBUTES_NORMAL, FL_MODULE_ATTRIBUTES_NORMAL_INSERT, FL_MODULE_ATTRIBUTES_VIRTUAL, FL_RENDER_OPENGL_COPPER_THICKNESS, FL_SHOW_BOARD_BODY, FL_SILKSCREEN, FL_SOLDERMASK, FL_USE_REALISTIC_MODE, FL_ZONE, m_3D_grid_type, m_3d_model_manager, m_BgColorBot, m_BgColorTop, m_biuTo3Dunits, m_board, m_BoardBodyColor, m_boardBoundingBox, m_boardCenter, m_boardPos, m_boardSize, m_calc_seg_max_factor3DU, m_calc_seg_min_factor3DU, m_CopperColor, m_copperLayersCount, m_copperThickness3DU, m_drawFlags, m_epoxyThickness3DU, m_layers_container2D, m_layers_holes2D, m_layerZcoordBottom, m_layerZcoordTop, m_logTrace, m_material_mode, m_nonCopperLayerThickness3DU, m_render_engine, m_SilkScreenColorBot, m_SilkScreenColorTop, m_SolderMaskColorBot, m_SolderMaskColorTop, m_SolderPasteColor, m_stats_hole_med_diameter, m_stats_nr_holes, m_stats_nr_tracks, m_stats_nr_vias, m_stats_track_med_width, m_stats_via_med_hole_diameter, m_through_holes_inner, m_through_holes_outer, NONE, NORMAL, NULL, OPENGL_LEGACY, CBBOX::Reset(), and SetFlag().

◆ ~CINFO3D_VISU()

CINFO3D_VISU::~CINFO3D_VISU ( )

Definition at line 119 of file cinfo3d_visu.cpp.

120 {
121  destroyLayers();
122 }

References destroyLayers().

Member Function Documentation

◆ AddGraphicsShapesWithClearanceToContainer()

void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer ( const MODULE aModule,
CGENERICCONTAINER2D aDstContainer,
PCB_LAYER_ID  aLayerId,
int  aInflateValue 
)
private

Definition at line 171 of file create_3Dgraphic_brd_items.cpp.

175 {
176  std::vector<TEXTE_MODULE *> texts; // List of TEXTE_MODULE to convert
177  EDGE_MODULE* outline;
178 
179  for( auto item : aModule->GraphicalItems() )
180  {
181  switch( item->Type() )
182  {
183  case PCB_MODULE_TEXT_T:
184  {
185  TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
186 
187  if( text->GetLayer() == aLayerId && text->IsVisible() )
188  texts.push_back( text );
189  }
190  break;
191 
192 
193  case PCB_MODULE_EDGE_T:
194  {
195  outline = (EDGE_MODULE*) item;
196 
197  if( outline->GetLayer() != aLayerId )
198  break;
199 
201  aDstContainer,
202  aLayerId, 0 );
203  }
204  break;
205 
206  default:
207  break;
208  }
209  }
210 
211  // Convert texts sur modules
212  if( aModule->Reference().GetLayer() == aLayerId && aModule->Reference().IsVisible() )
213  texts.push_back( &aModule->Reference() );
214 
215  if( aModule->Value().GetLayer() == aLayerId && aModule->Value().IsVisible() )
216  texts.push_back( &aModule->Value() );
217 
218  s_boardItem = (const BOARD_ITEM *)&aModule->Value();
219  s_dstcontainer = aDstContainer;
221 
222  for( TEXTE_MODULE* text : texts )
223  {
224  s_textWidth = text->GetThickness() + ( 2 * aInflateValue );
225  wxSize size = text->GetTextSize();
226 
227  if( text->IsMirrored() )
228  size.x = -size.x;
229 
230  GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
231  size, text->GetHorizJustify(), text->GetVertJustify(), text->GetThickness(),
232  text->IsItalic(), true, addTextSegmToContainer );
233  }
234 }
void AddShapeWithClearanceToContainer(const TEXTE_PCB *aTextPCB, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue)
TEXTE_MODULE & Reference()
Definition: class_module.h:477
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:184
bool IsMirrored() const
Definition: eda_text.h:173
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
bool IsVisible() const
Definition: eda_text.h:170
int GetThickness() const
Return the pen width.
Definition: eda_text.h:148
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
virtual wxString GetShownText() const override
Return the string actually shown after processing of the base text.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
static int s_textWidth
bool IsItalic() const
Definition: eda_text.h:164
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:183
#define NULL
static float s_biuTo3Dunits
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:476
const wxSize & GetTextSize() const
Definition: eda_text.h:223
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
static CGENERICCONTAINER2D * s_dstcontainer
void GRText(wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function GRText Draw a graphic text (like module texts)
Definition: gr_text.cpp:143
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
void addTextSegmToContainer(int x0, int y0, int xf, int yf, void *aData)
const wxPoint & GetTextPos() const
Definition: eda_text.h:232
Definition: colors.h:45
static const BOARD_ITEM * s_boardItem
double GetDrawRotation() const
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References AddShapeWithClearanceToContainer(), addTextSegmToContainer(), BLACK, BOARD_ITEM::GetLayer(), MODULE::GraphicalItems(), GRText(), EDA_TEXT::IsVisible(), m_biuTo3Dunits, NULL, PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, MODULE::Reference(), s_biuTo3Dunits, s_boardItem, s_dstcontainer, s_textWidth, and MODULE::Value().

Referenced by createLayers().

◆ AddPadsShapesWithClearanceToContainer()

void CINFO3D_VISU::AddPadsShapesWithClearanceToContainer ( const MODULE aModule,
CGENERICCONTAINER2D aDstContainer,
PCB_LAYER_ID  aLayerId,
int  aInflateValue,
bool  aSkipNPTHPadsWihNoCopper 
)
private

Definition at line 571 of file create_3Dgraphic_brd_items.cpp.

576 {
577  wxSize margin;
578 
579  for( auto pad : aModule->Pads() )
580  {
581  if( !pad->IsOnLayer( aLayerId ) )
582  continue;
583 
584  // NPTH pads are not drawn on layers if the
585  // shape size and pos is the same as their hole:
586  if( aSkipNPTHPadsWihNoCopper && (pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED) )
587  {
588  if( (pad->GetDrillSize() == pad->GetSize()) &&
589  (pad->GetOffset() == wxPoint( 0, 0 )) )
590  {
591  switch( pad->GetShape() )
592  {
593  case PAD_SHAPE_CIRCLE:
594  if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
595  continue;
596  break;
597 
598  case PAD_SHAPE_OVAL:
599  if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE )
600  continue;
601  break;
602 
603  default:
604  break;
605  }
606  }
607  }
608 
609  switch( aLayerId )
610  {
611  case F_Mask:
612  case B_Mask:
613  margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue;
614  break;
615 
616  case F_Paste:
617  case B_Paste:
618  margin = pad->GetSolderPasteMargin();
619  margin.x += aInflateValue;
620  margin.y += aInflateValue;
621  break;
622 
623  default:
624  margin.x = margin.y = aInflateValue;
625  break;
626  }
627 
628  createNewPadWithClearance( pad, aDstContainer, margin );
629  }
630 }
void createNewPadWithClearance(const D_PAD *aPad, CGENERICCONTAINER2D *aDstContainer, wxSize aClearanceValue) const
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
PADS & Pads()
Definition: class_module.h:173

References B_Mask, B_Paste, createNewPadWithClearance(), F_Mask, F_Paste, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_DRILL_SHAPE_CIRCLE, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, and MODULE::Pads().

Referenced by createLayers().

◆ AddShapeWithClearanceToContainer() [1/3]

void CINFO3D_VISU::AddShapeWithClearanceToContainer ( const TEXTE_PCB aTextPCB,
CGENERICCONTAINER2D aDstContainer,
PCB_LAYER_ID  aLayerId,
int  aClearanceValue 
)
private

Definition at line 90 of file create_3Dgraphic_brd_items.cpp.

94 {
95  wxSize size = aText->GetTextSize();
96 
97  if( aText->IsMirrored() )
98  size.x = -size.x;
99 
100  s_boardItem = (const BOARD_ITEM *) &aText;
101  s_dstcontainer = aDstContainer;
102  s_textWidth = aText->GetThickness() + ( 2 * aClearanceValue );
104 
105  // not actually used, but needed by GRText
106  const COLOR4D dummy_color = COLOR4D::BLACK;
107 
108  if( aText->IsMultilineAllowed() )
109  {
110  wxArrayString strings_list;
111  wxStringSplit( aText->GetShownText(), strings_list, '\n' );
112  std::vector<wxPoint> positions;
113  positions.reserve( strings_list.Count() );
114  aText->GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
115 
116  for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
117  {
118  wxString txt = strings_list.Item( ii );
119 
120  GRText( NULL, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
121  aText->GetHorizJustify(), aText->GetVertJustify(), aText->GetThickness(),
122  aText->IsItalic(), true, addTextSegmToContainer );
123  }
124  }
125  else
126  {
127  GRText( NULL, aText->GetTextPos(), dummy_color, aText->GetShownText(),
128  aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
129  aText->GetThickness(), aText->IsItalic(), true, addTextSegmToContainer );
130  }
131 }
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: common.cpp:186
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
static int s_textWidth
#define NULL
static float s_biuTo3Dunits
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
static CGENERICCONTAINER2D * s_dstcontainer
void GRText(wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function GRText Draw a graphic text (like module texts)
Definition: gr_text.cpp:143
void addTextSegmToContainer(int x0, int y0, int xf, int yf, void *aData)
Definition: colors.h:45
static const BOARD_ITEM * s_boardItem
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References addTextSegmToContainer(), BLACK, EDA_TEXT::GetHorizJustify(), EDA_TEXT::GetPositionsOfLinesOfMultilineText(), EDA_TEXT::GetShownText(), EDA_TEXT::GetTextAngle(), EDA_TEXT::GetTextPos(), EDA_TEXT::GetTextSize(), EDA_TEXT::GetThickness(), EDA_TEXT::GetVertJustify(), GRText(), EDA_TEXT::IsItalic(), EDA_TEXT::IsMirrored(), EDA_TEXT::IsMultilineAllowed(), m_biuTo3Dunits, NULL, s_biuTo3Dunits, s_boardItem, s_dstcontainer, s_textWidth, and wxStringSplit().

Referenced by AddGraphicsShapesWithClearanceToContainer(), AddShapeWithClearanceToContainer(), and createLayers().

◆ AddShapeWithClearanceToContainer() [2/3]

void CINFO3D_VISU::AddShapeWithClearanceToContainer ( const DRAWSEGMENT aDrawSegment,
CGENERICCONTAINER2D aDstContainer,
PCB_LAYER_ID  aLayerId,
int  aClearanceValue 
)
private

Definition at line 711 of file create_3Dgraphic_brd_items.cpp.

715 {
716  // The full width of the lines to create
717  // The extra 1 protects the inner/outer radius values from degeneracy
718  const int linewidth = aDrawSegment->GetWidth() + (2 * aClearanceValue) + 1;
719 
720  switch( aDrawSegment->GetShape() )
721  {
722  case S_CIRCLE:
723  {
724  const SFVEC2F center3DU( aDrawSegment->GetCenter().x * m_biuTo3Dunits,
725  -aDrawSegment->GetCenter().y * m_biuTo3Dunits );
726 
727  float inner_radius = ( aDrawSegment->GetRadius() - linewidth / 2 ) * m_biuTo3Dunits;
728  float outer_radius = ( aDrawSegment->GetRadius() + linewidth / 2 ) * m_biuTo3Dunits;
729 
730  if( inner_radius < 0 )
731  inner_radius = 0;
732 
733  aDstContainer->Add( new CRING2D( center3DU, inner_radius, outer_radius, *aDrawSegment ) );
734  }
735  break;
736 
737  case S_ARC:
738  {
739  const unsigned int nr_segments =
740  GetNrSegmentsCircle( aDrawSegment->GetBoundingBox().GetSizeMax() );
741 
742  TransformArcToSegments( aDrawSegment->GetCenter(),
743  aDrawSegment->GetArcStart(),
744  aDrawSegment->GetAngle(),
745  nr_segments,
746  aDrawSegment->GetWidth(),
747  aDstContainer,
748  *aDrawSegment );
749  }
750  break;
751 
752  case S_SEGMENT:
753  {
754  const SFVEC2F start3DU( aDrawSegment->GetStart().x * m_biuTo3Dunits,
755  -aDrawSegment->GetStart().y * m_biuTo3Dunits );
756 
757  const SFVEC2F end3DU ( aDrawSegment->GetEnd().x * m_biuTo3Dunits,
758  -aDrawSegment->GetEnd().y * m_biuTo3Dunits );
759 
760  if( Is_segment_a_circle( start3DU, end3DU ) )
761  {
762  aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU,
763  ( linewidth / 2 ) * m_biuTo3Dunits,
764  *aDrawSegment ) );
765  }
766  else
767  {
768  aDstContainer->Add( new CROUNDSEGMENT2D( start3DU,
769  end3DU,
770  linewidth * m_biuTo3Dunits,
771  *aDrawSegment ) );
772  }
773  }
774  break;
775 
776  case S_CURVE:
777  case S_POLYGON:
778  {
779  SHAPE_POLY_SET polyList;
780 
781  aDrawSegment->TransformShapeWithClearanceToPolygon( polyList, aClearanceValue );
782 
783  polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
784 
785  if( polyList.IsEmpty() ) // Just for caution
786  break;
787 
788  Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer,
789  m_biuTo3Dunits, *aDrawSegment );
790  }
791  break;
792 
793  default:
794  break;
795  }
796 }
const wxPoint GetCenter() const override
Function GetCenter()
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the draw segment to a closed polygon Used in fi...
STROKE_T GetShape() const
unsigned int GetNrSegmentsCircle(float aDiameter3DU) const
GetNrSegmentsCircle.
polygon (not yet used for tracks, but could be in microwave apps)
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
void TransformArcToSegments(const wxPoint &aCentre, const wxPoint &aStart, double aArcAngle, int aCircleToSegmentsCount, int aWidth, CGENERICCONTAINER2D *aDstContainer, const BOARD_ITEM &aBoardItem)
usual segment : line with rounded ends
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
SHAPE_POLY_SET.
Arcs (with rounded ends)
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
const wxPoint & GetArcStart() const
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Bezier Curve.
int GetWidth() const
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
double GetAngle() const
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
int GetSizeMax() const
GetSizeMax.
Definition: eda_rect.h:109
void Convert_shape_line_polygon_to_triangles(SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References CGENERICCONTAINER2D::Add(), Convert_shape_line_polygon_to_triangles(), DRAWSEGMENT::GetAngle(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetBoundingBox(), DRAWSEGMENT::GetCenter(), DRAWSEGMENT::GetEnd(), GetNrSegmentsCircle(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::GetShape(), EDA_RECT::GetSizeMax(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::GetWidth(), Is_segment_a_circle(), SHAPE_POLY_SET::IsEmpty(), m_biuTo3Dunits, SHAPE_POLY_SET::PM_FAST, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, SHAPE_POLY_SET::Simplify(), TransformArcToSegments(), DRAWSEGMENT::TransformShapeWithClearanceToPolygon(), wxPoint::x, and wxPoint::y.

◆ AddShapeWithClearanceToContainer() [3/3]

void CINFO3D_VISU::AddShapeWithClearanceToContainer ( const DIMENSION aDimension,
CGENERICCONTAINER2D aDstContainer,
PCB_LAYER_ID  aLayerId,
int  aClearanceValue 
)
private

Definition at line 134 of file create_3Dgraphic_brd_items.cpp.

138 {
139  AddShapeWithClearanceToContainer(&aDimension->Text(), aDstContainer, aLayerId, aClearanceValue);
140 
141  const int linewidth = aDimension->GetWidth() + (2 * aClearanceValue);
142 
143  std::pair<wxPoint const *, wxPoint const *> segs[] = {
144  {&aDimension->m_crossBarO, &aDimension->m_crossBarF},
145  {&aDimension->m_featureLineGO, &aDimension->m_featureLineGF},
146  {&aDimension->m_featureLineDO, &aDimension->m_featureLineDF},
147  {&aDimension->m_crossBarF, &aDimension->m_arrowD1F},
148  {&aDimension->m_crossBarF, &aDimension->m_arrowD2F},
149  {&aDimension->m_crossBarO, &aDimension->m_arrowG1F},
150  {&aDimension->m_crossBarO, &aDimension->m_arrowG2F}};
151 
152  for( auto const & ii : segs )
153  {
154  const SFVEC2F start3DU( ii.first->x * m_biuTo3Dunits,
155  -ii.first->y * m_biuTo3Dunits );
156 
157  const SFVEC2F end3DU ( ii.second->x * m_biuTo3Dunits,
158  -ii.second->y * m_biuTo3Dunits );
159 
160  aDstContainer->Add( new CROUNDSEGMENT2D( start3DU,
161  end3DU,
162  linewidth * m_biuTo3Dunits,
163  *aDimension ) );
164  }
165 }
void AddShapeWithClearanceToContainer(const TEXTE_PCB *aTextPCB, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue)
int GetWidth() const
wxPoint m_crossBarF
wxPoint m_arrowD1F
wxPoint m_featureLineDF
wxPoint m_featureLineGO
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
wxPoint m_arrowG1F
wxPoint m_arrowD2F
wxPoint m_arrowG2F
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
TEXTE_PCB & Text()
wxPoint m_crossBarO
wxPoint m_featureLineDO
wxPoint m_featureLineGF

References CGENERICCONTAINER2D::Add(), AddShapeWithClearanceToContainer(), DIMENSION::GetWidth(), DIMENSION::m_arrowD1F, DIMENSION::m_arrowD2F, DIMENSION::m_arrowG1F, DIMENSION::m_arrowG2F, m_biuTo3Dunits, DIMENSION::m_crossBarF, DIMENSION::m_crossBarO, DIMENSION::m_featureLineDF, DIMENSION::m_featureLineDO, DIMENSION::m_featureLineGF, DIMENSION::m_featureLineGO, and DIMENSION::Text().

◆ AddSolidAreasShapesToContainer()

void CINFO3D_VISU::AddSolidAreasShapesToContainer ( const ZONE_CONTAINER aZoneContainer,
CGENERICCONTAINER2D aDstContainer,
PCB_LAYER_ID  aLayerId 
)
private

Definition at line 802 of file create_3Dgraphic_brd_items.cpp.

805 {
806  // Copy the polys list because we have to simplify it
807  SHAPE_POLY_SET polyList = SHAPE_POLY_SET( aZoneContainer->GetFilledPolysList(), true );
808 
809  // This convert the poly in outline and holes
810  Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits,
811  *aZoneContainer );
812 
813  // add filled areas outlines, which are drawn with thick lines segments
814  // but only if filled polygons outlines have thickness
815  if( !aZoneContainer->GetFilledPolysUseThickness() )
816  return;
817 
818  float line_thickness = aZoneContainer->GetMinThickness() * m_biuTo3Dunits;
819 
820  for( int i = 0; i < polyList.OutlineCount(); ++i )
821  {
822  // Add outline
823  const SHAPE_LINE_CHAIN& pathOutline = polyList.COutline( i );
824 
825  for( int j = 0; j < pathOutline.PointCount(); ++j )
826  {
827  const VECTOR2I& a = pathOutline.CPoint( j );
828  const VECTOR2I& b = pathOutline.CPoint( j + 1 );
829 
830  SFVEC2F start3DU( a.x * m_biuTo3Dunits, -a.y * m_biuTo3Dunits );
831  SFVEC2F end3DU ( b.x * m_biuTo3Dunits, -b.y * m_biuTo3Dunits );
832 
833  if( Is_segment_a_circle( start3DU, end3DU ) )
834  {
835  float radius = line_thickness/2;
836 
837  if( radius > 0.0 ) // degenerated circles crash 3D viewer
838  aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU, radius,
839  *aZoneContainer ) );
840  }
841  else
842  {
843  aDstContainer->Add( new CROUNDSEGMENT2D( start3DU, end3DU, line_thickness,
844  *aZoneContainer ) );
845  }
846  }
847 
848  // Add holes (of the poly, ie: the open parts) for this outline
849  for( int h = 0; h < polyList.HoleCount( i ); ++h )
850  {
851  const SHAPE_LINE_CHAIN& pathHole = polyList.CHole( i, h );
852 
853  for( int j = 0; j < pathHole.PointCount(); j++ )
854  {
855  const VECTOR2I& a = pathHole.CPoint( j );
856  const VECTOR2I& b = pathHole.CPoint( j + 1 );
857 
858  SFVEC2F start3DU( a.x * m_biuTo3Dunits, -a.y * m_biuTo3Dunits );
859  SFVEC2F end3DU ( b.x * m_biuTo3Dunits, -b.y * m_biuTo3Dunits );
860 
861  if( Is_segment_a_circle( start3DU, end3DU ) )
862  {
863  float radius = line_thickness/2;
864 
865  if( radius > 0.0 ) // degenerated circles crash 3D viewer
866  aDstContainer->Add(
867  new CFILLEDCIRCLE2D( start3DU, radius,
868  *aZoneContainer ) );
869  }
870  else
871  {
872  aDstContainer->Add(
873  new CROUNDSEGMENT2D( start3DU, end3DU, line_thickness,
874  *aZoneContainer ) );
875  }
876  }
877  }
878  }
879 }
int OutlineCount() const
Returns the number of outlines in the set
bool GetFilledPolysUseThickness() const
Definition: class_zone.h:599
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
SHAPE_POLY_SET.
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
int HoleCount(int aOutline) const
Returns the number of holes in a given outline
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetMinThickness() const
Definition: class_zone.h:186
void Convert_shape_line_polygon_to_triangles(SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)
const SHAPE_POLY_SET & GetFilledPolysList() const
Function GetFilledPolysList returns a reference to the list of filled polygons.
Definition: class_zone.h:553

References CGENERICCONTAINER2D::Add(), SHAPE_POLY_SET::CHole(), Convert_shape_line_polygon_to_triangles(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), ZONE_CONTAINER::GetFilledPolysList(), ZONE_CONTAINER::GetFilledPolysUseThickness(), ZONE_CONTAINER::GetMinThickness(), SHAPE_POLY_SET::HoleCount(), Is_segment_a_circle(), m_biuTo3Dunits, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by createLayers().

◆ BiuTo3Dunits()

double CINFO3D_VISU::BiuTo3Dunits ( ) const
inline

BiuTo3Dunits - Board integer units To 3D units.

Returns
the conversion factor to transform a position from the board to 3d units

Definition at line 141 of file cinfo3d_visu.h.

141 { return m_biuTo3Dunits; }
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609

References m_biuTo3Dunits.

Referenced by createLayers(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), C3D_RENDER_OGL_LEGACY::generate_holes_display_list(), C3D_RENDER_OGL_LEGACY::generate_new_3DGrid(), C3D_RENDER_RAYTRACING::insert3DPadHole(), C3D_RENDER_RAYTRACING::insert3DViaHole(), C3D_RENDER_RAYTRACING::load_3D_models(), C3D_RENDER_OGL_LEGACY::reload(), C3D_RENDER_RAYTRACING::reload(), C3D_RENDER_OGL_LEGACY::render_3D_module(), and C3D_RENDER_RAYTRACING::setupMaterials().

◆ buildPadShapePolygon()

void CINFO3D_VISU::buildPadShapePolygon ( const D_PAD aPad,
SHAPE_POLY_SET aCornerBuffer,
wxSize  aInflateValue 
) const
private

Definition at line 41 of file create_layer_poly.cpp.

44 {
45  wxPoint corners[4];
46  wxPoint PadShapePos = aPad->ShapePos(); /* Note: for pad having a shape offset,
47  * the pad position is NOT the shape position */
48  switch( aPad->GetShape() )
49  {
50  case PAD_SHAPE_CIRCLE:
51  case PAD_SHAPE_OVAL:
54  {
55  // We are using TransformShapeWithClearanceToPolygon to build the shape.
56  // Currently, this method uses only the same inflate value for X and Y dirs.
57  // so because here this is not the case, we use a inflated dummy pad to build
58  // the polygonal shape
59  // TODO: remove this dummy pad when TransformShapeWithClearanceToPolygon will use
60  // a wxSize to inflate the pad size
61  D_PAD dummy( *aPad );
62  wxSize new_size = aPad->GetSize() + aInflateValue + aInflateValue;
63  dummy.SetSize( new_size );
64  dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 );
65  }
66  break;
67 
69  case PAD_SHAPE_RECT:
70  {
71  SHAPE_LINE_CHAIN aLineChain;
72 
73  aPad->BuildPadPolygon( corners, aInflateValue, aPad->GetOrientation() );
74 
75  for( int ii = 0; ii < 4; ++ii )
76  {
77  corners[3-ii] += PadShapePos; // Shift origin to position
78  aLineChain.Append( corners[3-ii].x, corners[3-ii].y );
79  }
80 
81  aLineChain.SetClosed( true );
82 
83  aCornerBuffer.AddOutline( aLineChain );
84  }
85  break;
86 
87  case PAD_SHAPE_CUSTOM:
88  {
89  SHAPE_POLY_SET polyList; // Will contain the pad outlines in board coordinates
90  auto inflate_val = std::max( aInflateValue.x, aInflateValue.y );
91 
92  polyList.Append( aPad->GetCustomShapeAsPolygon() );
93  aPad->CustomShapeAsPolygonToBoardPosition( &polyList, aPad->ShapePos(), aPad->GetOrientation() );
94 
95  if( inflate_val > 0 )
96  {
97  int numSegs = GetNrSegmentsCircle( inflate_val );
98  polyList.Inflate( inflate_val, numSegs );
99  }
100 
101  aCornerBuffer.Append( polyList );
102  }
103  break;
104  }
105 }
unsigned int GetNrSegmentsCircle(float aDiameter3DU) const
GetNrSegmentsCircle.
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
SHAPE_POLY_SET.
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
SHAPE_LINE_CHAIN.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:422
void CustomShapeAsPolygonToBoardPosition(SHAPE_POLY_SET *aMergedPolygon, wxPoint aPosition, double aRotation) const
When created, the corners coordinates are relative to the pad position, orientation 0,...
wxPoint ShapePos() const
Definition: class_pad.cpp:570
const SHAPE_POLY_SET & GetCustomShapeAsPolygon() const
Accessor to the custom shape as one polygon.
Definition: class_pad.h:374
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
const wxSize & GetSize() const
Definition: class_pad.h:300
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::AddOutline(), SHAPE_LINE_CHAIN::Append(), SHAPE_POLY_SET::Append(), D_PAD::BuildPadPolygon(), D_PAD::CustomShapeAsPolygonToBoardPosition(), dummy(), D_PAD::GetCustomShapeAsPolygon(), GetNrSegmentsCircle(), D_PAD::GetOrientation(), D_PAD::GetShape(), D_PAD::GetSize(), SHAPE_POLY_SET::Inflate(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, SHAPE_LINE_CHAIN::SetClosed(), and D_PAD::ShapePos().

Referenced by buildPadShapeThickOutlineAsPolygon(), and transformPadsShapesWithClearanceToPolygon().

◆ buildPadShapeThickOutlineAsPolygon()

void CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon ( const D_PAD aPad,
SHAPE_POLY_SET aCornerBuffer,
int  aWidth 
) const
private

Definition at line 108 of file create_layer_poly.cpp.

111 {
112  if( aPad->GetShape() == PAD_SHAPE_CIRCLE ) // Draw a ring
113  {
114  TransformRingToPolygon( aCornerBuffer, aPad->ShapePos(),
115  aPad->GetSize().x / 2, ARC_HIGH_DEF, aWidth );
116  return;
117  }
118 
119 
120  // For other shapes, draw polygon outlines
121  SHAPE_POLY_SET corners;
122 
123  buildPadShapePolygon( aPad, corners, wxSize( 0, 0 ) );
124 
125  // Add outlines as thick segments in polygon buffer
126 
127  const SHAPE_LINE_CHAIN& path = corners.COutline( 0 );
128 
129  for( int ii = 0; ii < path.PointCount(); ++ii )
130  {
131  const VECTOR2I& a = path.CPoint( ii );
132  const VECTOR2I& b = path.CPoint( ii + 1 );
133 
134  TransformSegmentToPolygon( aCornerBuffer, wxPoint( a.x, a.y ),
135  wxPoint( b.x, b.y ), ARC_HIGH_DEF, aWidth );
136  }
137 }
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint ShapePos() const
Definition: class_pad.cpp:570
void TransformSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
void TransformRingToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aError, int aWidth)
Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segme...
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
const wxSize & GetSize() const
Definition: class_pad.h:300
void buildPadShapePolygon(const D_PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue) const

References buildPadShapePolygon(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), D_PAD::GetShape(), D_PAD::GetSize(), PAD_SHAPE_CIRCLE, SHAPE_LINE_CHAIN::PointCount(), D_PAD::ShapePos(), TransformRingToPolygon(), TransformSegmentToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by createLayers().

◆ buildPadShapeThickOutlineAsSegments()

void CINFO3D_VISU::buildPadShapeThickOutlineAsSegments ( const D_PAD aPad,
CGENERICCONTAINER2D aDstContainer,
int  aWidth 
)
private

Definition at line 883 of file create_3Dgraphic_brd_items.cpp.

886 {
887  if( aPad->GetShape() == PAD_SHAPE_CIRCLE ) // Draw a ring
888  {
889  const SFVEC2F center3DU( aPad->ShapePos().x * m_biuTo3Dunits,
890  -aPad->ShapePos().y * m_biuTo3Dunits );
891 
892  const int radius = aPad->GetSize().x / 2;
893  const float inner_radius = ( radius - aWidth / 2 ) * m_biuTo3Dunits;
894  const float outer_radius = ( radius + aWidth / 2 ) * m_biuTo3Dunits;
895 
896  aDstContainer->Add( new CRING2D( center3DU, inner_radius, outer_radius, *aPad ) );
897 
898  return;
899  }
900 
901  // For other shapes, draw polygon outlines
902  SHAPE_POLY_SET corners;
903  aPad->BuildPadShapePolygon( corners, wxSize( 0, 0 ) );
904 
905 
906  // Add outlines as thick segments in polygon buffer
907 
908  const SHAPE_LINE_CHAIN& path = corners.COutline( 0 );
909 
910  for( int j = 0; j < path.PointCount(); j++ )
911  {
912  const VECTOR2I& a = path.CPoint( j );
913  const VECTOR2I& b = path.CPoint( j + 1 );
914 
915  SFVEC2F start3DU( a.x * m_biuTo3Dunits, -a.y * m_biuTo3Dunits );
916  SFVEC2F end3DU ( b.x * m_biuTo3Dunits, -b.y * m_biuTo3Dunits );
917 
918  if( Is_segment_a_circle( start3DU, end3DU ) )
919  {
920  aDstContainer->Add(
921  new CFILLEDCIRCLE2D( start3DU, ( aWidth / 2 ) * m_biuTo3Dunits, *aPad ) );
922  }
923  else
924  {
925  aDstContainer->Add(
926  new CROUNDSEGMENT2D( start3DU, end3DU, aWidth * m_biuTo3Dunits, *aPad ) );
927  }
928  }
929 }
void BuildPadShapePolygon(SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue, int aError=ARC_HIGH_DEF) const
Function BuildPadShapePolygon Build the Corner list of the polygonal shape, depending on shape,...
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
SHAPE_POLY_SET.
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
wxPoint ShapePos() const
Definition: class_pad.cpp:570
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
const wxSize & GetSize() const
Definition: class_pad.h:300

References CGENERICCONTAINER2D::Add(), D_PAD::BuildPadShapePolygon(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), D_PAD::GetShape(), D_PAD::GetSize(), Is_segment_a_circle(), m_biuTo3Dunits, PAD_SHAPE_CIRCLE, SHAPE_LINE_CHAIN::PointCount(), D_PAD::ShapePos(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by createLayers().

◆ CameraGet()

◆ CameraSetType()

void CINFO3D_VISU::CameraSetType ( CAMERA_TYPE  aCameraType)

CameraSetType - Set the camera type to use.

Parameters
aCameraTypecamera type to use in this canvas

Definition at line 488 of file cinfo3d_visu.cpp.

489 {
490  switch( aCameraType )
491  {
494  break;
495 
496  default:
497  wxLogMessage( wxT( "CINFO3D_VISU::CameraSetType() error: unknown camera type %d" ),
498  (int)aCameraType );
499  break;
500  }
501 }
CCAMERA & m_currentCamera
Holds a pointer to current camera in use.
Definition: cinfo3d_visu.h:630
CTRACK_BALL m_trackBallCamera
Definition: cinfo3d_visu.h:631

References m_currentCamera, m_trackBallCamera, and TRACKBALL.

◆ createBoardPolygon()

void CINFO3D_VISU::createBoardPolygon ( )
private

Definition at line 454 of file cinfo3d_visu.cpp.

455 {
457 
458  wxString errmsg;
459 
460  if( !m_board->GetBoardPolygonOutlines( m_board_poly, /*allLayerHoles,*/ &errmsg ) )
461  {
462  errmsg.append( wxT( "\n\n" ) );
463  errmsg.append( _( "Cannot determine the board outline." ) );
464  wxLogMessage( errmsg );
465  }
466 }
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, wxString *aErrorText=nullptr, wxPoint *aErrorLocation=nullptr)
Function GetBoardPolygonOutlines Extracts the board outlines and build a closed polygon from lines,...
SHAPE_POLY_SET m_board_poly
PCB board outline polygon.
Definition: cinfo3d_visu.h:574
#define _(s)
Definition: 3d_actions.cpp:31
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.

References _, BOARD::GetBoardPolygonOutlines(), m_board, m_board_poly, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by InitSettings().

◆ createLayers()

void CINFO3D_VISU::createLayers ( REPORTER aStatusTextReporter)
private

Definition at line 141 of file create_layer_items.cpp.

142 {
143  destroyLayers();
144 
145  // Build Copper layers
146  // Based on: https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_draw.cpp#L692
147  // /////////////////////////////////////////////////////////////////////////
148 
149  #ifdef PRINT_STATISTICS_3D_VIEWER
150  unsigned stats_startCopperLayersTime = GetRunningMicroSecs();
151 
152  unsigned start_Time = stats_startCopperLayersTime;
153 #endif
154 
155  PCB_LAYER_ID cu_seq[MAX_CU_LAYERS];
157 
158  m_stats_nr_tracks = 0;
160  m_stats_nr_vias = 0;
162  m_stats_nr_holes = 0;
164 
165  // Prepare track list, convert in a vector. Calc statistic for the holes
166  // /////////////////////////////////////////////////////////////////////////
167  std::vector< const TRACK *> trackList;
168  trackList.clear();
169  trackList.reserve( m_board->Tracks().size() );
170 
171  for( auto track : m_board->Tracks() )
172  {
173  if( !Is3DLayerEnabled( track->GetLayer() ) ) // Skip non enabled layers
174  continue;
175 
176  // Note: a TRACK holds normal segment tracks and
177  // also vias circles (that have also drill values)
178  trackList.push_back( track );
179 
180  if( track->Type() == PCB_VIA_T )
181  {
182  const VIA *via = static_cast< const VIA*>( track );
183  m_stats_nr_vias++;
185  }
186  else
187  {
189  }
190 
191  m_stats_track_med_width += track->GetWidth() * m_biuTo3Dunits;
192  }
193 
194  if( m_stats_nr_tracks )
196 
197  if( m_stats_nr_vias )
199 
200 #ifdef PRINT_STATISTICS_3D_VIEWER
201  printf( "T01: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
202  start_Time = GetRunningMicroSecs();
203 #endif
204 
205  // Prepare copper layers index and containers
206  // /////////////////////////////////////////////////////////////////////////
207  std::vector< PCB_LAYER_ID > layer_id;
208  layer_id.clear();
209  layer_id.reserve( m_copperLayersCount );
210 
211  for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
212  cu_seq[i] = ToLAYER_ID( B_Cu - i );
213 
214  for( LSEQ cu = cu_set.Seq( cu_seq, arrayDim( cu_seq ) ); cu; ++cu )
215  {
216  const PCB_LAYER_ID curr_layer_id = *cu;
217 
218  if( !Is3DLayerEnabled( curr_layer_id ) ) // Skip non enabled layers
219  continue;
220 
221  layer_id.push_back( curr_layer_id );
222 
223  CBVHCONTAINER2D *layerContainer = new CBVHCONTAINER2D;
224  m_layers_container2D[curr_layer_id] = layerContainer;
225 
228  {
229  SHAPE_POLY_SET* layerPoly = new SHAPE_POLY_SET;
230  m_layers_poly[curr_layer_id] = layerPoly;
231  }
232  }
233 
234 #ifdef PRINT_STATISTICS_3D_VIEWER
235  printf( "T02: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
236  start_Time = GetRunningMicroSecs();
237 #endif
238 
239  if( aStatusTextReporter )
240  aStatusTextReporter->Report( _( "Create tracks and vias" ) );
241 
242  // Create tracks as objects and add it to container
243  // /////////////////////////////////////////////////////////////////////////
244  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
245  {
246  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
247 
248  wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
249 
250  CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
251 
252  // ADD TRACKS
253  unsigned int nTracks = trackList.size();
254 
255  for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
256  {
257  const TRACK *track = trackList[trackIdx];
258 
259  // NOTE: Vias can be on multiple layers
260  if( !track->IsOnLayer( curr_layer_id ) )
261  continue;
262 
263  // Add object item to layer container
264  layerContainer->Add( createNewTrack( track, 0.0f ) );
265  }
266  }
267 
268 #ifdef PRINT_STATISTICS_3D_VIEWER
269  printf( "T03: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
270  start_Time = GetRunningMicroSecs();
271 #endif
272 
273  // Create VIAS and THTs objects and add it to holes containers
274  // /////////////////////////////////////////////////////////////////////////
275  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
276  {
277  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
278 
279  // ADD TRACKS
280  unsigned int nTracks = trackList.size();
281 
282  for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
283  {
284  const TRACK *track = trackList[trackIdx];
285 
286  if( !track->IsOnLayer( curr_layer_id ) )
287  continue;
288 
289  // ADD VIAS and THT
290  if( track->Type() == PCB_VIA_T )
291  {
292  const VIA* via = static_cast<const VIA*>( track );
293  const VIATYPE viatype = via->GetViaType();
294  const float holediameter = via->GetDrillValue() * BiuTo3Dunits();
295  const float thickness = GetCopperThickness3DU();
296  const float hole_inner_radius = ( holediameter / 2.0f );
297 
298  const SFVEC2F via_center(
299  via->GetStart().x * m_biuTo3Dunits, -via->GetStart().y * m_biuTo3Dunits );
300 
301  if( viatype != VIATYPE::THROUGH )
302  {
303 
304  // Add hole objects
305  // /////////////////////////////////////////////////////////
306 
307  CBVHCONTAINER2D *layerHoleContainer = NULL;
308 
309  // Check if the layer is already created
310  if( m_layers_holes2D.find( curr_layer_id ) == m_layers_holes2D.end() )
311  {
312  // not found, create a new container
313  layerHoleContainer = new CBVHCONTAINER2D;
314  m_layers_holes2D[curr_layer_id] = layerHoleContainer;
315  }
316  else
317  {
318  // found
319  layerHoleContainer = m_layers_holes2D[curr_layer_id];
320  }
321 
322  // Add a hole for this layer
323  layerHoleContainer->Add( new CFILLEDCIRCLE2D( via_center,
324  hole_inner_radius + thickness,
325  *track ) );
326  }
327  else if( lIdx == 0 ) // it only adds once the THT holes
328  {
329  // Add through hole object
330  // /////////////////////////////////////////////////////////
331  m_through_holes_outer.Add( new CFILLEDCIRCLE2D( via_center,
332  hole_inner_radius + thickness,
333  *track ) );
334 
336  new CFILLEDCIRCLE2D( via_center,
337  hole_inner_radius + thickness,
338  *track ) );
339 
340  m_through_holes_inner.Add( new CFILLEDCIRCLE2D( via_center,
341  hole_inner_radius,
342  *track ) );
343 
344  //m_through_holes_vias_inner.Add( new CFILLEDCIRCLE2D( via_center,
345  // hole_inner_radius,
346  // *track ) );
347  }
348  }
349  }
350  }
351 
352 #ifdef PRINT_STATISTICS_3D_VIEWER
353  printf( "T04: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
354  start_Time = GetRunningMicroSecs();
355 #endif
356 
357  // Create VIAS and THTs objects and add it to holes containers
358  // /////////////////////////////////////////////////////////////////////////
359  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
360  {
361  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
362 
363  // ADD TRACKS
364  const unsigned int nTracks = trackList.size();
365 
366  for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
367  {
368  const TRACK *track = trackList[trackIdx];
369 
370  if( !track->IsOnLayer( curr_layer_id ) )
371  continue;
372 
373  // ADD VIAS and THT
374  if( track->Type() == PCB_VIA_T )
375  {
376  const VIA *via = static_cast< const VIA*>( track );
377  const VIATYPE viatype = via->GetViaType();
378 
379  if( viatype != VIATYPE::THROUGH )
380  {
381 
382  // Add VIA hole contourns
383  // /////////////////////////////////////////////////////////
384 
385  // Add outer holes of VIAs
386  SHAPE_POLY_SET *layerOuterHolesPoly = NULL;
387  SHAPE_POLY_SET *layerInnerHolesPoly = NULL;
388 
389  // Check if the layer is already created
390  if( m_layers_outer_holes_poly.find( curr_layer_id ) ==
392  {
393  // not found, create a new container
394  layerOuterHolesPoly = new SHAPE_POLY_SET;
395  m_layers_outer_holes_poly[curr_layer_id] = layerOuterHolesPoly;
396 
397  wxASSERT( m_layers_inner_holes_poly.find( curr_layer_id ) ==
399 
400  layerInnerHolesPoly = new SHAPE_POLY_SET;
401  m_layers_inner_holes_poly[curr_layer_id] = layerInnerHolesPoly;
402  }
403  else
404  {
405  // found
406  layerOuterHolesPoly = m_layers_outer_holes_poly[curr_layer_id];
407 
408  wxASSERT( m_layers_inner_holes_poly.find( curr_layer_id ) !=
410 
411  layerInnerHolesPoly = m_layers_inner_holes_poly[curr_layer_id];
412  }
413 
414  const int holediameter = via->GetDrillValue();
415  const int hole_outer_radius = (holediameter / 2) + GetCopperThicknessBIU();
416 
417  TransformCircleToPolygon( *layerOuterHolesPoly, via->GetStart(),
418  hole_outer_radius, ARC_HIGH_DEF );
419 
420  TransformCircleToPolygon( *layerInnerHolesPoly, via->GetStart(),
421  holediameter / 2, ARC_HIGH_DEF );
422  }
423  else if( lIdx == 0 ) // it only adds once the THT holes
424  {
425  const int holediameter = via->GetDrillValue();
426  const int hole_outer_radius = (holediameter / 2)+ GetCopperThicknessBIU();
427 
428  // Add through hole contourns
429  // /////////////////////////////////////////////////////////
431  hole_outer_radius, ARC_HIGH_DEF );
432 
434  holediameter / 2, ARC_HIGH_DEF );
435 
436  // Add samething for vias only
437 
439  hole_outer_radius, ARC_HIGH_DEF );
440 
441  //TransformCircleToPolygon( m_through_inner_holes_vias_poly,
442  // via->GetStart(),
443  // holediameter / 2,
444  // GetNrSegmentsCircle( holediameter ) );
445  }
446  }
447  }
448  }
449 
450 #ifdef PRINT_STATISTICS_3D_VIEWER
451  printf( "T05: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
452  start_Time = GetRunningMicroSecs();
453 #endif
454 
455  // Creates outline contours of the tracks and add it to the poly of the layer
456  // /////////////////////////////////////////////////////////////////////////
459  {
460  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
461  {
462  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
463 
464  wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
465 
466  SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
467 
468  // ADD TRACKS
469  unsigned int nTracks = trackList.size();
470 
471  for( unsigned int trackIdx = 0; trackIdx < nTracks; ++trackIdx )
472  {
473  const TRACK *track = trackList[trackIdx];
474 
475  if( !track->IsOnLayer( curr_layer_id ) )
476  continue;
477 
478  // Add the track contour
479  track->TransformShapeWithClearanceToPolygon( *layerPoly, 0 );
480  }
481  }
482  }
483 
484 #ifdef PRINT_STATISTICS_3D_VIEWER
485  printf( "T06: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
486  start_Time = GetRunningMicroSecs();
487 #endif
488 
489  // Add holes of modules
490  // /////////////////////////////////////////////////////////////////////////
491  for( auto module : m_board->Modules() )
492  {
493  for( auto pad : module->Pads() )
494  {
495  const wxSize padHole = pad->GetDrillSize();
496 
497  if( !padHole.x ) // Not drilled pad like SMD pad
498  continue;
499 
500  // The hole in the body is inflated by copper thickness,
501  // if not plated, no copper
502  const int inflate = (pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED) ?
503  GetCopperThicknessBIU() : 0;
504 
506  m_stats_hole_med_diameter += ( ( pad->GetDrillSize().x +
507  pad->GetDrillSize().y ) / 2.0f ) * m_biuTo3Dunits;
508 
509  m_through_holes_outer.Add( createNewPadDrill( pad, inflate ) );
511  }
512  }
513  if( m_stats_nr_holes )
515 
516 #ifdef PRINT_STATISTICS_3D_VIEWER
517  printf( "T07: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
518  start_Time = GetRunningMicroSecs();
519 #endif
520 
521  // Add contours of the pad holes (pads can be Circle or Segment holes)
522  // /////////////////////////////////////////////////////////////////////////
523  for( auto module : m_board->Modules() )
524  {
525  for( auto pad : module->Pads() )
526  {
527  const wxSize padHole = pad->GetDrillSize();
528 
529  if( !padHole.x ) // Not drilled pad like SMD pad
530  continue;
531 
532  // The hole in the body is inflated by copper thickness.
533  const int inflate = GetCopperThicknessBIU();
534 
535  if( pad->GetAttribute () != PAD_ATTRIB_HOLE_NOT_PLATED )
536  {
537  pad->BuildPadDrillShapePolygon( m_through_outer_holes_poly, inflate );
538 
539  pad->BuildPadDrillShapePolygon( m_through_inner_holes_poly, 0 );
540  }
541  else
542  {
543  // If not plated, no copper.
544  pad->BuildPadDrillShapePolygon( m_through_outer_holes_poly_NPTH, inflate );
545  }
546  }
547  }
548 
549 #ifdef PRINT_STATISTICS_3D_VIEWER
550  printf( "T08: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
551  start_Time = GetRunningMicroSecs();
552 #endif
553 
554  // Add modules PADs objects to containers
555  // /////////////////////////////////////////////////////////////////////////
556  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
557  {
558  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
559 
560  wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
561 
562  CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
563 
564  // ADD PADS
565  for( auto module : m_board->Modules() )
566  {
567  // Note: NPTH pads are not drawn on copper layers when the pad
568  // has same shape as its hole
570  layerContainer,
571  curr_layer_id,
572  0,
573  true );
574 
575  // Micro-wave modules may have items on copper layers
577  layerContainer,
578  curr_layer_id,
579  0 );
580  }
581  }
582 
583 #ifdef PRINT_STATISTICS_3D_VIEWER
584  printf( "T09: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
585  start_Time = GetRunningMicroSecs();
586 #endif
587 
588  // Add modules PADs poly contourns
589  // /////////////////////////////////////////////////////////////////////////
592  {
593  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
594  {
595  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
596 
597  wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
598 
599  SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
600 
601  // ADD PADS
602  for( auto module : m_board->Modules() )
603  {
604  // Construct polys
605  // /////////////////////////////////////////////////////////////
606 
607  // Note: NPTH pads are not drawn on copper layers when the pad
608  // has same shape as its hole
610  curr_layer_id,
611  *layerPoly,
612  0,
613  true );
614 
615  // Micro-wave modules may have items on copper layers
616  module->TransformGraphicTextWithClearanceToPolygonSet(
617  curr_layer_id, *layerPoly, 0 );
618 
619  transformGraphicModuleEdgeToPolygonSet( module, curr_layer_id, *layerPoly );
620  }
621  }
622  }
623 
624 #ifdef PRINT_STATISTICS_3D_VIEWER
625  printf( "T10: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
626  start_Time = GetRunningMicroSecs();
627 #endif
628 
629  // Add graphic item on copper layers to object containers
630  // /////////////////////////////////////////////////////////////////////////
631  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
632  {
633  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
634 
635  wxASSERT( m_layers_container2D.find( curr_layer_id ) != m_layers_container2D.end() );
636 
637  CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
638 
639  // ADD GRAPHIC ITEMS ON COPPER LAYERS (texts)
640  for( auto item : m_board->Drawings() )
641  {
642  if( !item->IsOnLayer( curr_layer_id ) )
643  continue;
644 
645  switch( item->Type() )
646  {
647  case PCB_LINE_T:
648  {
650  layerContainer,
651  curr_layer_id,
652  0 );
653  }
654  break;
655 
656  case PCB_TEXT_T:
658  layerContainer,
659  curr_layer_id,
660  0 );
661  break;
662 
663  case PCB_DIMENSION_T:
665  layerContainer,
666  curr_layer_id,
667  0 );
668  break;
669 
670  default:
671  wxLogTrace( m_logTrace,
672  wxT( "createLayers: item type: %d not implemented" ),
673  item->Type() );
674  break;
675  }
676  }
677  }
678 
679 #ifdef PRINT_STATISTICS_3D_VIEWER
680  printf( "T11: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
681  start_Time = GetRunningMicroSecs();
682 #endif
683 
684  // Add graphic item on copper layers to poly contourns
685  // /////////////////////////////////////////////////////////////////////////
688  {
689  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
690  {
691  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
692 
693  wxASSERT( m_layers_poly.find( curr_layer_id ) != m_layers_poly.end() );
694 
695  SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
696 
697  // ADD GRAPHIC ITEMS ON COPPER LAYERS (texts)
698  for( auto item : m_board->Drawings() )
699  {
700  if( !item->IsOnLayer( curr_layer_id ) )
701  continue;
702 
703  switch( item->Type() )
704  {
705  case PCB_LINE_T:
706  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( *layerPoly, 0 );
707  break;
708 
709  case PCB_TEXT_T:
710  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0 );
711  break;
712 
713  default:
714  wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ),
715  item->Type() );
716  break;
717  }
718  }
719  }
720  }
721 
722 #ifdef PRINT_STATISTICS_3D_VIEWER
723  printf( "T12: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
724  start_Time = GetRunningMicroSecs();
725 #endif
726 
727  if( GetFlag( FL_ZONE ) )
728  {
729  if( aStatusTextReporter )
730  aStatusTextReporter->Report( _( "Create zones" ) );
731 
732  // Add zones objects
733  // /////////////////////////////////////////////////////////////////////
734  std::atomic<size_t> nextZone( 0 );
735  std::atomic<size_t> threadsFinished( 0 );
736 
737  size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
738  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
739  {
740  std::thread t = std::thread( [&]()
741  {
742  for( size_t areaId = nextZone.fetch_add( 1 );
743  areaId < static_cast<size_t>( m_board->GetAreaCount() );
744  areaId = nextZone.fetch_add( 1 ) )
745  {
746  const ZONE_CONTAINER* zone = m_board->GetArea( areaId );
747 
748  if( zone == nullptr )
749  break;
750 
751  auto layerContainer = m_layers_container2D.find( zone->GetLayer() );
752 
753  if( layerContainer != m_layers_container2D.end() )
754  AddSolidAreasShapesToContainer( zone, layerContainer->second,
755  zone->GetLayer() );
756  }
757 
758  threadsFinished++;
759  } );
760 
761  t.detach();
762  }
763 
764  while( threadsFinished < parallelThreadCount )
765  std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
766 
767  }
768 
769 #ifdef PRINT_STATISTICS_3D_VIEWER
770  printf( "fill zones T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
771  start_Time = GetRunningMicroSecs();
772 #endif
773 
776  {
777  // ADD COPPER ZONES
778  for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
779  {
780  const ZONE_CONTAINER* zone = m_board->GetArea( ii );
781 
782  if( zone == nullptr )
783  break;
784 
785  auto layerContainer = m_layers_poly.find( zone->GetLayer() );
786 
787  if( layerContainer != m_layers_poly.end() )
788  zone->TransformSolidAreasShapesToPolygonSet( *layerContainer->second );
789  }
790  }
791 
792 #ifdef PRINT_STATISTICS_3D_VIEWER
793  printf( "T14: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
794  start_Time = GetRunningMicroSecs();
795 #endif
796 
797  // Simplify layer polygons
798  // /////////////////////////////////////////////////////////////////////////
799 
800  if( aStatusTextReporter )
801  aStatusTextReporter->Report( _( "Simplifying copper layers polygons" ) );
802 
805  {
806  std::atomic<size_t> nextItem( 0 );
807  std::atomic<size_t> threadsFinished( 0 );
808 
809  size_t parallelThreadCount = std::min<size_t>(
810  std::max<size_t>( std::thread::hardware_concurrency(), 2 ),
811  layer_id.size() );
812  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
813  {
814  std::thread t = std::thread( [&nextItem, &threadsFinished, &layer_id, this]()
815  {
816  for( size_t i = nextItem.fetch_add( 1 );
817  i < layer_id.size();
818  i = nextItem.fetch_add( 1 ) )
819  {
820  auto layerPoly = m_layers_poly.find( layer_id[i] );
821 
822  if( layerPoly != m_layers_poly.end() )
823  // This will make a union of all added contours
824  layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
825  }
826 
827  threadsFinished++;
828  } );
829 
830  t.detach();
831  }
832 
833  while( threadsFinished < parallelThreadCount )
834  std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
835  }
836 
837 #ifdef PRINT_STATISTICS_3D_VIEWER
838  printf( "T15: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
839  start_Time = GetRunningMicroSecs();
840 #endif
841 
842  // Simplify holes polygon contours
843  // /////////////////////////////////////////////////////////////////////////
844  if( aStatusTextReporter )
845  aStatusTextReporter->Report( _( "Simplify holes contours" ) );
846 
847  for( unsigned int lIdx = 0; lIdx < layer_id.size(); ++lIdx )
848  {
849  const PCB_LAYER_ID curr_layer_id = layer_id[lIdx];
850 
851  if( m_layers_outer_holes_poly.find( curr_layer_id ) !=
853  {
854  // found
855  SHAPE_POLY_SET *polyLayer = m_layers_outer_holes_poly[curr_layer_id];
856  polyLayer->Simplify( SHAPE_POLY_SET::PM_FAST );
857 
858  wxASSERT( m_layers_inner_holes_poly.find( curr_layer_id ) !=
860 
861  polyLayer = m_layers_inner_holes_poly[curr_layer_id];
862  polyLayer->Simplify( SHAPE_POLY_SET::PM_FAST );
863  }
864  }
865 
866 #ifdef PRINT_STATISTICS_3D_VIEWER
867  printf( "T16: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
868 #endif
869  // End Build Copper layers
870 
871 
872  // This will make a union of all added contourns
877  //m_through_inner_holes_vias_poly.Simplify( SHAPE_POLY_SET::PM_FAST ); // Not in use
878 
879 #ifdef PRINT_STATISTICS_3D_VIEWER
880  unsigned stats_endCopperLayersTime = GetRunningMicroSecs();
881 #endif
882 
883  // Build Tech layers
884  // Based on: https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_draw.cpp#L1059
885  // /////////////////////////////////////////////////////////////////////////
886 #ifdef PRINT_STATISTICS_3D_VIEWER
887  unsigned stats_startTechLayersTime = GetRunningMicroSecs();
888 #endif
889 
890  if( aStatusTextReporter )
891  aStatusTextReporter->Report( _( "Build Tech layers" ) );
892 
893  // draw graphic items, on technical layers
894  static const PCB_LAYER_ID teckLayerList[] = {
895  B_Adhes,
896  F_Adhes,
897  B_Paste,
898  F_Paste,
899  B_SilkS,
900  F_SilkS,
901  B_Mask,
902  F_Mask,
903 
904  // Aux Layers
905  Dwgs_User,
906  Cmts_User,
907  Eco1_User,
908  Eco2_User,
909  Edge_Cuts,
910  Margin
911  };
912 
913  // User layers are not drawn here, only technical layers
914 
915  for( LSEQ seq = LSET::AllNonCuMask().Seq( teckLayerList, arrayDim( teckLayerList ) );
916  seq;
917  ++seq )
918  {
919  const PCB_LAYER_ID curr_layer_id = *seq;
920 
921  if( !Is3DLayerEnabled( curr_layer_id ) )
922  continue;
923 
924  CBVHCONTAINER2D *layerContainer = new CBVHCONTAINER2D;
925  m_layers_container2D[curr_layer_id] = layerContainer;
926 
927  SHAPE_POLY_SET *layerPoly = new SHAPE_POLY_SET;
928  m_layers_poly[curr_layer_id] = layerPoly;
929 
930  // Add drawing objects
931  // /////////////////////////////////////////////////////////////////////
932  for( auto item : m_board->Drawings() )
933  {
934  if( !item->IsOnLayer( curr_layer_id ) )
935  continue;
936 
937  switch( item->Type() )
938  {
939  case PCB_LINE_T:
941  layerContainer,
942  curr_layer_id,
943  0 );
944  break;
945 
946  case PCB_TEXT_T:
948  layerContainer,
949  curr_layer_id,
950  0 );
951  break;
952 
953  case PCB_DIMENSION_T:
955  layerContainer,
956  curr_layer_id,
957  0 );
958  break;
959 
960  default:
961  break;
962  }
963  }
964 
965 
966  // Add drawing contours
967  // /////////////////////////////////////////////////////////////////////
968  for( auto item : m_board->Drawings() )
969  {
970  if( !item->IsOnLayer( curr_layer_id ) )
971  continue;
972 
973  switch( item->Type() )
974  {
975  case PCB_LINE_T:
976  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( *layerPoly, 0 );
977  break;
978 
979  case PCB_TEXT_T:
980  ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0 );
981  break;
982 
983  default:
984  break;
985  }
986  }
987 
988 
989  // Add modules tech layers - objects
990  // /////////////////////////////////////////////////////////////////////
991  for( auto module : m_board->Modules() )
992  {
993  if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
994  {
995  int linewidth = g_DrawDefaultLineThickness;
996 
997  for( auto pad : module->Pads() )
998  {
999  if( !pad->IsOnLayer( curr_layer_id ) )
1000  continue;
1001 
1002  buildPadShapeThickOutlineAsSegments( pad, layerContainer, linewidth );
1003  }
1004  }
1005  else
1006  {
1008  module, layerContainer, curr_layer_id, 0, false );
1009  }
1010 
1011  AddGraphicsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0 );
1012  }
1013 
1014 
1015  // Add modules tech layers - contours
1016  // /////////////////////////////////////////////////////////////////////
1017  for( auto module : m_board->Modules() )
1018  {
1019  if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
1020  {
1021  const int linewidth = g_DrawDefaultLineThickness;
1022 
1023  for( auto pad : module->Pads() )
1024  {
1025  if( !pad->IsOnLayer( curr_layer_id ) )
1026  continue;
1027 
1028  buildPadShapeThickOutlineAsPolygon( pad, *layerPoly, linewidth );
1029  }
1030  }
1031  else
1032  {
1034  module->Pads(), curr_layer_id, *layerPoly, 0, false );
1035  }
1036 
1037  // On tech layers, use a poor circle approximation, only for texts (stroke font)
1038  module->TransformGraphicTextWithClearanceToPolygonSet( curr_layer_id, *layerPoly, 0 );
1039 
1040  // Add the remaining things with dynamic seg count for circles
1041  transformGraphicModuleEdgeToPolygonSet( module, curr_layer_id, *layerPoly );
1042  }
1043 
1044 
1045  // Draw non copper zones
1046  // /////////////////////////////////////////////////////////////////////
1047  if( GetFlag( FL_ZONE ) )
1048  {
1049  for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
1050  {
1051  ZONE_CONTAINER* zone = m_board->GetArea( ii );
1052 
1053  if( !zone->IsOnLayer( curr_layer_id ) )
1054  continue;
1055 
1057  layerContainer,
1058  curr_layer_id );
1059  }
1060 
1061  for( int ii = 0; ii < m_board->GetAreaCount(); ++ii )
1062  {
1063  ZONE_CONTAINER* zone = m_board->GetArea( ii );
1064 
1065  if( !zone->IsOnLayer( curr_layer_id ) )
1066  continue;
1067 
1068  zone->TransformSolidAreasShapesToPolygonSet( *layerPoly );
1069  }
1070  }
1071 
1072  // This will make a union of all added contours
1073  layerPoly->Simplify( SHAPE_POLY_SET::PM_FAST );
1074  }
1075  // End Build Tech layers
1076 
1077 #ifdef PRINT_STATISTICS_3D_VIEWER
1078  unsigned stats_endTechLayersTime = GetRunningMicroSecs();
1079 #endif
1080 
1081 
1082  // Build BVH for holes and vias
1083  // /////////////////////////////////////////////////////////////////////////
1084 
1085 #ifdef PRINT_STATISTICS_3D_VIEWER
1086  unsigned stats_startHolesBVHTime = GetRunningMicroSecs();
1087 #endif
1088  if( aStatusTextReporter )
1089  aStatusTextReporter->Report( _( "Build BVH for holes and vias" ) );
1090 
1093 
1094  if( !m_layers_holes2D.empty() )
1095  {
1096  for( MAP_CONTAINER_2D::iterator ii = m_layers_holes2D.begin();
1097  ii != m_layers_holes2D.end();
1098  ++ii )
1099  {
1100  ((CBVHCONTAINER2D *)(ii->second))->BuildBVH();
1101  }
1102  }
1103 
1104  // We only need the Solder mask to initialize the BVH
1105  // because..?
1107  ((CBVHCONTAINER2D *)m_layers_container2D[B_Mask])->BuildBVH();
1108 
1110  ((CBVHCONTAINER2D *)m_layers_container2D[F_Mask])->BuildBVH();
1111 
1112 #ifdef PRINT_STATISTICS_3D_VIEWER
1113  unsigned stats_endHolesBVHTime = GetRunningMicroSecs();
1114 
1115  printf( "CINFO3D_VISU::createLayers times\n" );
1116  printf( " Copper Layers: %.3f ms\n",
1117  (float)( stats_endCopperLayersTime - stats_startCopperLayersTime ) / 1e3 );
1118  printf( " Holes BVH creation: %.3f ms\n",
1119  (float)( stats_endHolesBVHTime - stats_startHolesBVHTime ) / 1e3 );
1120  printf( " Tech Layers: %.3f ms\n",
1121  (float)( stats_endTechLayersTime - stats_startTechLayersTime ) / 1e3 );
1122  printf( "Statistics:\n" );
1123  printf( " m_stats_nr_tracks %u\n", m_stats_nr_tracks );
1124  printf( " m_stats_nr_vias %u\n", m_stats_nr_vias );
1125  printf( " m_stats_nr_holes %u\n", m_stats_nr_holes );
1126  printf( " m_stats_via_med_hole_diameter (3DU) %f\n", m_stats_via_med_hole_diameter );
1127  printf( " m_stats_hole_med_diameter (3DU) %f\n", m_stats_hole_med_diameter );
1128  printf( " m_calc_seg_min_factor3DU (3DU) %f\n", m_calc_seg_min_factor3DU );
1129  printf( " m_calc_seg_max_factor3DU (3DU) %f\n", m_calc_seg_max_factor3DU );
1130 #endif
1131 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:686
void AddShapeWithClearanceToContainer(const TEXTE_PCB *aTextPCB, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue)
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
COBJECT2D * createNewTrack(const TRACK *aTrack, int aClearanceValue) const
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
CBVHCONTAINER2D m_through_holes_vias_outer
It contains the list of throughHoles vias of the board, the radius of the hole is inflated with the c...
Definition: cinfo3d_visu.h:595
const wxPoint & GetStart() const
Definition: class_track.h:109
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_zone.cpp:301
float m_calc_seg_min_factor3DU
min factor used for cicle segment approximation calculation
Definition: cinfo3d_visu.h:634
SHAPE_POLY_SET m_through_inner_holes_poly
It contains polygon contours for through holes (inner cylinder)
Definition: cinfo3d_visu.h:565
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:709
MAP_POLY m_layers_inner_holes_poly
It contains polygon contours for holes of each layer (inner holes)
Definition: cinfo3d_visu.h:556
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:204
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the track shape to a closed polygon Used in fil...
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
float m_calc_seg_max_factor3DU
max factor used for cicle segment approximation calculation
Definition: cinfo3d_visu.h:637
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
unsigned int m_stats_nr_holes
number of holes in the board
Definition: cinfo3d_visu.h:655
CBVHCONTAINER2D m_through_holes_inner
It contains the list of throughHoles of the board, the radius is the inner hole.
Definition: cinfo3d_visu.h:591
float m_stats_via_med_hole_diameter
Computed medium diameter of the via holes in 3D units.
Definition: cinfo3d_visu.h:652
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:377
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
MAP_CONTAINER_2D m_layers_container2D
It contains the 2d elements of each layer.
Definition: cinfo3d_visu.h:580
double BiuTo3Dunits() const
BiuTo3Dunits - Board integer units To 3D units.
Definition: cinfo3d_visu.h:141
float m_stats_hole_med_diameter
Computed medium diameter of the holes in 3D units.
Definition: cinfo3d_visu.h:658
PCB_LAYER_ID
A quick note on layer IDs:
MAP_POLY m_layers_poly
It contains polygon contours for each layer.
Definition: cinfo3d_visu.h:550
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:948
LSET is a set of PCB_LAYER_IDs.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
#define NULL
int GetCopperThicknessBIU() const
GetCopperThicknessBIU - Get the current copper layer thickness.
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
unsigned int m_stats_nr_vias
Nr of vias.
Definition: cinfo3d_visu.h:649
MODULES & Modules()
Definition: class_board.h:226
SHAPE_POLY_SET.
int g_DrawDefaultLineThickness
Default line thickness in internal units used to draw or plot items using a default thickness line va...
void TransformSolidAreasShapesToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, int aError=ARC_HIGH_DEF) const
Function TransformSolidAreasShapesToPolygonSet Convert solid areas full shapes to polygon set (the fu...
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
SHAPE_POLY_SET m_through_outer_holes_poly_NPTH
It contains polygon contours for (just) non plated through holes (outer cylinder)
Definition: cinfo3d_visu.h:559
MAP_POLY m_layers_outer_holes_poly
It contains polygon contours for holes of each layer (outer holes)
Definition: cinfo3d_visu.h:553
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void AddSolidAreasShapesToContainer(const ZONE_CONTAINER *aZoneContainer, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId)
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: cinfo3d_visu.h:666
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
SHAPE_POLY_SET m_through_outer_holes_poly
It contains polygon contours for through holes (outer cylinder)
Definition: cinfo3d_visu.h:562
bool Is3DLayerEnabled(PCB_LAYER_ID aLayer) const
Is3DLayerEnabled - Check if a layer is enabled.
#define _(s)
Definition: 3d_actions.cpp:31
unsigned GetRunningMicroSecs()
Function GetRunningMicroSecs An alternate way to calculate an elapset time (in microsecondes) to clas...
float GetCopperThickness3DU() const
GetCopperThickness3DU - Get the current copper layer thickness.
Definition: cinfo3d_visu.h:165
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
float m_stats_track_med_width
Track average width.
Definition: cinfo3d_visu.h:646
unsigned int m_copperLayersCount
Number of copper layers actually used by the board.
Definition: cinfo3d_visu.h:605
VIATYPE GetViaType() const
Definition: class_track.h:336
MAP_CONTAINER_2D m_layers_holes2D
It contains the holes per each layer.
Definition: cinfo3d_visu.h:583
RENDER_ENGINE m_render_engine
render engine currently on use
Definition: cinfo3d_visu.h:526
void transformGraphicModuleEdgeToPolygonSet(const MODULE *aModule, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer) const
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
VIATYPE
Definition: class_track.h:60
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void buildPadShapeThickOutlineAsPolygon(const D_PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, int aWidth) const
SHAPE_POLY_SET m_through_outer_holes_vias_poly
It contains polygon contours for through holes vias (outer cylinder)
Definition: cinfo3d_visu.h:568
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:913
CBVHCONTAINER2D m_through_holes_outer
It contains the list of throughHoles of the board, the radius of the hole is inflated with the copper...
Definition: cinfo3d_visu.h:587
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
void buildPadShapeThickOutlineAsSegments(const D_PAD *aPad, CGENERICCONTAINER2D *aDstContainer, int aWidth)
COBJECT2D * createNewPadDrill(const D_PAD *aPad, int aInflateValue)
void transformPadsShapesWithClearanceToPolygon(const PADS &aPads, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aCornerBuffer, int aInflateValue, bool aSkipNPTHPadsWihNoCopper) const
DRAWINGS & Drawings()
Definition: class_board.h:235
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:823
DIMENSION.
TRACKS & Tracks()
Definition: class_board.h:217
unsigned int m_stats_nr_tracks
Number of tracks in the board.
Definition: cinfo3d_visu.h:643
void AddGraphicsShapesWithClearanceToContainer(const MODULE *aModule, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aInflateValue)
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
void AddPadsShapesWithClearanceToContainer(const MODULE *aModule, CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayerId, int aInflateValue, bool aSkipNPTHPadsWihNoCopper)

References _, CGENERICCONTAINER2D::Add(), AddGraphicsShapesWithClearanceToContainer(), AddPadsShapesWithClearanceToContainer(), AddShapeWithClearanceToContainer(), AddSolidAreasShapesToContainer(), LSET::AllCuMask(), LSET::AllNonCuMask(), arrayDim(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, BiuTo3Dunits(), CBVHCONTAINER2D::BuildBVH(), buildPadShapeThickOutlineAsPolygon(), buildPadShapeThickOutlineAsSegments(), Cmts_User, createNewPadDrill(), createNewTrack(), destroyLayers(), BOARD::Drawings(), Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Mask, F_Paste, F_SilkS, FL_RENDER_OPENGL_COPPER_THICKNESS, FL_ZONE, g_DrawDefaultLineThickness, BOARD::GetArea(), BOARD::GetAreaCount(), GetCopperThickness3DU(), GetCopperThicknessBIU(), VIA::GetDrillValue(), GetFlag(), ZONE_CONTAINER::GetLayer(), GetRunningMicroSecs(), TRACK::GetStart(), VIA::GetViaType(), Is3DLayerEnabled(), ZONE_CONTAINER::IsOnLayer(), BOARD_ITEM::IsOnLayer(), m_biuTo3Dunits, m_board, m_calc_seg_max_factor3DU, m_calc_seg_min_factor3DU, m_copperLayersCount, m_layers_container2D, m_layers_holes2D, m_layers_inner_holes_poly, m_layers_outer_holes_poly, m_layers_poly, m_logTrace, m_render_engine, m_stats_hole_med_diameter, m_stats_nr_holes, m_stats_nr_tracks, m_stats_nr_vias, m_stats_track_med_width, m_stats_via_med_hole_diameter, m_through_holes_inner, m_through_holes_outer, m_through_holes_vias_outer, m_through_inner_holes_poly, m_through_outer_holes_poly, m_through_outer_holes_poly_NPTH, m_through_outer_holes_vias_poly, Margin, MAX_CU_LAYERS, BOARD::Modules(), NULL, OPENGL_LEGACY, PAD_ATTRIB_HOLE_NOT_PLATED, PCB_DIMENSION_T, PCB_LINE_T, PCB_TEXT_T, PCB_VIA_T, SHAPE_POLY_SET::PM_FAST, REPORTER::Report(), LSET::Seq(), SHAPE_POLY_SET::Simplify(), THROUGH, ToLAYER_ID(), BOARD::Tracks(), TransformCircleToPolygon(), transformGraphicModuleEdgeToPolygonSet(), transformPadsShapesWithClearanceToPolygon(), TRACK::TransformShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), EDA_ITEM::Type(), wxPoint::x, and wxPoint::y.

Referenced by InitSettings().

◆ createNewPadDrill()

COBJECT2D * CINFO3D_VISU::createNewPadDrill ( const D_PAD aPad,
int  aInflateValue 
)
private

Definition at line 520 of file create_3Dgraphic_brd_items.cpp.

521 {
522  wxSize drillSize = aPad->GetDrillSize();
523 
524  if( !drillSize.x || !drillSize.y )
525  {
526  wxLogTrace( m_logTrace, wxT( "CINFO3D_VISU::createNewPadDrill - found an invalid pad" ) );
527  return NULL;
528  }
529 
530  if( drillSize.x == drillSize.y ) // usual round hole
531  {
532  const int radius = (drillSize.x / 2) + aInflateValue;
533 
534  const SFVEC2F center( aPad->GetPosition().x * m_biuTo3Dunits,
535  -aPad->GetPosition().y * m_biuTo3Dunits );
536 
537  return new CFILLEDCIRCLE2D( center, radius * m_biuTo3Dunits, *aPad );
538 
539  }
540  else // Oblong hole
541  {
542  wxPoint start, end;
543  int width;
544 
545  aPad->GetOblongDrillGeometry( start, end, width );
546 
547  width += aInflateValue * 2;
548  start += aPad->GetPosition();
549  end += aPad->GetPosition();
550 
551  SFVEC2F start3DU( start.x * m_biuTo3Dunits,
552  -start.y * m_biuTo3Dunits );
553 
554  SFVEC2F end3DU ( end.x * m_biuTo3Dunits,
555  -end.y * m_biuTo3Dunits );
556 
557  if( Is_segment_a_circle( start3DU, end3DU ) )
558  {
559  return new CFILLEDCIRCLE2D( start3DU, (width / 2) * m_biuTo3Dunits, *aPad );
560  }
561  else
562  {
563  return new CROUNDSEGMENT2D( start3DU, end3DU, width * m_biuTo3Dunits, *aPad );
564  }
565  }
566 
567  return NULL;
568 }
void GetOblongDrillGeometry(wxPoint &aStartPoint, wxPoint &aEndPoint, int &aWidth) const
Function GetOblongDrillGeometry calculates the start point, end point and width of an equivalent segm...
Definition: class_pad.cpp:846
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
#define NULL
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: cinfo3d_visu.h:666
const wxSize & GetDrillSize() const
Definition: class_pad.h:306
const wxPoint GetPosition() const override
Definition: class_pad.h:241

References D_PAD::GetDrillSize(), D_PAD::GetOblongDrillGeometry(), D_PAD::GetPosition(), Is_segment_a_circle(), m_biuTo3Dunits, m_logTrace, NULL, wxPoint::x, and wxPoint::y.

Referenced by createLayers().

◆ createNewPadWithClearance()

void CINFO3D_VISU::createNewPadWithClearance ( const D_PAD aPad,
CGENERICCONTAINER2D aDstContainer,
wxSize  aClearanceValue 
) const
private

Definition at line 284 of file create_3Dgraphic_brd_items.cpp.

287 {
288  // note: for most of shapes, aClearanceValue.x = aClearanceValue.y
289  // only rectangular and oval shapes can have different values
290  // when drawn on the solder paste layer, because we can have a margin that is a
291  // percent of pad size
292  const int dx = (aPad->GetSize().x / 2) + aClearanceValue.x;
293  const int dy = (aPad->GetSize().y / 2) + aClearanceValue.y;
294 
295  if( !dx || !dy )
296  {
297  wxLogTrace( m_logTrace,
298  wxT( "CINFO3D_VISU::createNewPadWithClearance - found an invalid pad" ) );
299 
300  return;
301  }
302 
303  wxPoint PadShapePos = aPad->ShapePos(); // Note: for pad having a shape offset,
304  // the pad position is NOT the shape position
305 
306  switch( aPad->GetShape() )
307  {
308  case PAD_SHAPE_CIRCLE:
309  {
310  const float radius = dx * m_biuTo3Dunits;
311 
312  const SFVEC2F center( PadShapePos.x * m_biuTo3Dunits,
313  -PadShapePos.y * m_biuTo3Dunits );
314 
315  aDstContainer->Add( new CFILLEDCIRCLE2D( center, radius, *aPad ) );
316  }
317  break;
318 
319  case PAD_SHAPE_OVAL:
320  {
321  if( dx == dy )
322  {
323  // The segment object cannot store start and end the same position,
324  // so add a circle instead
325  const float radius = dx * m_biuTo3Dunits;
326 
327  const SFVEC2F center( PadShapePos.x * m_biuTo3Dunits,
328  -PadShapePos.y * m_biuTo3Dunits );
329 
330  aDstContainer->Add( new CFILLEDCIRCLE2D( center, radius, *aPad ) );
331  }
332  else
333  {
334  // An oval pad has the same shape as a segment with rounded ends
335 
336  int iwidth;
337  wxPoint shape_offset = wxPoint( 0, 0 );
338 
339  if( dy > dx ) // Oval pad X/Y ratio for choosing translation axis
340  {
341  shape_offset.y = dy - dx;
342  iwidth = dx * 2;
343  }
344  else //if( dy < dx )
345  {
346  shape_offset.x = dy - dx;
347  iwidth = dy * 2;
348  }
349 
350  RotatePoint( &shape_offset, aPad->GetOrientation() );
351 
352  const wxPoint start = PadShapePos - shape_offset;
353  const wxPoint end = PadShapePos + shape_offset;
354 
355  const SFVEC2F start3DU( start.x * m_biuTo3Dunits, -start.y * m_biuTo3Dunits );
356  const SFVEC2F end3DU ( end.x * m_biuTo3Dunits, -end.y * m_biuTo3Dunits );
357 
358  // Cannot add segments that have the same start and end point
359  if( Is_segment_a_circle( start3DU, end3DU ) )
360  {
361  aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU,
362  (iwidth / 2) * m_biuTo3Dunits,
363  *aPad ) );
364  }
365  else
366  {
367  aDstContainer->Add( new CROUNDSEGMENT2D( start3DU, end3DU,
368  iwidth * m_biuTo3Dunits,
369  *aPad ) );
370  }
371  }
372  }
373  break;
374 
375  case PAD_SHAPE_TRAPEZOID:
376  case PAD_SHAPE_RECT:
377  {
378  // see pcbnew/board_items_to_polygon_shape_transform.cpp
379 
380  wxPoint corners[4];
381  aPad->BuildPadPolygon( corners, wxSize( 0, 0), aPad->GetOrientation() );
382 
383  SFVEC2F corners3DU[4];
384 
385  // Note: for pad having a shape offset,
386  // the pad position is NOT the shape position
387  for( unsigned int ii = 0; ii < 4; ++ii )
388  {
389  corners[ii] += aPad->ShapePos(); // Shift origin to position
390 
391  corners3DU[ii] = SFVEC2F( corners[ii].x * m_biuTo3Dunits,
392  -corners[ii].y * m_biuTo3Dunits );
393  }
394 
395 
396  // Learn more at:
397  // https://lists.launchpad.net/kicad-developers/msg18729.html
398 
399  // Add the PAD polygon
400  aDstContainer->Add( new CPOLYGON4PTS2D( corners3DU[0],
401  corners3DU[1],
402  corners3DU[2],
403  corners3DU[3],
404  *aPad ) );
405 
406  // Add the PAD contours
407  // Round segments cannot have 0-length elements, so we approximate them
408  // as a small circle
409  for( int i = 1; i <= 4; i++ )
410  {
411  if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
412  {
413  aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
414  aClearanceValue.x * m_biuTo3Dunits,
415  *aPad ) );
416  }
417  else
418  {
419  aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
420  corners3DU[i & 3],
421  aClearanceValue.x * 2.0f * m_biuTo3Dunits,
422  *aPad ) );
423  }
424  }
425  }
426  break;
427 
428  case PAD_SHAPE_ROUNDRECT:
429  {
430  wxSize shapesize( aPad->GetSize() );
431  shapesize.x += aClearanceValue.x * 2;
432  shapesize.y += aClearanceValue.y * 2;
433 
434  int rounding_radius = aPad->GetRoundRectCornerRadius( shapesize );
435 
436  wxPoint corners[4];
437 
438  GetRoundRectCornerCenters( corners,
439  rounding_radius,
440  PadShapePos,
441  shapesize,
442  aPad->GetOrientation() );
443 
444  SFVEC2F corners3DU[4];
445 
446  for( unsigned int ii = 0; ii < 4; ++ii )
447  corners3DU[ii] = SFVEC2F( corners[ii].x * m_biuTo3Dunits,
448  -corners[ii].y * m_biuTo3Dunits );
449 
450  // Add the PAD polygon (For some reason the corners need
451  // to be inverted to display with the correctly orientation)
452  aDstContainer->Add( new CPOLYGON4PTS2D( corners3DU[0],
453  corners3DU[3],
454  corners3DU[2],
455  corners3DU[1],
456  *aPad ) );
457 
458  // Add the PAD contours
459  // Round segments cannot have 0-length elements, so we approximate them
460  // as a small circle
461  for( int i = 1; i <= 4; i++ )
462  {
463  if( Is_segment_a_circle( corners3DU[i - 1], corners3DU[i & 3] ) )
464  {
465  aDstContainer->Add( new CFILLEDCIRCLE2D( corners3DU[i - 1],
466  rounding_radius * m_biuTo3Dunits,
467  *aPad ) );
468  }
469  else
470  {
471  aDstContainer->Add( new CROUNDSEGMENT2D( corners3DU[i - 1],
472  corners3DU[i & 3],
473  rounding_radius * 2.0f * m_biuTo3Dunits,
474  *aPad ) );
475  }
476  }
477  }
478  break;
479 
481  {
482  wxSize shapesize( aPad->GetSize() );
483  shapesize.x += aClearanceValue.x * 2;
484  shapesize.y += aClearanceValue.y * 2;
485 
486  SHAPE_POLY_SET polyList; // Will contain the pad outlines in board coordinates
487 
488  int corner_radius = aPad->GetRoundRectCornerRadius( shapesize );
489  TransformRoundChamferedRectToPolygon( polyList, PadShapePos, shapesize, aPad->GetOrientation(),
490  corner_radius, aPad->GetChamferRectRatio(),
491  aPad->GetChamferPositions(), ARC_HIGH_DEF );
492 
493  // Add the PAD polygon
494  Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits, *aPad );
495 
496  }
497  break;
498 
499  case PAD_SHAPE_CUSTOM:
500  {
501  SHAPE_POLY_SET polyList; // Will contain the pad outlines in board coordinates
502  polyList.Append( aPad->GetCustomShapeAsPolygon() );
503  aPad->CustomShapeAsPolygonToBoardPosition( &polyList, aPad->ShapePos(), aPad->GetOrientation() );
504 
505  if( aClearanceValue.x )
506  polyList.Inflate( aClearanceValue.x, 32 );
507 
508  // Add the PAD polygon
509  Convert_shape_line_polygon_to_triangles( polyList, *aDstContainer, m_biuTo3Dunits, *aPad );
510 
511  }
512  break;
513  }
514 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:720
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
SHAPE_POLY_SET.
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:697
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: cinfo3d_visu.h:666
void TransformRoundChamferedRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aApproxErrorMax, int aMinSegPerCircleCount=16)
convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corner...
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
This handles simple polygons with 4 points.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:422
void CustomShapeAsPolygonToBoardPosition(SHAPE_POLY_SET *aMergedPolygon, wxPoint aPosition, double aRotation) const
When created, the corners coordinates are relative to the pad position, orientation 0,...
wxPoint ShapePos() const
Definition: class_pad.cpp:570
const SHAPE_POLY_SET & GetCustomShapeAsPolygon() const
Accessor to the custom shape as one polygon.
Definition: class_pad.h:374
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:573
void GetRoundRectCornerCenters(wxPoint aCenters[4], int aRadius, const wxPoint &aPosition, const wxSize &aSize, double aRotation)
Helper function GetRoundRectCornerCenters Has meaning only for rounded rect Returns the centers of th...
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
const wxSize & GetSize() const
Definition: class_pad.h:300
void Convert_shape_line_polygon_to_triangles(SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References CGENERICCONTAINER2D::Add(), SHAPE_POLY_SET::Append(), D_PAD::BuildPadPolygon(), Convert_shape_line_polygon_to_triangles(), D_PAD::CustomShapeAsPolygonToBoardPosition(), D_PAD::GetChamferPositions(), D_PAD::GetChamferRectRatio(), D_PAD::GetCustomShapeAsPolygon(), D_PAD::GetOrientation(), GetRoundRectCornerCenters(), D_PAD::GetRoundRectCornerRadius(), D_PAD::GetShape(), D_PAD::GetSize(), SHAPE_POLY_SET::Inflate(), Is_segment_a_circle(), m_biuTo3Dunits, m_logTrace, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, RotatePoint(), D_PAD::ShapePos(), TransformRoundChamferedRectToPolygon(), wxPoint::x, and wxPoint::y.

Referenced by AddPadsShapesWithClearanceToContainer().

◆ createNewTrack()

COBJECT2D * CINFO3D_VISU::createNewTrack ( const TRACK aTrack,
int  aClearanceValue 
) const
private

Definition at line 237 of file create_3Dgraphic_brd_items.cpp.

239 {
240  SFVEC2F start3DU( aTrack->GetStart().x * m_biuTo3Dunits,
241  -aTrack->GetStart().y * m_biuTo3Dunits ); // y coord is inverted
242 
243  switch( aTrack->Type() )
244  {
245  case PCB_VIA_T:
246  {
247  const float radius = ( ( aTrack->GetWidth() / 2 ) + aClearanceValue ) * m_biuTo3Dunits;
248 
249  return new CFILLEDCIRCLE2D( start3DU, radius, *aTrack );
250  }
251  break;
252 
253  default:
254  {
255  wxASSERT( aTrack->Type() == PCB_TRACE_T );
256 
257  SFVEC2F end3DU ( aTrack->GetEnd().x * m_biuTo3Dunits,
258  -aTrack->GetEnd().y * m_biuTo3Dunits );
259 
260  // Cannot add segments that have the same start and end point
261  if( Is_segment_a_circle( start3DU, end3DU ) )
262  {
263  const float radius = ((aTrack->GetWidth() / 2) + aClearanceValue) * m_biuTo3Dunits;
264 
265  return new CFILLEDCIRCLE2D( start3DU, radius, *aTrack );
266  }
267  else
268  {
269  const float width = (aTrack->GetWidth() + 2 * aClearanceValue ) * m_biuTo3Dunits;
270 
271  return new CROUNDSEGMENT2D( start3DU, end3DU, width, *aTrack );
272  }
273  }
274  break;
275  }
276 
277  return NULL;
278 }
const wxPoint & GetStart() const
Definition: class_track.h:109
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
#define NULL
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
int GetWidth() const
Definition: class_track.h:103
const wxPoint & GetEnd() const
Definition: class_track.h:106
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

References TRACK::GetEnd(), TRACK::GetStart(), TRACK::GetWidth(), Is_segment_a_circle(), m_biuTo3Dunits, NULL, PCB_TRACE_T, PCB_VIA_T, EDA_ITEM::Type(), wxPoint::x, and wxPoint::y.

Referenced by createLayers().

◆ destroyLayers()

void CINFO3D_VISU::destroyLayers ( )
private

Definition at line 61 of file create_layer_items.cpp.

62 {
63  if( !m_layers_poly.empty() )
64  {
65  for( MAP_POLY::iterator ii = m_layers_poly.begin();
66  ii != m_layers_poly.end();
67  ++ii )
68  {
69  delete ii->second;
70  ii->second = NULL;
71  }
72 
73  m_layers_poly.clear();
74  }
75 
76  if( !m_layers_inner_holes_poly.empty() )
77  {
78  for( MAP_POLY::iterator ii = m_layers_inner_holes_poly.begin();
79  ii != m_layers_inner_holes_poly.end();
80  ++ii )
81  {
82  delete ii->second;
83  ii->second = NULL;
84  }
85 
87  }
88 
89  if( !m_layers_outer_holes_poly.empty() )
90  {
91  for( MAP_POLY::iterator ii = m_layers_outer_holes_poly.begin();
92  ii != m_layers_outer_holes_poly.end();
93  ++ii )
94  {
95  delete ii->second;
96  ii->second = NULL;
97  }
98 
100  }
101 
102  if( !m_layers_container2D.empty() )
103  {
104  for( MAP_CONTAINER_2D::iterator ii = m_layers_container2D.begin();
105  ii != m_layers_container2D.end();
106  ++ii )
107  {
108  delete ii->second;
109  ii->second = NULL;
110  }
111 
112  m_layers_container2D.clear();
113  }
114 
115  if( !m_layers_holes2D.empty() )
116  {
117  for( MAP_CONTAINER_2D::iterator ii = m_layers_holes2D.begin();
118  ii != m_layers_holes2D.end();
119  ++ii )
120  {
121  delete ii->second;
122  ii->second = NULL;
123  }
124 
125  m_layers_holes2D.clear();
126  }
127 
134  //m_through_inner_holes_poly.RemoveAllContours();
135 
138 }
CBVHCONTAINER2D m_through_holes_vias_outer
It contains the list of throughHoles vias of the board, the radius of the hole is inflated with the c...
Definition: cinfo3d_visu.h:595
MAP_POLY m_layers_inner_holes_poly
It contains polygon contours for holes of each layer (inner holes)
Definition: cinfo3d_visu.h:556
CBVHCONTAINER2D m_through_holes_inner
It contains the list of throughHoles of the board, the radius is the inner hole.
Definition: cinfo3d_visu.h:591
MAP_CONTAINER_2D m_layers_container2D
It contains the 2d elements of each layer.
Definition: cinfo3d_visu.h:580
MAP_POLY m_layers_poly
It contains polygon contours for each layer.
Definition: cinfo3d_visu.h:550
SHAPE_POLY_SET m_through_inner_holes_vias_poly
It contains polygon contours for through holes vias (inner cylinder)
Definition: cinfo3d_visu.h:571
#define NULL
SHAPE_POLY_SET m_through_outer_holes_poly_NPTH
It contains polygon contours for (just) non plated through holes (outer cylinder)
Definition: cinfo3d_visu.h:559
MAP_POLY m_layers_outer_holes_poly
It contains polygon contours for holes of each layer (outer holes)
Definition: cinfo3d_visu.h:553
SHAPE_POLY_SET m_through_outer_holes_poly
It contains polygon contours for through holes (outer cylinder)
Definition: cinfo3d_visu.h:562
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
MAP_CONTAINER_2D m_layers_holes2D
It contains the holes per each layer.
Definition: cinfo3d_visu.h:583
CBVHCONTAINER2D m_through_holes_vias_inner
It contains the list of throughHoles vias of the board, the radius of the hole.
Definition: cinfo3d_visu.h:599
SHAPE_POLY_SET m_through_outer_holes_vias_poly
It contains polygon contours for through holes vias (outer cylinder)
Definition: cinfo3d_visu.h:568
CBVHCONTAINER2D m_through_holes_outer
It contains the list of throughHoles of the board, the radius of the hole is inflated with the copper...
Definition: cinfo3d_visu.h:587

References CGENERICCONTAINER2D::Clear(), m_layers_container2D, m_layers_holes2D, m_layers_inner_holes_poly, m_layers_outer_holes_poly, m_layers_poly, m_through_holes_inner, m_through_holes_outer, m_through_holes_vias_inner, m_through_holes_vias_outer, m_through_inner_holes_vias_poly, m_through_outer_holes_poly, m_through_outer_holes_poly_NPTH, m_through_outer_holes_vias_poly, NULL, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by createLayers(), and ~CINFO3D_VISU().

◆ Get3DCacheManager()

S3D_CACHE* CINFO3D_VISU::Get3DCacheManager ( ) const
inline

Get3DCacheManager - Return the 3d cache manager pointer.

Returns

Definition at line 88 of file cinfo3d_visu.h.

88 { return m_3d_model_manager; }
S3D_CACHE * m_3d_model_manager
pointer to the 3d model manager
Definition: cinfo3d_visu.h:514

References m_3d_model_manager.

Referenced by C3D_RENDER_OGL_LEGACY::load_3D_models(), and C3D_RENDER_RAYTRACING::load_3D_models().

◆ GetBBox3DU()

const CBBOX& CINFO3D_VISU::GetBBox3DU ( ) const
inline

GetBBox3DU - Get the bbox of the pcb board.

Returns
the board bbox in 3d units

Definition at line 147 of file cinfo3d_visu.h.

147 { return m_boardBoundingBox; }
CBBOX m_boardBoundingBox
3d bounding box of the pcb board in 3d units
Definition: cinfo3d_visu.h:547

References m_boardBoundingBox.

Referenced by EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position(), and C3D_RENDER_RAYTRACING::reload().

◆ GetBoard()

◆ GetBoardCenter3DU()

const SFVEC3F& CINFO3D_VISU::GetBoardCenter3DU ( ) const
inline

GetBoardCenter - the board center position in 3d units.

Returns
board center vector position in 3d units

Definition at line 189 of file cinfo3d_visu.h.

189 { return m_boardCenter; }
SFVEC3F m_boardCenter
3d center position of the pcb board in 3d units
Definition: cinfo3d_visu.h:541

References m_boardCenter.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

◆ GetBoardPoly()

const SHAPE_POLY_SET& CINFO3D_VISU::GetBoardPoly ( ) const
inline

GetBoardPoly - Get the current polygon of the epoxy board.

Returns
the shape polygon

Definition at line 252 of file cinfo3d_visu.h.

252 { return m_board_poly; }
SHAPE_POLY_SET m_board_poly
PCB board outline polygon.
Definition: cinfo3d_visu.h:574

References m_board_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

◆ GetBoardPosBIU()

wxPoint CINFO3D_VISU::GetBoardPosBIU ( ) const
inline

GetBoardPosBIU - Get the board size.

Returns
size in BIU unities

Definition at line 183 of file cinfo3d_visu.h.

183 { return m_boardPos; }
wxPoint m_boardPos
center board actual position in board units
Definition: cinfo3d_visu.h:535

References m_boardPos.

Referenced by C3D_RENDER_OGL_LEGACY::generate_new_3DGrid().

◆ GetBoardSizeBIU()

wxSize CINFO3D_VISU::GetBoardSizeBIU ( ) const
inline

GetBoardSizeBIU - Get the board size.

Returns
size in BIU unities

Definition at line 177 of file cinfo3d_visu.h.

177 { return m_boardSize; }
wxSize m_boardSize
board actual size in board units
Definition: cinfo3d_visu.h:538

References m_boardSize.

Referenced by C3D_RENDER_OGL_LEGACY::generate_new_3DGrid().

◆ GetCircleCorrectionFactor()

double CINFO3D_VISU::GetCircleCorrectionFactor ( int  aNrSides) const

GetCircleCorrectionFactor - computes a angle correction factor used when creating circles.

Parameters
aNrSidesthe number of segments sides of the circle
Returns
a factor to apply to contour creation

Definition at line 265 of file cinfo3d_visu.cpp.

266 {
267  wxASSERT( aNrSides >= 3 );
268 
269  return GetCircletoPolyCorrectionFactor( aNrSides );
270 }
double GetCircletoPolyCorrectionFactor(int aSegCountforCircle)

References GetCircletoPolyCorrectionFactor().

Referenced by C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads().

◆ GetColor()

SFVEC3F CINFO3D_VISU::GetColor ( COLOR4D  aColor) const

GetColor.

Parameters
aColorthe color mapped
Returns
the color in SFVEC3F format

Definition at line 520 of file cinfo3d_visu.cpp.

521 {
522  return SFVEC3F( aColor.r, aColor.g, aColor.b );
523 }
double g
Green component.
Definition: color4d.h:302
double b
Blue component.
Definition: color4d.h:303
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
double r
Red component.
Definition: color4d.h:301

References KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, and KIGFX::COLOR4D::r.

Referenced by C3D_RENDER_OGL_LEGACY::generate_new_3DGrid(), and GetItemColor().

◆ GetCopperThickness3DU()

float CINFO3D_VISU::GetCopperThickness3DU ( ) const
inline

GetCopperThickness3DU - Get the current copper layer thickness.

Returns
thickness in 3d unities of copperlayers

Definition at line 165 of file cinfo3d_visu.h.

165 { return m_copperThickness3DU; }
float m_copperThickness3DU
Copper thickness (normalized)
Definition: cinfo3d_visu.h:618

References m_copperThickness3DU.

Referenced by createLayers(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), C3D_RENDER_RAYTRACING::insert3DPadHole(), and C3D_RENDER_RAYTRACING::insert3DViaHole().

◆ GetCopperThicknessBIU()

int CINFO3D_VISU::GetCopperThicknessBIU ( ) const

GetCopperThicknessBIU - Get the current copper layer thickness.

Returns
thickness in board unities

Definition at line 243 of file cinfo3d_visu.cpp.

244 {
245  return COPPER_THICKNESS;
246 }
#define COPPER_THICKNESS

References COPPER_THICKNESS.

Referenced by createLayers(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), C3D_RENDER_RAYTRACING::insert3DPadHole(), and C3D_RENDER_RAYTRACING::insert3DViaHole().

◆ GetEpoxyThickness3DU()

float CINFO3D_VISU::GetEpoxyThickness3DU ( ) const
inline

GetEpoxyThickness3DU - Get the current epoxy thickness.

Returns
thickness in 3d unities

Definition at line 153 of file cinfo3d_visu.h.

153 { return m_epoxyThickness3DU; }
float m_epoxyThickness3DU
Epoxy thickness (normalized)
Definition: cinfo3d_visu.h:621

References m_epoxyThickness3DU.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

◆ GetFlag()

◆ GetItemColor()

SFVEC3F CINFO3D_VISU::GetItemColor ( int  aItemId) const

GetItemColor - get the technical color of a layer.

Parameters
aItemIdthe item id to get the color information
Returns
the color in SFVEC3F format

Definition at line 514 of file cinfo3d_visu.cpp.

515 {
516  return GetColor( m_board->Colors().GetItemColor( aItemId ) );
517 }
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
SFVEC3F GetColor(COLOR4D aColor) const
GetColor.
const COLORS_DESIGN_SETTINGS & Colors() const
Function GetColorSettings.
Definition: class_board.h:560

References BOARD::Colors(), GetColor(), COLORS_DESIGN_SETTINGS::GetItemColor(), and m_board.

Referenced by C3D_RENDER_RAYTRACING::insert3DPadHole(), and C3D_RENDER_RAYTRACING::insert3DViaHole().

◆ GetLayerBottomZpos3DU()

float CINFO3D_VISU::GetLayerBottomZpos3DU ( PCB_LAYER_ID  aLayerId) const
inline

GetLayerBottomZpos3DU - Get the bottom z position.

Parameters
aLayerIdlayer id
Returns
position in 3D unities

Definition at line 287 of file cinfo3d_visu.h.

287 { return m_layerZcoordBottom[aLayerId]; }
float m_layerZcoordBottom[PCB_LAYER_ID_COUNT]
Bottom (Start) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:615

References m_layerZcoordBottom.

Referenced by C3D_RENDER_OGL_LEGACY::get_layer_z_pos(), C3D_RENDER_RAYTRACING::insert3DPadHole(), C3D_RENDER_RAYTRACING::insert3DViaHole(), C3D_RENDER_OGL_LEGACY::Redraw(), and C3D_RENDER_RAYTRACING::reload().

◆ GetLayerColor()

SFVEC3F CINFO3D_VISU::GetLayerColor ( PCB_LAYER_ID  aLayerId) const

GetLayerColor - get the technical color of a layer.

Parameters
aLayerIdthe layer to get the color information
Returns
the color in SFVEC3F format

Definition at line 504 of file cinfo3d_visu.cpp.

505 {
506  wxASSERT( aLayerId < PCB_LAYER_ID_COUNT );
507 
508  const COLOR4D color = m_board->Colors().GetLayerColor( aLayerId );
509 
510  return SFVEC3F( color.r, color.g, color.b );
511 }
int color
Definition: DXF_plotter.cpp:61
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
const COLORS_DESIGN_SETTINGS & Colors() const
Function GetColorSettings.
Definition: class_board.h:560
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References color, BOARD::Colors(), COLORS_DESIGN_SETTINGS::GetLayerColor(), m_board, and PCB_LAYER_ID_COUNT.

Referenced by C3D_RENDER_OGL_LEGACY::get_layer_color(), and C3D_RENDER_RAYTRACING::reload().

◆ GetLayerTopZpos3DU()

float CINFO3D_VISU::GetLayerTopZpos3DU ( PCB_LAYER_ID  aLayerId) const
inline

GetLayerTopZpos3DU - Get the top z position.

Parameters
aLayerIdlayer id
Returns
position in 3D unities

Definition at line 280 of file cinfo3d_visu.h.

280 { return m_layerZcoordTop[aLayerId]; }
float m_layerZcoordTop[PCB_LAYER_ID_COUNT]
Top (End) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:612

References m_layerZcoordTop.

Referenced by C3D_RENDER_OGL_LEGACY::get_layer_z_pos(), C3D_RENDER_OGL_LEGACY::Redraw(), and C3D_RENDER_RAYTRACING::reload().

◆ GetMapLayers()

const MAP_CONTAINER_2D& CINFO3D_VISU::GetMapLayers ( ) const
inline

GetMapLayers - Get the map of container that have the objects per layer.

Returns
the map containers of this board

Definition at line 293 of file cinfo3d_visu.h.

293 { return m_layers_container2D; }
MAP_CONTAINER_2D m_layers_container2D
It contains the 2d elements of each layer.
Definition: cinfo3d_visu.h:580

References m_layers_container2D.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

◆ GetMapLayersHoles()

const MAP_CONTAINER_2D& CINFO3D_VISU::GetMapLayersHoles ( ) const
inline

GetMapLayersHoles -Get the map of container that have the holes per layer.

Returns
the map containers of holes from this board

Definition at line 299 of file cinfo3d_visu.h.

299 { return m_layers_holes2D; }
MAP_CONTAINER_2D m_layers_holes2D
It contains the holes per each layer.
Definition: cinfo3d_visu.h:583

References m_layers_holes2D.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

◆ GetModulesZcoord3DIU()

float CINFO3D_VISU::GetModulesZcoord3DIU ( bool  aIsFlipped) const

GetModulesZcoord3DIU - Get the position of the module in 3d integer units considering if it is flipped or not.

Parameters
aIsFlippedtrue for use in modules on Front (top) layer, false if module is on back (bottom) layer
Returns
the Z position of 3D shapes, in 3D integer units

Definition at line 469 of file cinfo3d_visu.cpp.

470 {
471  if( aIsFlipped )
472  {
473  if( GetFlag( FL_SOLDERPASTE ) )
475  else
477  }
478  else
479  {
480  if( GetFlag( FL_SOLDERPASTE ) )
481  return m_layerZcoordTop[F_SilkS];
482  else
483  return m_layerZcoordTop[F_Paste];
484  }
485 }
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
float m_layerZcoordBottom[PCB_LAYER_ID_COUNT]
Bottom (Start) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:615
float m_layerZcoordTop[PCB_LAYER_ID_COUNT]
Top (End) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:612

References B_Paste, B_SilkS, F_Paste, F_SilkS, FL_SOLDERPASTE, GetFlag(), m_layerZcoordBottom, and m_layerZcoordTop.

Referenced by C3D_RENDER_RAYTRACING::load_3D_models(), and C3D_RENDER_OGL_LEGACY::render_3D_module().

◆ GetNonCopperLayerThickness3DU()

float CINFO3D_VISU::GetNonCopperLayerThickness3DU ( ) const
inline

GetNonCopperLayerThickness3DU - Get the current non copper layers thickness.

Returns
thickness in 3d unities of non copperlayers

Definition at line 159 of file cinfo3d_visu.h.

float m_nonCopperLayerThickness3DU
Non copper layers thickness.
Definition: cinfo3d_visu.h:624

References m_nonCopperLayerThickness3DU.

Referenced by C3D_RENDER_OGL_LEGACY::render_solder_mask_layer(), and C3D_RENDER_RAYTRACING::shadeHit().

◆ GetNrSegmentsCircle() [1/2]

unsigned int CINFO3D_VISU::GetNrSegmentsCircle ( float  aDiameter3DU) const

GetNrSegmentsCircle.

Parameters
aDiameter3DUdiameter in 3DU
Returns
number of sides that should be used in that circle

Definition at line 248 of file cinfo3d_visu.cpp.

249 {
250  wxASSERT( aDiameter3DU > 0.0f );
251 
252  return GetNrSegmentsCircle( (int)( aDiameter3DU / m_biuTo3Dunits ) );
253 }
unsigned int GetNrSegmentsCircle(float aDiameter3DU) const
GetNrSegmentsCircle.
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609

References m_biuTo3Dunits.

Referenced by C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer(), AddShapeWithClearanceToContainer(), buildPadShapePolygon(), and C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads().

◆ GetNrSegmentsCircle() [2/2]

unsigned int CINFO3D_VISU::GetNrSegmentsCircle ( int  aDiameterBIU) const

GetNrSegmentsCircle.

Parameters
aDiameterBIUdiameter in board internal units
Returns
number of sides that should be used in that circle

Definition at line 256 of file cinfo3d_visu.cpp.

257 {
258  wxASSERT( aDiameterBIU > 0 );
259 
260  // Require at least 3 segments for a circle
261  return std::max( GetArcToSegmentCount( aDiameterBIU / 2, ARC_HIGH_DEF, 360.0 ), 3 );
262 }
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)

References GetArcToSegmentCount().

◆ GetPolyMap()

const MAP_POLY& CINFO3D_VISU::GetPolyMap ( ) const
inline

GetPolyMap - Get maps of polygons's layers.

Returns
the map with polygons's layers

Definition at line 414 of file cinfo3d_visu.h.

414 { return m_layers_poly; }
MAP_POLY m_layers_poly
It contains polygon contours for each layer.
Definition: cinfo3d_visu.h:550

References m_layers_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetPolyMapHoles_Inner()

const MAP_POLY& CINFO3D_VISU::GetPolyMapHoles_Inner ( ) const
inline

Definition at line 416 of file cinfo3d_visu.h.

416 { return m_layers_inner_holes_poly; }
MAP_POLY m_layers_inner_holes_poly
It contains polygon contours for holes of each layer (inner holes)
Definition: cinfo3d_visu.h:556

References m_layers_inner_holes_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetPolyMapHoles_Outer()

const MAP_POLY& CINFO3D_VISU::GetPolyMapHoles_Outer ( ) const
inline

Definition at line 418 of file cinfo3d_visu.h.

418 { return m_layers_outer_holes_poly; }
MAP_POLY m_layers_outer_holes_poly
It contains polygon contours for holes of each layer (outer holes)
Definition: cinfo3d_visu.h:553

References m_layers_outer_holes_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetStats_Med_Hole_Diameter3DU()

float CINFO3D_VISU::GetStats_Med_Hole_Diameter3DU ( ) const
inline

GetStats_Med_Hole_Diameter3DU - Average diameter of holes.

Returns
dimension in 3D units

Definition at line 380 of file cinfo3d_visu.h.

380 { return m_stats_hole_med_diameter; }
float m_stats_hole_med_diameter
Computed medium diameter of the holes in 3D units.
Definition: cinfo3d_visu.h:658

References m_stats_hole_med_diameter.

Referenced by C3D_RENDER_RAYTRACING::reload().

◆ GetStats_Med_Track_Width()

float CINFO3D_VISU::GetStats_Med_Track_Width ( ) const
inline

GetStats_Med_Track_Width - Average width of the tracks.

Returns
dimensions in 3D units

Definition at line 386 of file cinfo3d_visu.h.

386 { return m_stats_track_med_width; }
float m_stats_track_med_width
Track average width.
Definition: cinfo3d_visu.h:646

References m_stats_track_med_width.

◆ GetStats_Med_Via_Hole_Diameter3DU()

float CINFO3D_VISU::GetStats_Med_Via_Hole_Diameter3DU ( ) const
inline

GetStats_Med_Via_Hole_Diameter3DU - Average diameter of the via holes.

Returns
dimension in 3D units

Definition at line 374 of file cinfo3d_visu.h.

float m_stats_via_med_hole_diameter
Computed medium diameter of the via holes in 3D units.
Definition: cinfo3d_visu.h:652

References m_stats_via_med_hole_diameter.

Referenced by C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), and C3D_RENDER_RAYTRACING::reload().

◆ GetStats_Nr_Holes()

unsigned int CINFO3D_VISU::GetStats_Nr_Holes ( ) const
inline

GetStats_Nr_Holes - Get statistics of the nr of holes.

Returns
number of holes

Definition at line 368 of file cinfo3d_visu.h.

368 { return m_stats_nr_holes; }
unsigned int m_stats_nr_holes
number of holes in the board
Definition: cinfo3d_visu.h:655

References m_stats_nr_holes.

Referenced by C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), and C3D_RENDER_RAYTRACING::reload().

◆ GetStats_Nr_Vias()

unsigned int CINFO3D_VISU::GetStats_Nr_Vias ( ) const
inline

GetStats_Nr_Vias - Get statistics of the nr of vias.

Returns
number of vias

Definition at line 362 of file cinfo3d_visu.h.

362 { return m_stats_nr_vias; }
unsigned int m_stats_nr_vias
Nr of vias.
Definition: cinfo3d_visu.h:649

References m_stats_nr_vias.

Referenced by C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), and C3D_RENDER_RAYTRACING::reload().

◆ GetThroughHole_Inner()

const CBVHCONTAINER2D& CINFO3D_VISU::GetThroughHole_Inner ( ) const
inline

GetThroughHole_Inner - Get the ThroughHole container.

Returns
a container with holes

Definition at line 350 of file cinfo3d_visu.h.

350 { return m_through_holes_inner; }
CBVHCONTAINER2D m_through_holes_inner
It contains the list of throughHoles of the board, the radius is the inner hole.
Definition: cinfo3d_visu.h:591

References m_through_holes_inner.

Referenced by C3D_RENDER_RAYTRACING::insert3DPadHole(), and C3D_RENDER_OGL_LEGACY::reload().

◆ GetThroughHole_Inner_poly()

const SHAPE_POLY_SET& CINFO3D_VISU::GetThroughHole_Inner_poly ( ) const
inline

GetThroughHole_Inner_poly -.

Returns

Definition at line 356 of file cinfo3d_visu.h.

356 { return m_through_inner_holes_poly; }
SHAPE_POLY_SET m_through_inner_holes_poly
It contains polygon contours for through holes (inner cylinder)
Definition: cinfo3d_visu.h:565

References m_through_inner_holes_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetThroughHole_Outer()

const CBVHCONTAINER2D& CINFO3D_VISU::GetThroughHole_Outer ( ) const
inline

GetThroughHole_Outer - Get the inflated ThroughHole container.

Returns
a container with holes

Definition at line 305 of file cinfo3d_visu.h.

305 { return m_through_holes_outer; }
CBVHCONTAINER2D m_through_holes_outer
It contains the list of throughHoles of the board, the radius of the hole is inflated with the copper...
Definition: cinfo3d_visu.h:587

References m_through_holes_outer.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

◆ GetThroughHole_Outer_poly()

const SHAPE_POLY_SET& CINFO3D_VISU::GetThroughHole_Outer_poly ( ) const
inline

GetThroughHole_Outer_poly -.

Returns

Definition at line 311 of file cinfo3d_visu.h.

311 { return m_through_outer_holes_poly; }
SHAPE_POLY_SET m_through_outer_holes_poly
It contains polygon contours for through holes (outer cylinder)
Definition: cinfo3d_visu.h:562

References m_through_outer_holes_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetThroughHole_Outer_poly_NPTH()

const SHAPE_POLY_SET& CINFO3D_VISU::GetThroughHole_Outer_poly_NPTH ( ) const
inline

GetThroughHole_Outer_poly_NPTH -.

Returns

Definition at line 317 of file cinfo3d_visu.h.

317  {
SHAPE_POLY_SET m_through_outer_holes_poly_NPTH
It contains polygon contours for (just) non plated through holes (outer cylinder)
Definition: cinfo3d_visu.h:559

References m_through_outer_holes_poly_NPTH.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetThroughHole_Vias_Inner()

const CBVHCONTAINER2D& CINFO3D_VISU::GetThroughHole_Vias_Inner ( ) const
inline

GetThroughHole_Vias_Inner -.

Returns
a container with via THT holes only

Definition at line 330 of file cinfo3d_visu.h.

330 { return m_through_holes_vias_inner; }
CBVHCONTAINER2D m_through_holes_vias_inner
It contains the list of throughHoles vias of the board, the radius of the hole.
Definition: cinfo3d_visu.h:599

References m_through_holes_vias_inner.

◆ GetThroughHole_Vias_Inner_poly()

const SHAPE_POLY_SET& CINFO3D_VISU::GetThroughHole_Vias_Inner_poly ( ) const
inline

GetThroughHole_Vias_Inner_poly -.

Returns

Definition at line 343 of file cinfo3d_visu.h.

343  {
SHAPE_POLY_SET m_through_inner_holes_vias_poly
It contains polygon contours for through holes vias (inner cylinder)
Definition: cinfo3d_visu.h:571

References m_through_inner_holes_vias_poly.

◆ GetThroughHole_Vias_Outer()

const CBVHCONTAINER2D& CINFO3D_VISU::GetThroughHole_Vias_Outer ( ) const
inline

GetThroughHole_Vias_Outer -.

Returns
a container with via THT holes only

Definition at line 324 of file cinfo3d_visu.h.

324 { return m_through_holes_vias_outer; }
CBVHCONTAINER2D m_through_holes_vias_outer
It contains the list of throughHoles vias of the board, the radius of the hole is inflated with the c...
Definition: cinfo3d_visu.h:595

References m_through_holes_vias_outer.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GetThroughHole_Vias_Outer_poly()

const SHAPE_POLY_SET& CINFO3D_VISU::GetThroughHole_Vias_Outer_poly ( ) const
inline

GetThroughHole_Vias_Outer_poly -.

Returns

Definition at line 336 of file cinfo3d_visu.h.

336  {
SHAPE_POLY_SET m_through_outer_holes_vias_poly
It contains polygon contours for through holes vias (outer cylinder)
Definition: cinfo3d_visu.h:568

References m_through_outer_holes_vias_poly.

Referenced by C3D_RENDER_OGL_LEGACY::reload().

◆ GridGet()

GRID3D_TYPE CINFO3D_VISU::GridGet ( ) const
inline

GridGet - get the current grid.

Returns
space type of the grid

Definition at line 216 of file cinfo3d_visu.h.

216 { return m_3D_grid_type; }
GRID3D_TYPE m_3D_grid_type
Stores the current grid type.
Definition: cinfo3d_visu.h:523

References m_3D_grid_type.

Referenced by EDA_3D_VIEWER::CreateMenuBar(), C3D_RENDER_OGL_LEGACY::Redraw(), and EDA_3D_VIEWER::SaveSettings().

◆ GridSet()

void CINFO3D_VISU::GridSet ( GRID3D_TYPE  aGridType)
inline

GridSet - set the current grid.

Parameters
aGridType= the type space of the grid

Definition at line 222 of file cinfo3d_visu.h.

222 { m_3D_grid_type = aGridType; }
GRID3D_TYPE m_3D_grid_type
Stores the current grid type.
Definition: cinfo3d_visu.h:523

References m_3D_grid_type.

Referenced by EDA_3D_VIEWER::LoadSettings(), and EDA_3D_VIEWER::On3DGridSelection().

◆ InitSettings()

void CINFO3D_VISU::InitSettings ( REPORTER aStatusTextReporter)

InitSettings - Function to be called by the render when it need to reload the settings for the board.

Parameters
aStatusTextReporterthe pointer for the status reporter

Definition at line 273 of file cinfo3d_visu.cpp.

274 {
275  wxLogTrace( m_logTrace, wxT( "CINFO3D_VISU::InitSettings" ) );
276 
277  // Calculates the board bounding box
278  // First, use only the board outlines
279  EDA_RECT bbbox = m_board->ComputeBoundingBox( true );
280 
281  // If no outlines, use the board with items
282  if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
283  bbbox = m_board->ComputeBoundingBox( false );
284 
285  // Gives a non null size to avoid issues in zoom / scale calculations
286  if( ( bbbox.GetWidth() == 0 ) && ( bbbox.GetHeight() == 0 ) )
287  bbbox.Inflate( Millimeter2iu( 10 ) );
288 
289  m_boardSize = bbbox.GetSize();
290  m_boardPos = bbbox.Centre();
291 
292  wxASSERT( (m_boardSize.x > 0) && (m_boardSize.y > 0) );
293 
294  m_boardPos.y = -m_boardPos.y; // The y coord is inverted in 3D viewer
295 
297 
298  // Ensure the board has 2 sides for 3D views, because it is hard to find
299  // a *really* single side board in the true life...
300  if( m_copperLayersCount < 2 )
302 
303  // Calculate the convertion to apply to all positions.
305 
308 
309  // !TODO: use value defined by user (currently use default values by ctor
312 
313  // Init Z position of each layer
314  // calculate z position for each copper layer
315  // Zstart = -m_epoxyThickness / 2.0 is the z position of the back (bottom layer) (layer id = 31)
316  // Zstart = +m_epoxyThickness / 2.0 is the z position of the front (top layer) (layer id = 0)
317  // all unused copper layer z position are set to 0
318 
319  // ____==__________==________==______ <- Bottom = +m_epoxyThickness / 2.0,
320  // | | Top = Bottom + m_copperThickness
321  // |__________________________________|
322  // == == == == <- Bottom = -m_epoxyThickness / 2.0,
323  // Top = Bottom - m_copperThickness
324 
325  unsigned int layer;
326 
327  for( layer = 0; layer < m_copperLayersCount; ++layer )
328  {
329  m_layerZcoordBottom[layer] = m_epoxyThickness3DU / 2.0f -
330  (m_epoxyThickness3DU * layer / (m_copperLayersCount - 1) );
331 
332  if( layer < (m_copperLayersCount / 2) )
334  else
336  }
337 
338  #define layerThicknessMargin 1.1
339  const float zpos_offset = m_nonCopperLayerThickness3DU * layerThicknessMargin;
340 
341  // Fill remaining unused copper layers and back layer zpos
342  // with -m_epoxyThickness / 2.0
343  for( ; layer < MAX_CU_LAYERS; layer++ )
344  {
345  m_layerZcoordBottom[layer] = -(m_epoxyThickness3DU / 2.0f);
347  }
348 
349  // This is the top of the copper layer thickness.
350  const float zpos_copperTop_back = m_layerZcoordTop[B_Cu];
351  const float zpos_copperTop_front = m_layerZcoordTop[F_Cu];
352 
353  // calculate z position for each non copper layer
354  // Solder mask and Solder paste have the same Z position
355  for( int layer_id = MAX_CU_LAYERS; layer_id < PCB_LAYER_ID_COUNT; ++layer_id )
356  {
357  float zposTop;
358  float zposBottom;
359 
360  switch( layer_id )
361  {
362  case B_Adhes:
363  zposBottom = zpos_copperTop_back - 2.0f * zpos_offset;
364  zposTop = zposBottom - m_nonCopperLayerThickness3DU;
365  break;
366 
367  case F_Adhes:
368  zposBottom = zpos_copperTop_front + 2.0f * zpos_offset;
369  zposTop = zposBottom + m_nonCopperLayerThickness3DU;
370  break;
371 
372  case B_Mask:
373  case B_Paste:
374  zposBottom = zpos_copperTop_back;
375  zposTop = zpos_copperTop_back - m_nonCopperLayerThickness3DU;
376  break;
377 
378  case F_Mask:
379  case F_Paste:
380  zposTop = zpos_copperTop_front + m_nonCopperLayerThickness3DU;
381  zposBottom = zpos_copperTop_front;
382  break;
383 
384  case B_SilkS:
385  zposBottom = zpos_copperTop_back - 1.0f * zpos_offset;
386  zposTop = zposBottom - m_nonCopperLayerThickness3DU;
387  break;
388 
389  case F_SilkS:
390  zposBottom = zpos_copperTop_front + 1.0f * zpos_offset;
391  zposTop = zposBottom + m_nonCopperLayerThickness3DU;
392  break;
393 
394  // !TODO: review
395  default:
396  zposTop = zpos_copperTop_front + (layer_id - MAX_CU_LAYERS + 3.0f) * zpos_offset;
397  zposBottom = zposTop - m_nonCopperLayerThickness3DU;
398  break;
399  }
400 
401  m_layerZcoordTop[layer_id] = zposTop;
402  m_layerZcoordBottom[layer_id] = zposBottom;
403  }
404 
407  0.0f );
408 
409  SFVEC3F boardSize = SFVEC3F( m_boardSize.x * m_biuTo3Dunits,
411  0.0f );
412  boardSize /= 2.0f;
413 
414  SFVEC3F boardMin = (m_boardCenter - boardSize);
415  SFVEC3F boardMax = (m_boardCenter + boardSize);
416 
417  boardMin.z = m_layerZcoordTop[B_Adhes];
418  boardMax.z = m_layerZcoordTop[F_Adhes];
419 
420  m_boardBoundingBox = CBBOX( boardMin, boardMax );
421 
422 #ifdef PRINT_STATISTICS_3D_VIEWER
423  unsigned stats_startCreateBoardPolyTime = GetRunningMicroSecs();
424 #endif
425 
426  if( aStatusTextReporter )
427  aStatusTextReporter->Report( _( "Build board body" ) );
428 
430 
431 #ifdef PRINT_STATISTICS_3D_VIEWER
432  unsigned stats_stopCreateBoardPolyTime = GetRunningMicroSecs();
433  unsigned stats_startCreateLayersTime = stats_stopCreateBoardPolyTime;
434 #endif
435 
436  if( aStatusTextReporter )
437  aStatusTextReporter->Report( _( "Create layers" ) );
438 
439  createLayers( aStatusTextReporter );
440 
441 #ifdef PRINT_STATISTICS_3D_VIEWER
442  unsigned stats_stopCreateLayersTime = GetRunningMicroSecs();
443 
444  printf( "CINFO3D_VISU::InitSettings times\n" );
445  printf( " CreateBoardPoly: %.3f ms\n",
446  (float)( stats_stopCreateBoardPolyTime - stats_startCreateBoardPolyTime ) / 1e3 );
447  printf( " CreateLayers and holes: %.3f ms\n",
448  (float)( stats_stopCreateLayersTime - stats_startCreateLayersTime ) / 1e3 );
449  printf( "\n" );
450 #endif
451 }
CBBOX m_boardBoundingBox
3d bounding box of the pcb board in 3d units
Definition: cinfo3d_visu.h:547
wxPoint m_boardPos
center board actual position in board units
Definition: cinfo3d_visu.h:535
int GetWidth() const
Definition: eda_rect.h:119
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: cinfo3d_visu.h:63
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
float m_nonCopperLayerThickness3DU
Non copper layers thickness.
Definition: cinfo3d_visu.h:624
#define COPPER_THICKNESS
float m_epoxyThickness3DU
Epoxy thickness (normalized)
Definition: cinfo3d_visu.h:621
void createBoardPolygon()
#define layerThicknessMargin
void createLayers(REPORTER *aStatusTextReporter)
SFVEC3F m_boardCenter
3d center position of the pcb board in 3d units
Definition: cinfo3d_visu.h:541
wxSize m_boardSize
board actual size in board units
Definition: cinfo3d_visu.h:538
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: cinfo3d_visu.h:666
int GetHeight() const
Definition: eda_rect.h:120
#define TECH_LAYER_THICKNESS
#define _(s)
Definition: 3d_actions.cpp:31
unsigned GetRunningMicroSecs()
Function GetRunningMicroSecs An alternate way to calculate an elapset time (in microsecondes) to clas...
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
float m_copperThickness3DU
Copper thickness (normalized)
Definition: cinfo3d_visu.h:618
int GetCopperLayerCount() const
Function GetCopperLayerCount.
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
unsigned int m_copperLayersCount
Number of copper layers actually used by the board.
Definition: cinfo3d_visu.h:605
float m_layerZcoordBottom[PCB_LAYER_ID_COUNT]
Bottom (Start) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:615
wxPoint Centre() const
Definition: eda_rect.h:62
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Function ComputeBoundingBox calculates the bounding box containing all board items (or board edge seg...
float m_layerZcoordTop[PCB_LAYER_ID_COUNT]
Top (End) Z position of each layer (normalized)
Definition: cinfo3d_visu.h:612
CBBOX manages a bounding box defined by two SFVEC3F min max points.
Definition: cbbox.h:40
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
const wxSize GetSize() const
Definition: eda_rect.h:103

References _, B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, EDA_RECT::Centre(), BOARD::ComputeBoundingBox(), COPPER_THICKNESS, createBoardPolygon(), createLayers(), F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), EDA_RECT::GetHeight(), GetRunningMicroSecs(), EDA_RECT::GetSize(), EDA_RECT::GetWidth(), EDA_RECT::Inflate(), layerThicknessMargin, m_biuTo3Dunits, m_board, m_boardBoundingBox, m_boardCenter, m_boardPos, m_boardSize, m_copperLayersCount, m_copperThickness3DU, m_epoxyThickness3DU, m_layerZcoordBottom, m_layerZcoordTop, m_logTrace, m_nonCopperLayerThickness3DU, MAX_CU_LAYERS, PCB_LAYER_ID_COUNT, RANGE_SCALE_3D, REPORTER::Report(), TECH_LAYER_THICKNESS, wxPoint::x, and wxPoint::y.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

◆ Is3DLayerEnabled()

bool CINFO3D_VISU::Is3DLayerEnabled ( PCB_LAYER_ID  aLayer) const

Is3DLayerEnabled - Check if a layer is enabled.

Parameters
aLayerlayer ID to get status
Returns
true if layer should be displayed, false if not

Definition at line 125 of file cinfo3d_visu.cpp.

126 {
127  wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
128 
129  DISPLAY3D_FLG flg;
130 
131  // see if layer needs to be shown
132  // check the flags
133  switch( aLayer )
134  {
135  case B_Adhes:
136  case F_Adhes:
137  flg = FL_ADHESIVE;
138  break;
139 
140  case B_Paste:
141  case F_Paste:
142  flg = FL_SOLDERPASTE;
143  break;
144 
145  case B_SilkS:
146  case F_SilkS:
147  flg = FL_SILKSCREEN;
148  break;
149 
150  case B_Mask:
151  case F_Mask:
152  flg = FL_SOLDERMASK;
153  break;
154 
155  case Dwgs_User:
156  case Cmts_User:
158  return false;
159 
160  flg = FL_COMMENTS;
161  break;
162 
163  case Eco1_User:
164  case Eco2_User:
166  return false;
167 
168  flg = FL_ECO;
169  break;
170 
171  case Edge_Cuts:
173  return false;
174 
175  return true;
176  break;
177 
178  case Margin:
180  return false;
181 
182  return true;
183  break;
184 
185  case B_Cu:
186  case F_Cu:
187  return m_board->GetDesignSettings().IsLayerVisible( aLayer ) ||
189  break;
190 
191  default:
192  // the layer is an internal copper layer, used the visibility
194  {
195  // Do not render internal layers if it is overlap with the board
196  // (on OpenGL render)
197  return false;
198  }
199 
200  return m_board->GetDesignSettings().IsLayerVisible( aLayer );
201  }
202 
203  // The layer has a flag, return the flag
204  return GetFlag( flg );
205 }
bool IsLayerVisible(PCB_LAYER_ID aLayerId) const
Function IsLayerVisible tests whether a given layer is visible.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
DISPLAY3D_FLG
Flags used in rendering options.
Definition: 3d_enums.h:34
RENDER_ENGINE m_render_engine
render engine currently on use
Definition: cinfo3d_visu.h:526

References B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, FL_ADHESIVE, FL_COMMENTS, FL_ECO, FL_SHOW_BOARD_BODY, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE, FL_USE_REALISTIC_MODE, BOARD::GetDesignSettings(), GetFlag(), BOARD_DESIGN_SETTINGS::IsLayerVisible(), m_board, m_render_engine, Margin, OPENGL_LEGACY, and PCB_LAYER_ID_COUNT.

Referenced by createLayers(), and C3D_RENDER_OGL_LEGACY::reload().

◆ MaterialModeGet()

MATERIAL_MODE CINFO3D_VISU::MaterialModeGet ( ) const
inline

MaterialModeGet.

Returns
material rendering mode

Definition at line 246 of file cinfo3d_visu.h.

246 { return m_material_mode; }
MATERIAL_MODE m_material_mode
mode to render the 3d shape models material
Definition: cinfo3d_visu.h:529

References m_material_mode.

Referenced by C3D_RENDER_RAYTRACING::add_3D_models(), EDA_3D_VIEWER::CreateMenuBar(), C3D_RENDER_OGL_LEGACY::load_3D_models(), EDA_3D_VIEWER::OnUpdateUIMaterial(), and EDA_3D_VIEWER::SaveSettings().

◆ MaterialModeSet()

void CINFO3D_VISU::MaterialModeSet ( MATERIAL_MODE  aMaterialMode)
inline

MaterialModeSet.

Parameters
aMaterialMode= the render material mode

Definition at line 240 of file cinfo3d_visu.h.

240 { m_material_mode = aMaterialMode; }
MATERIAL_MODE m_material_mode
mode to render the 3d shape models material
Definition: cinfo3d_visu.h:529

References m_material_mode.

Referenced by EDA_3D_VIEWER::LoadSettings(), and EDA_3D_VIEWER::Process_Special_Functions().

◆ RenderEngineGet()

RENDER_ENGINE CINFO3D_VISU::RenderEngineGet ( ) const
inline

◆ RenderEngineSet()

void CINFO3D_VISU::RenderEngineSet ( RENDER_ENGINE  aRenderEngine)
inline

RenderEngineSet.

Parameters
aRenderEngine= the render engine mode selected

Definition at line 228 of file cinfo3d_visu.h.

228 { m_render_engine = aRenderEngine; }
RENDER_ENGINE m_render_engine
render engine currently on use
Definition: cinfo3d_visu.h:526

References m_render_engine.

Referenced by EDA_3D_VIEWER::LoadSettings(), EDA_3D_VIEWER::OnDisableRayTracing(), EDA_3D_CANVAS::OnPaint(), and EDA_3D_VIEWER::OnRenderEngineSelection().

◆ Set3DCacheManager()

void CINFO3D_VISU::Set3DCacheManager ( S3D_CACHE aCachePointer)
inline

Set3DCacheManager - Update the Cache manager pointer.

Parameters
aCachePointerthe pointer to the 3d cache manager

Definition at line 82 of file cinfo3d_visu.h.

82 { m_3d_model_manager = aCachePointer; }
S3D_CACHE * m_3d_model_manager
pointer to the 3d model manager
Definition: cinfo3d_visu.h:514

References m_3d_model_manager.

Referenced by EDA_3D_CANVAS::ReloadRequest().

◆ SetBoard()

void CINFO3D_VISU::SetBoard ( BOARD aBoard)
inline

SetBoard - Set current board to be rendered.

Parameters
aBoardboard to process

Definition at line 122 of file cinfo3d_visu.h.

122 { m_board = aBoard; }
BOARD * m_board
Current board.
Definition: cinfo3d_visu.h:511

References m_board.

Referenced by EDA_3D_CANVAS::ReloadRequest().

◆ SetFlag()

void CINFO3D_VISU::SetFlag ( DISPLAY3D_FLG  aFlag,
bool  aState 
)

SetFlag - set the status of a flag.

Parameters
aFlagthe flag to get the status
aStatestatus to set

Definition at line 216 of file cinfo3d_visu.cpp.

217 {
218  wxASSERT( aFlag < FL_LAST );
219 
220  m_drawFlags[aFlag] = aState;
221 }
std::vector< bool > m_drawFlags
options flags to render the board
Definition: cinfo3d_visu.h:520

References FL_LAST, and m_drawFlags.

Referenced by CINFO3D_VISU(), PANEL_PREV_3D::loadCommonSettings(), EDA_3D_VIEWER::loadCommonSettings(), EDA_3D_VIEWER::LoadSettings(), EDA_3D_VIEWER::Process_Special_Functions(), EDA_3D_CANVAS::SetView3D(), and DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow().

◆ ShouldModuleBeDisplayed()

bool CINFO3D_VISU::ShouldModuleBeDisplayed ( MODULE_ATTR_T  aModuleAttributs) const

ShouldModuleBeDisplayed - Test if module should be displayed in relation to attributs and the flags.

Returns
true if module should be displayed, false if not

Definition at line 223 of file cinfo3d_visu.cpp.

224 {
225  if( ( ( aModuleAttributs == MOD_DEFAULT ) &&
227  ( ( ( aModuleAttributs & MOD_CMS) == MOD_CMS ) &&
229  ( ( ( aModuleAttributs & MOD_VIRTUAL) == MOD_VIRTUAL ) &&
231  {
232  return true;
233  }
234 
235  return false;
236 }
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:74
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
default
Definition: class_module.h:73
Virtual component: when created by copper shapes on board (Like edge card connectors,...
Definition: class_module.h:76

References FL_MODULE_ATTRIBUTES_NORMAL, FL_MODULE_ATTRIBUTES_NORMAL_INSERT, FL_MODULE_ATTRIBUTES_VIRTUAL, GetFlag(), MOD_CMS, MOD_DEFAULT, and MOD_VIRTUAL.

Referenced by C3D_RENDER_RAYTRACING::load_3D_models(), and C3D_RENDER_OGL_LEGACY::render_3D_models().

◆ TransformArcToSegments()

void CINFO3D_VISU::TransformArcToSegments ( const wxPoint aCentre,
const wxPoint aStart,
double  aArcAngle,
int  aCircleToSegmentsCount,
int  aWidth,
CGENERICCONTAINER2D aDstContainer,
const BOARD_ITEM aBoardItem 
)
private

Definition at line 634 of file create_3Dgraphic_brd_items.cpp.

641 {
642  wxPoint arc_start, arc_end;
643  int delta = 3600 / aCircleToSegmentsCount; // rotate angle in 0.1 degree
644 
645  arc_end = arc_start = aStart;
646 
647  if( aArcAngle != 3600 )
648  {
649  RotatePoint( &arc_end, aCentre, -aArcAngle );
650  }
651 
652  if( aArcAngle < 0 )
653  {
654  std::swap( arc_start, arc_end );
655  aArcAngle = -aArcAngle;
656  }
657 
658  // Compute the ends of segments and creates poly
659  wxPoint curr_end = arc_start;
660  wxPoint curr_start = arc_start;
661 
662  for( int ii = delta; ii < aArcAngle; ii += delta )
663  {
664  curr_end = arc_start;
665  RotatePoint( &curr_end, aCentre, -ii );
666 
667  const SFVEC2F start3DU( curr_start.x * m_biuTo3Dunits, -curr_start.y * m_biuTo3Dunits );
668  const SFVEC2F end3DU ( curr_end.x * m_biuTo3Dunits, -curr_end.y * m_biuTo3Dunits );
669 
670  if( Is_segment_a_circle( start3DU, end3DU ) )
671  {
672  aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU,
673  ( aWidth / 2 ) * m_biuTo3Dunits,
674  aBoardItem ) );
675  }
676  else
677  {
678  aDstContainer->Add( new CROUNDSEGMENT2D( start3DU,
679  end3DU,
680  aWidth * m_biuTo3Dunits,
681  aBoardItem ) );
682  }
683 
684  curr_start = curr_end;
685  }
686 
687  if( curr_end != arc_end )
688  {
689  const SFVEC2F start3DU( curr_end.x * m_biuTo3Dunits, -curr_end.y * m_biuTo3Dunits );
690  const SFVEC2F end3DU ( arc_end.x * m_biuTo3Dunits, -arc_end.y * m_biuTo3Dunits );
691 
692  if( Is_segment_a_circle( start3DU, end3DU ) )
693  {
694  aDstContainer->Add( new CFILLEDCIRCLE2D( start3DU,
695  ( aWidth / 2 ) * m_biuTo3Dunits,
696  aBoardItem ) );
697  }
698  else
699  {
700  aDstContainer->Add( new CROUNDSEGMENT2D( start3DU,
701  end3DU,
702  aWidth * m_biuTo3Dunits,
703  aBoardItem ) );
704  }
705  }
706 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
bool Is_segment_a_circle(const SFVEC2F &aStart, const SFVEC2F &aEnd)
Segment_is_a_circle - check if segment start and end is very close to each other should used to check...
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
double m_biuTo3Dunits
Normalization scale to convert board internal units to 3D units to normalize 3D units between -1....
Definition: cinfo3d_visu.h:609
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52

References CGENERICCONTAINER2D::Add(), Is_segment_a_circle(), m_biuTo3Dunits, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by AddShapeWithClearanceToContainer().

◆ transformGraphicModuleEdgeToPolygonSet()

void CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet ( const MODULE aModule,
PCB_LAYER_ID  aLayer,
SHAPE_POLY_SET aCornerBuffer 
) const
private

Definition at line 201 of file create_layer_poly.cpp.

204 {
205  for( auto item : aModule->GraphicalItems() )
206  {
207  switch( item->Type() )
208  {
209  case PCB_MODULE_EDGE_T:
210  {
211  EDGE_MODULE*outline = (EDGE_MODULE*) item;
212 
213  if( outline->GetLayer() != aLayer )
214  break;
215 
216  outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 );
217  }
218  break;
219 
220  default:
221  break;
222  }
223  }
224 }
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the draw segment to a closed polygon Used in fi...
DRAWINGS & GraphicalItems()
Definition: class_module.h:183
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References BOARD_ITEM::GetLayer(), MODULE::GraphicalItems(), PCB_MODULE_EDGE_T, and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

Referenced by createLayers().

◆ transformPadsShapesWithClearanceToPolygon()

void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon ( const PADS &  aPads,
PCB_LAYER_ID  aLayer,
SHAPE_POLY_SET aCornerBuffer,
int  aInflateValue,
bool  aSkipNPTHPadsWihNoCopper 
) const
private

Definition at line 142 of file create_layer_poly.cpp.

146 {
147  wxSize margin;
148  for( auto pad : aPads )
149  {
150  if( !pad->IsOnLayer(aLayer) )
151  continue;
152 
153  // NPTH pads are not drawn on layers if the shape size and pos is the same
154  // as their hole:
155  if( aSkipNPTHPadsWihNoCopper && (pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED) )
156  {
157  if( (pad->GetDrillSize() == pad->GetSize()) &&
158  (pad->GetOffset() == wxPoint( 0, 0 )) )
159  {
160  switch( pad->GetShape() )
161  {
162  case PAD_SHAPE_CIRCLE:
163  if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
164  continue;
165  break;
166 
167  case PAD_SHAPE_OVAL:
168  if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE )
169  continue;
170  break;
171 
172  default:
173  break;
174  }
175  }
176  }
177 
178  switch( aLayer )
179  {
180  case F_Mask:
181  case B_Mask:
182  margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue;
183  break;
184 
185  case F_Paste:
186  case B_Paste:
187  margin = pad->GetSolderPasteMargin();
188  margin.x += aInflateValue;
189  margin.y += aInflateValue;
190  break;
191 
192  default:
193  margin.x = margin.y = aInflateValue;
194  break;
195  }
196 
197  buildPadShapePolygon( pad, aCornerBuffer, margin );
198  }
199 }
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
void buildPadShapePolygon(const D_PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, wxSize aInflateValue) const

References B_Mask, B_Paste, buildPadShapePolygon(), F_Mask, F_Paste, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_DRILL_SHAPE_CIRCLE, PAD_SHAPE_CIRCLE, and PAD_SHAPE_OVAL.

Referenced by createLayers().

Member Data Documentation

◆ m_3D_grid_type

GRID3D_TYPE CINFO3D_VISU::m_3D_grid_type
private

Stores the current grid type.

Definition at line 523 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GridGet(), and GridSet().

◆ m_3d_model_manager

S3D_CACHE* CINFO3D_VISU::m_3d_model_manager
private

pointer to the 3d model manager

Definition at line 514 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), Get3DCacheManager(), and Set3DCacheManager().

◆ m_BgColorBot

◆ m_BgColorTop

◆ m_biuTo3Dunits

double CINFO3D_VISU::m_biuTo3Dunits
private

◆ m_board

BOARD* CINFO3D_VISU::m_board
private

◆ m_board_poly

SHAPE_POLY_SET CINFO3D_VISU::m_board_poly
private

PCB board outline polygon.

Definition at line 574 of file cinfo3d_visu.h.

Referenced by createBoardPolygon(), and GetBoardPoly().

◆ m_BoardBodyColor

◆ m_boardBoundingBox

CBBOX CINFO3D_VISU::m_boardBoundingBox
private

3d bounding box of the pcb board in 3d units

Definition at line 547 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetBBox3DU(), and InitSettings().

◆ m_boardCenter

SFVEC3F CINFO3D_VISU::m_boardCenter
private

3d center position of the pcb board in 3d units

Definition at line 541 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetBoardCenter3DU(), and InitSettings().

◆ m_boardPos

wxPoint CINFO3D_VISU::m_boardPos
private

center board actual position in board units

Definition at line 535 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetBoardPosBIU(), and InitSettings().

◆ m_boardSize

wxSize CINFO3D_VISU::m_boardSize
private

board actual size in board units

Definition at line 538 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetBoardSizeBIU(), and InitSettings().

◆ m_calc_seg_max_factor3DU

float CINFO3D_VISU::m_calc_seg_max_factor3DU
private

max factor used for cicle segment approximation calculation

Definition at line 637 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), and createLayers().

◆ m_calc_seg_min_factor3DU

float CINFO3D_VISU::m_calc_seg_min_factor3DU
private

min factor used for cicle segment approximation calculation

Definition at line 634 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), and createLayers().

◆ m_CopperColor

◆ m_copperLayersCount

unsigned int CINFO3D_VISU::m_copperLayersCount
private

Number of copper layers actually used by the board.

Definition at line 605 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), and InitSettings().

◆ m_copperThickness3DU

float CINFO3D_VISU::m_copperThickness3DU
private

Copper thickness (normalized)

Definition at line 618 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetCopperThickness3DU(), and InitSettings().

◆ m_currentCamera

CCAMERA& CINFO3D_VISU::m_currentCamera
private

Holds a pointer to current camera in use.

Definition at line 630 of file cinfo3d_visu.h.

Referenced by CameraGet(), and CameraSetType().

◆ m_drawFlags

std::vector< bool > CINFO3D_VISU::m_drawFlags
private

options flags to render the board

Definition at line 520 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetFlag(), and SetFlag().

◆ m_epoxyThickness3DU

float CINFO3D_VISU::m_epoxyThickness3DU
private

Epoxy thickness (normalized)

Definition at line 621 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetEpoxyThickness3DU(), and InitSettings().

◆ m_layers_container2D

MAP_CONTAINER_2D CINFO3D_VISU::m_layers_container2D
private

It contains the 2d elements of each layer.

Definition at line 580 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), destroyLayers(), and GetMapLayers().

◆ m_layers_holes2D

MAP_CONTAINER_2D CINFO3D_VISU::m_layers_holes2D
private

It contains the holes per each layer.

Definition at line 583 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), destroyLayers(), and GetMapLayersHoles().

◆ m_layers_inner_holes_poly

MAP_POLY CINFO3D_VISU::m_layers_inner_holes_poly
private

It contains polygon contours for holes of each layer (inner holes)

Definition at line 556 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetPolyMapHoles_Inner().

◆ m_layers_outer_holes_poly

MAP_POLY CINFO3D_VISU::m_layers_outer_holes_poly
private

It contains polygon contours for holes of each layer (outer holes)

Definition at line 553 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetPolyMapHoles_Outer().

◆ m_layers_poly

MAP_POLY CINFO3D_VISU::m_layers_poly
private

It contains polygon contours for each layer.

Definition at line 550 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetPolyMap().

◆ m_layerZcoordBottom

float CINFO3D_VISU::m_layerZcoordBottom[PCB_LAYER_ID_COUNT]
private

Bottom (Start) Z position of each layer (normalized)

Definition at line 615 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetLayerBottomZpos3DU(), GetModulesZcoord3DIU(), and InitSettings().

◆ m_layerZcoordTop

float CINFO3D_VISU::m_layerZcoordTop[PCB_LAYER_ID_COUNT]
private

Top (End) Z position of each layer (normalized)

Definition at line 612 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetLayerTopZpos3DU(), GetModulesZcoord3DIU(), and InitSettings().

◆ m_logTrace

const wxChar * CINFO3D_VISU::m_logTrace = wxT( "KI_TRACE_EDA_CINFO3D_VISU" )
staticprivate

Trace mask used to enable or disable the trace output of this class.

The debug output can be turned on by setting the WXTRACE environment variable to "KI_TRACE_EDA_CINFO3D_VISU". See the wxWidgets documentation on wxLogTrace for more information.

Definition at line 666 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), createNewPadDrill(), createNewPadWithClearance(), and InitSettings().

◆ m_material_mode

MATERIAL_MODE CINFO3D_VISU::m_material_mode
private

mode to render the 3d shape models material

Definition at line 529 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), MaterialModeGet(), and MaterialModeSet().

◆ m_nonCopperLayerThickness3DU

float CINFO3D_VISU::m_nonCopperLayerThickness3DU
private

Non copper layers thickness.

Definition at line 624 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), GetNonCopperLayerThickness3DU(), and InitSettings().

◆ m_render_engine

RENDER_ENGINE CINFO3D_VISU::m_render_engine
private

render engine currently on use

Definition at line 526 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), Is3DLayerEnabled(), RenderEngineGet(), and RenderEngineSet().

◆ m_SilkScreenColorBot

◆ m_SilkScreenColorTop

◆ m_SolderMaskColorBot

◆ m_SolderMaskColorTop

◆ m_SolderPasteColor

◆ m_stats_hole_med_diameter

float CINFO3D_VISU::m_stats_hole_med_diameter
private

Computed medium diameter of the holes in 3D units.

Definition at line 658 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), and GetStats_Med_Hole_Diameter3DU().

◆ m_stats_nr_holes

unsigned int CINFO3D_VISU::m_stats_nr_holes
private

number of holes in the board

Definition at line 655 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), and GetStats_Nr_Holes().

◆ m_stats_nr_tracks

unsigned int CINFO3D_VISU::m_stats_nr_tracks
private

Number of tracks in the board.

Definition at line 643 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), and createLayers().

◆ m_stats_nr_vias

unsigned int CINFO3D_VISU::m_stats_nr_vias
private

Nr of vias.

Definition at line 649 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), and GetStats_Nr_Vias().

◆ m_stats_track_med_width

float CINFO3D_VISU::m_stats_track_med_width
private

Track average width.

Definition at line 646 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), and GetStats_Med_Track_Width().

◆ m_stats_via_med_hole_diameter

float CINFO3D_VISU::m_stats_via_med_hole_diameter
private

Computed medium diameter of the via holes in 3D units.

Definition at line 652 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), and GetStats_Med_Via_Hole_Diameter3DU().

◆ m_through_holes_inner

CBVHCONTAINER2D CINFO3D_VISU::m_through_holes_inner
private

It contains the list of throughHoles of the board, the radius is the inner hole.

Definition at line 591 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), destroyLayers(), and GetThroughHole_Inner().

◆ m_through_holes_outer

CBVHCONTAINER2D CINFO3D_VISU::m_through_holes_outer
private

It contains the list of throughHoles of the board, the radius of the hole is inflated with the copper tickness.

Definition at line 587 of file cinfo3d_visu.h.

Referenced by CINFO3D_VISU(), createLayers(), destroyLayers(), and GetThroughHole_Outer().

◆ m_through_holes_vias_inner

CBVHCONTAINER2D CINFO3D_VISU::m_through_holes_vias_inner
private

It contains the list of throughHoles vias of the board, the radius of the hole.

Definition at line 599 of file cinfo3d_visu.h.

Referenced by destroyLayers(), and GetThroughHole_Vias_Inner().

◆ m_through_holes_vias_outer

CBVHCONTAINER2D CINFO3D_VISU::m_through_holes_vias_outer
private

It contains the list of throughHoles vias of the board, the radius of the hole is inflated with the copper tickness.

Definition at line 595 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetThroughHole_Vias_Outer().

◆ m_through_inner_holes_poly

SHAPE_POLY_SET CINFO3D_VISU::m_through_inner_holes_poly
private

It contains polygon contours for through holes (inner cylinder)

Definition at line 565 of file cinfo3d_visu.h.

Referenced by createLayers(), and GetThroughHole_Inner_poly().

◆ m_through_inner_holes_vias_poly

SHAPE_POLY_SET CINFO3D_VISU::m_through_inner_holes_vias_poly
private

It contains polygon contours for through holes vias (inner cylinder)

Definition at line 571 of file cinfo3d_visu.h.

Referenced by destroyLayers(), and GetThroughHole_Vias_Inner_poly().

◆ m_through_outer_holes_poly

SHAPE_POLY_SET CINFO3D_VISU::m_through_outer_holes_poly
private

It contains polygon contours for through holes (outer cylinder)

Definition at line 562 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetThroughHole_Outer_poly().

◆ m_through_outer_holes_poly_NPTH

SHAPE_POLY_SET CINFO3D_VISU::m_through_outer_holes_poly_NPTH
private

It contains polygon contours for (just) non plated through holes (outer cylinder)

Definition at line 559 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetThroughHole_Outer_poly_NPTH().

◆ m_through_outer_holes_vias_poly

SHAPE_POLY_SET CINFO3D_VISU::m_through_outer_holes_vias_poly
private

It contains polygon contours for through holes vias (outer cylinder)

Definition at line 568 of file cinfo3d_visu.h.

Referenced by createLayers(), destroyLayers(), and GetThroughHole_Vias_Outer_poly().

◆ m_trackBallCamera

CTRACK_BALL CINFO3D_VISU::m_trackBallCamera
private

Definition at line 631 of file cinfo3d_visu.h.

Referenced by CameraSetType().


The documentation for this class was generated from the following files: