@@ -26,6 +26,7 @@ class VisConfig(Abstract.VisConfigAbstract):
2626
2727 * ``ctrlpts`` (bool): Control points polygon/grid visibility. *Default: True*
2828 * ``evalpts`` (bool): Curve/surface points visibility. *Default: True*
29+ * ``bbox`` (bool): Bounding box visibility. *Default: False*
2930 * ``legend`` (bool): Figure legend visibility. *Default: True*
3031 * ``axes`` (bool): Axes and figure grid visibility. *Default: True*
3132 * ``trims`` (bool): Trim curves visibility. *Default: True*
@@ -63,6 +64,7 @@ def __init__(self, **kwargs):
6364 self .dtype = np .float
6465 self .display_ctrlpts = kwargs .get ('ctrlpts' , True )
6566 self .display_evalpts = kwargs .get ('evalpts' , True )
67+ self .display_bbox = kwargs .get ('bbox' , False )
6668 self .display_legend = kwargs .get ('legend' , True )
6769 self .display_axes = kwargs .get ('axes' , True )
6870 self .display_trims = kwargs .get ('trims' , True )
@@ -134,6 +136,12 @@ def render(self, **kwargs):
134136 legend_proxy .append (curveplt )
135137 legend_names .append (plot ['name' ])
136138
139+ # Plot bounding box
140+ if plot ['type' ] == 'bbox' and self ._config .display_bbox :
141+ bboxplt , = plt .plot (pts [:, 0 ], pts [:, 1 ], color = plot ['color' ], linestyle = '--' )
142+ legend_proxy .append (bboxplt )
143+ legend_names .append (plot ['name' ])
144+
137145 # Add legend
138146 if self ._config .display_legend :
139147 plt .legend (legend_proxy , legend_names )
@@ -189,15 +197,22 @@ def render(self, **kwargs):
189197 # Plot control points
190198 if plot ['type' ] == 'ctrlpts' and self ._config .display_ctrlpts :
191199 ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '-.' , marker = 'o' )
192- plot1_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
193- legend_proxy .append (plot1_proxy )
200+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
201+ legend_proxy .append (plot_proxy )
194202 legend_names .append (plot ['name' ])
195203
196204 # Plot evaluated points
197205 if plot ['type' ] == 'evalpts' and self ._config .display_evalpts :
198206 ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '-' )
199- plot2_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-' , color = plot ['color' ])
200- legend_proxy .append (plot2_proxy )
207+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-' , color = plot ['color' ])
208+ legend_proxy .append (plot_proxy )
209+ legend_names .append (plot ['name' ])
210+
211+ # Plot bounding box
212+ if plot ['type' ] == 'bbox' and self ._config .display_bbox :
213+ ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '--' )
214+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '--' , color = plot ['color' ])
215+ legend_proxy .append (plot_proxy )
201216 legend_names .append (plot ['name' ])
202217
203218 # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
@@ -255,8 +270,8 @@ def render(self, **kwargs):
255270 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
256271 cp_z = pts [:, 2 ] + self ._ctrlpts_offset
257272 ax .plot (pts [:, 0 ], pts [:, 1 ], cp_z , color = plot ['color' ], linestyle = '-.' , marker = 'o' )
258- plot1_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
259- legend_proxy .append (plot1_proxy )
273+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
274+ legend_proxy .append (plot_proxy )
260275 legend_names .append (plot ['name' ])
261276
262277 # Plot evaluated points
@@ -265,8 +280,16 @@ def render(self, **kwargs):
265280 for tri in tris :
266281 pts = np .array (tri .vertices_raw , dtype = self ._config .dtype )
267282 ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ])
268- plot2_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-' , color = plot ['color' ])
269- legend_proxy .append (plot2_proxy )
283+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-' , color = plot ['color' ])
284+ legend_proxy .append (plot_proxy )
285+ legend_names .append (plot ['name' ])
286+
287+ # Plot bounding box
288+ if plot ['type' ] == 'bbox' and self ._config .display_bbox :
289+ pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
290+ ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '--' )
291+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '--' , color = plot ['color' ])
292+ legend_proxy .append (plot_proxy )
270293 legend_names .append (plot ['name' ])
271294
272295 # Plot trim curves
@@ -275,8 +298,8 @@ def render(self, **kwargs):
275298 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
276299 ax .scatter (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], marker = 'o' ,
277300 s = self ._config .trim_size , depthshade = False )
278- plot3_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
279- legend_proxy .append (plot3_proxy )
301+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
302+ legend_proxy .append (plot_proxy )
280303 legend_names .append (plot ['name' ])
281304
282305 # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
@@ -334,16 +357,24 @@ def render(self, **kwargs):
334357 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
335358 cp_z = pts [:, 2 ] + self ._ctrlpts_offset
336359 ax .scatter (pts [:, 0 ], pts [:, 1 ], cp_z , color = plot ['color' ], s = 25 , depthshade = True )
337- plot1_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
338- legend_proxy .append (plot1_proxy )
360+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
361+ legend_proxy .append (plot_proxy )
339362 legend_names .append (plot ['name' ])
340363
341364 # Plot evaluated points
342365 if plot ['type' ] == 'evalpts' and self ._config .display_evalpts :
343366 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
344367 ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ])
345- plot2_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-' , color = plot ['color' ])
346- legend_proxy .append (plot2_proxy )
368+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-' , color = plot ['color' ])
369+ legend_proxy .append (plot_proxy )
370+ legend_names .append (plot ['name' ])
371+
372+ # Plot bounding box
373+ if plot ['type' ] == 'bbox' and self ._config .display_bbox :
374+ pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
375+ ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '--' )
376+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '--' , color = plot ['color' ])
377+ legend_proxy .append (plot_proxy )
347378 legend_names .append (plot ['name' ])
348379
349380 # Plot trim curves
@@ -352,8 +383,8 @@ def render(self, **kwargs):
352383 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
353384 ax .scatter (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], marker = 'o' ,
354385 s = self ._config .trim_size , depthshade = False )
355- plot3_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
356- legend_proxy .append (plot3_proxy )
386+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
387+ legend_proxy .append (plot_proxy )
357388 legend_names .append (plot ['name' ])
358389
359390 # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
@@ -426,8 +457,8 @@ def render(self, **kwargs):
426457 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
427458 cp_z = pts [:, 2 ] + self ._ctrlpts_offset
428459 ax .plot (pts [:, 0 ], pts [:, 1 ], cp_z , color = plot ['color' ], linestyle = '-.' , marker = 'o' )
429- plot1_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
430- legend_proxy .append (plot1_proxy )
460+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
461+ legend_proxy .append (plot_proxy )
431462 legend_names .append (plot ['name' ])
432463
433464 # Plot evaluated points
@@ -456,8 +487,16 @@ def render(self, **kwargs):
456487
457488 # Use custom Triangulation object and the choice of color/colormap to plot the surface
458489 ax .plot_trisurf (triangulation , pts [:, 2 ], ** trisurf_params )
459- plot2_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = '^' )
460- legend_proxy .append (plot2_proxy )
490+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = '^' )
491+ legend_proxy .append (plot_proxy )
492+ legend_names .append (plot ['name' ])
493+
494+ # Plot bounding box
495+ if plot ['type' ] == 'bbox' and self ._config .display_bbox :
496+ pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
497+ ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '--' )
498+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '--' , color = plot ['color' ])
499+ legend_proxy .append (plot_proxy )
461500 legend_names .append (plot ['name' ])
462501
463502 # Plot trim curves
@@ -466,8 +505,8 @@ def render(self, **kwargs):
466505 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
467506 ax .scatter (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], marker = 'o' ,
468507 s = self ._config .trim_size , depthshade = False )
469- plot3_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
470- legend_proxy .append (plot3_proxy )
508+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
509+ legend_proxy .append (plot_proxy )
471510 legend_names .append (plot ['name' ])
472511
473512 # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
@@ -525,16 +564,24 @@ def render(self, **kwargs):
525564 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
526565 cp_z = pts [:, 2 ] + self ._ctrlpts_offset
527566 ax .plot (pts [:, 0 ], pts [:, 1 ], cp_z , color = plot ['color' ], linestyle = '-.' , marker = 'o' )
528- plot1_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
529- legend_proxy .append (plot1_proxy )
567+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '-.' , color = plot ['color' ], marker = 'o' )
568+ legend_proxy .append (plot_proxy )
530569 legend_names .append (plot ['name' ])
531570
532571 # Plot evaluated points
533572 if plot ['type' ] == 'evalpts' and self ._config .display_evalpts :
534573 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
535574 ax .scatter (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], s = 50 , depthshade = True )
536- plot2_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
537- legend_proxy .append (plot2_proxy )
575+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
576+ legend_proxy .append (plot_proxy )
577+ legend_names .append (plot ['name' ])
578+
579+ # Plot bounding box
580+ if plot ['type' ] == 'bbox' and self ._config .display_bbox :
581+ pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
582+ ax .plot (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], linestyle = '--' )
583+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = '--' , color = plot ['color' ])
584+ legend_proxy .append (plot_proxy )
538585 legend_names .append (plot ['name' ])
539586
540587 # Plot trim curves
@@ -543,8 +590,8 @@ def render(self, **kwargs):
543590 pts = np .array (plot ['ptsarr' ], dtype = self ._config .dtype )
544591 ax .scatter (pts [:, 0 ], pts [:, 1 ], pts [:, 2 ], color = plot ['color' ], marker = 'o' ,
545592 s = self ._config .trim_size , depthshade = False )
546- plot3_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
547- legend_proxy .append (plot3_proxy )
593+ plot_proxy = mpl .lines .Line2D ([0 ], [0 ], linestyle = 'none' , color = plot ['color' ], marker = 'o' )
594+ legend_proxy .append (plot_proxy )
548595 legend_names .append (plot ['name' ])
549596
550597 # Add legend to 3D plot, @ref: https://stackoverflow.com/a/20505720
0 commit comments