How can I generate coloured voxels in 3D space ?

8 views (last 30 days)
Ankur Deka
Ankur Deka on 17 Mar 2023
Answered: Naren on 29 Mar 2023
Hi...I need to discritize a robot's workspace in octants. Then I have to represent the manipulability values in colour coded voxels in the 3D workspace. Kindly help me how to generate colored voxels in 3D. Thanks in advance !

Answers (1)

Naren
Naren on 29 Mar 2023
Hello Ankur,
I Understand you are trying to generate a colored vowels in 3D space. Refer the steps below.
  1. Define the dimensions of workspace and shape of it using functions like drawcuboid and you can use the robot's base position and orientation to determine which octant a particular voxel belongs to, which will divide the workspace in octants.
  2. Construct a 3D data structure or array to depict the workspace. Create a 3D array of zeros using the "zeros" function, where each member represents a voxel in the workspace.
  3. Use an inverse kinematics solver or other methods to determine the manipulability value for each voxel in the workspace. In the 3D array made in step 3, the manipulability numbers can be kept.
  4. Based on each voxel's manipulability rating, choose a color for it. A colormap that converts the manipulability numbers to colors can be made using MATLAB's "colormap" function. The manipulability values can then be converted to colormap indices using the "interp1" function, and the voxels can then be given the appropriate colors.
  5. Utilize MATLAB's "slice" tool to render the colored voxels in the 3D workspace. Slice the 3D array in the x, y, or z dimensions using the "slice" function, and then use the "surf" function to render the slices as colored voxels.
Here are some documentation to help you through the steps.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!