How to plot a 3D bounding box (with specific size) around a 3D point?

26 visualizaciones (últimos 30 días)
How can I plot a specific size 3D bounding box (cube) around a 3D point? For example, the coordinate of the point is (10,5,10) and I need to draw a 3D bounding box size 20 (20x20x20) around the point such that the point is in the center (inside) of the 3D box.

Respuesta aceptada

KSSV
KSSV el 26 de Mayo de 2016
P = [10,5,10] ; % you center point
L = [20,20,20] ; % your cube dimensions
O = P-L/2 ; % Get the origin of cube so that P is at center
plotcube(L,O,.8,[1 0 0]); % use function plotcube
hold on
plot3(P(1),P(2),P(3),'*k')
  2 comentarios
Sunita Saha
Sunita Saha el 14 de Feb. de 2018
After plotting the cube how to store the coordinates of the 8 vertices of the cube generated?
Reana Taylor
Reana Taylor el 7 de Jul. de 2021
Hi, did you get the answer to this?

Iniciar sesión para comentar.

Más respuestas (2)

KSSV
KSSV el 26 de Mayo de 2016
You can make use of the following function: http://in.mathworks.com/matlabcentral/fileexchange/15161-plotcube
  4 comentarios
ML
ML el 26 de Mayo de 2016
Editada: ML el 26 de Mayo de 2016
the function plots cube but not around a center point. how should I plot a cube around a point of interest? In 2D, it's like a square areound a point which is the center of it.
changcheng qiu
changcheng qiu el 17 de Oct. de 2018
I also want to know? Can you solve it?

Iniciar sesión para comentar.


haris shakeel
haris shakeel el 28 de Abr. de 2018
how can i get four coordinates pixels values of box through matlab

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by