Syntax
c=iscollofVLBB(VLA,VLB)
Input Parameter
VLA : | | Vertex list A |
VLB : | | Vertex list B |
Output Parameter
c : | | true if bounding boxes collide or attach |
Examples
Show an example
[A,B]=SGanalyzeJoint (SGsample(17));
iscollofVLBB(A.VL,B.VL)
Copyright 2016-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, iscollofVLBB
, determines if the bounding boxes of two vertex lists, VLA and VLB, collide or attach.
Input Parameters
- VLA: Vertex list A, which is a set of vertices defining a 3D object.
- VLB: Vertex list B, another set of vertices defining a 3D object.
Output
- c: A boolean value. It returns
true
if the bounding boxes of VLA and VLB collide or attach, and false
otherwise.
Algorithm Steps
- Compute the bounding box for vertex list A using the function
BBofVL(VLA)
, which returns a bounding box A.
- Compute the bounding box for vertex list B using the function
BBofVL(VLB)
, which returns a bounding box B.
- Check for collision or attachment between the bounding boxes A and B. This is done by evaluating the conditions:
B(2) < A(1)
: Checks if the maximum x-coordinate of B is less than the minimum x-coordinate of A.
A(2) < B(1)
: Checks if the maximum x-coordinate of A is less than the minimum x-coordinate of B.
B(4) < A(3)
: Checks if the maximum y-coordinate of B is less than the minimum y-coordinate of A.
A(4) < B(3)
: Checks if the maximum y-coordinate of A is less than the minimum y-coordinate of B.
B(6) < A(5)
: Checks if the maximum z-coordinate of B is less than the minimum z-coordinate of A.
A(6) < B(5)
: Checks if the maximum z-coordinate of A is less than the minimum z-coordinate of B.
- If any of these conditions are true, it means there is no collision or attachment, so
c
is set to false
. Otherwise, c
is set to true
.
- If no output argument is specified, the function visualizes the bounding boxes:
- Creates a new figure with
SGfigure
.
- Sets the view angle with
view(-30,30)
and enables the axis with axis on
.
- Generates solid geometry for the bounding boxes A and B using
SGofBB(A)
and SGofBB(B)
.
- Plots the bounding boxes with
SGplot
, using red for A and green for B.
- Adds lighting to the plot with
VLFLplotlight(1,0.5)
.
Algorithm explaination created using ChatGPT on 2025-08-18 23:53. (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