Syntax
nx=BBofBB([ax,d])
Input Parameter
ax : | | Bounding box |
d : | | scaling vector |
Output Parameter
Examples
SGbox;ax=BBofBB(axis,0.1); axis(ax)
BBofBB('',0.1);
Copyright 2021-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)
This function, BBofBB
, is designed to scale a bounding box by a specified scaling vector. It is part of the SolidGeometry library and was introduced in version 5.1. The function takes in two main parameters and returns a new bounding box.
Input Parameters
- ax: The bounding box to be scaled. It is expected to be an array representing the dimensions of the box.
- d: The scaling vector. It can be either an absolute or relative value. If
abs(d) > 1
, it is treated as an absolute value. If abs(d) < 1
, it is treated as a relative value.
Output
- nx: The new bounding box after scaling.
Algorithm Steps
- Retrieve the bounding box
ax
and scaling vector d
from the input parameters using getfuncparams
.
- Check the magnitude of
d
:
- If
abs(d) > 1
, expand d
to a three-element vector [d d d]
.
- If
abs(d) < 1
, calculate the size of the bounding box using sofBB
and scale d
accordingly.
- Initialize
nx
with the value of ax
. If ax
has four elements, extend it to six elements by adding [-0.1, 0.1]
.
- Adjust the bounding box:
- Subtract
d
from the minimum coordinates [1, 3, 5]
of nx
.
- Add
d
to the maximum coordinates [2, 4, 6]
of nx
.
- If the original bounding box
ax
had four elements, truncate nx
back to four elements.
- If no output is requested (
nargout == 0
), visualize the original and new bounding boxes:
- Display the current figure using
shg
.
- Set the title with
SGtitle
.
- Create and plot the original bounding box in red using
SGofBB
and SGplotalpha
.
- Create and plot the new bounding box in green using
SGofBB
and SGplotalpha
.
Algorithm explaination created using ChatGPT on 2025-08-19 00:44. (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