Syntax
h=bplot(VL,bs,[])
Input Parameter
VL : | | Vertex list |
bs : | | Box size |
Output Parameter
h : | | handle to graphics object |
Examples
SGfigure; h=bplot([0 0 0],20,'m--',2); view(-30,30); pause(1); delete(h)
VL=rand(10,3)*100; h=bplot(VL,20,'m--',2); view(-30,30);
Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
The function bplot
is designed to plot grid boxes at specified positions using a vertex list and box size. It is part of the SolidGeometry library and is used for visualization purposes.
Input Parameters
- VL: A matrix representing the vertex list. Each row corresponds to a vertex in 3D space.
- bs: A scalar or a vector representing the box size. If a scalar is provided, it is expanded to a 3-element vector [bs bs bs].
- varargin: Additional optional parameters for plotting, such as line style, color, and width.
Output
- h: A handle to the graphics object created by the plot, which can be used for further manipulation or deletion.
Algorithm Steps
- Initialize an empty array
h
to store handles to the graphics objects.
- Check if
bs
is a scalar. If so, convert it to a 3-element vector [bs bs bs].
- Define a 2D plane
PL
representing the base of the box using the dimensions of bs
.
- Iterate over each vertex in the vertex list
VL
:
- Calculate the lower and upper planes of the box by adding and subtracting half the box height (
bs(3)/2
) to the z-coordinate of the plane PL
.
- Translate these planes to the current vertex position.
- Plot the lower and upper planes using
VLplot
and store the handles in h
.
- Plot the vertical lines connecting corresponding vertices of the lower and upper planes using
lplot
and store the handles in h
.
Example Usage
The function can be used to plot a single box or multiple boxes at specified positions. For example:
SGfigure; h=bplot([0 0 0],20,'m--',2); view(-30,30); pause(1); delete(h)
VL=rand(10,3)*100; h=bplot(VL,20,'m--',2); view(-30,30);
In this example, a box is plotted at the origin with a size of 20 mm and a magenta dashed line style. The view is adjusted, and the box is deleted after a pause. Multiple boxes are plotted at random positions in the second example.
Algorithm explaination created using ChatGPT on 2025-08-19 01:15. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21