Syntax
VLplotvoxel(VL,[vs,c,a])
Input Parameter
VL : | | point or list of points |
vs : | | size of voxel; default is [1 1 1] |
c : | | globol color or list of colors of same size as VL |
a : | | globol transparency or list of transparency of same size as VL |
Examples
xx=1:1:10; yy=1:1:10; zz=1:1:10;
VL=VLmeshgrid(xx,yy,zz);
SGfigure(-30,30); VLplotvoxel(VL,[1 1 1],'w',0.4);
Copyright 2022-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, VLplotvoxel
, is designed to plot voxels at specified positions. It is part of the SolidGeometry library and was introduced in version 5.2. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- VL: A point or a list of points where the voxels will be plotted.
- vs: The size of the voxel, with a default value of [1 1 1].
- c: The global color or a list of colors for the voxels, matching the size of VL.
- a: The global transparency or a list of transparency values for the voxels, matching the size of VL.
Algorithm Steps
- Retrieve the voxel size
vs
, color c
, and transparency a
from the input parameters or use default values if not provided.
- Determine the number of voxels to plot by calculating the size of
VL
.
- If
a
is a scalar, replicate it to match the number of voxels.
- Normalize the transparency values
a
using the VMcaxis2
function to ensure they are within a valid range.
- Create a base voxel shape using the
SGbar
function with the specified size vs
.
- For each point in
VL
:
- Transform the base voxel shape to the current point using
SGtransP
.
- Define the faces of the voxel using the
FL
matrix.
- Create a patch object with the specified faces, vertices, color, and transparency.
Example Usage
The function can be used as follows:
xx = 1:1:10;
yy = 1:1:10;
zz = 1:1:10;
VL = VLmeshgrid(xx, yy, zz);
SGfigure(-30, 30);
VLplotvoxel(VL, [1 1 1], 'w', 0.4);
This example creates a grid of voxels with a size of [1 1 1], white color, and 0.4 transparency.
Algorithm explaination created using ChatGPT on 2025-08-19 07: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