How to plot a point, if it lies within a cube?
Show older comments
Hello MATLAB Community,
Say I have a point 'A' whose coordinates are [116, 6.63, 22].
Now I want create a boundary cube whose center of origin is (0,0,0) and the cube must be from -150 to +150 in X,Y,Z direction.
I would only like to plot the point A, if it is within the boundary condition (-150 to +150).
My question is how do you create a boundary cube and tell matlab to plot the point, only if its within the boundary limit?
I was not able to create a boundary for this problem.
Can anyone please help me with any suggestions.
Thank you in advance!!
I really appreciate your help.
Kind regards,
Shiv
Accepted Answer
More Answers (1)
Fangjun Jiang
on 3 Feb 2022
0 votes
For boundary, use plot3() to plot the lines between the 8 tip points of the cube.
To check if a point is within the boundary, you just need to check if all the coordinates (x,y,z) are within the range of [-150, 150]
1 Comment
Shiv Karpoor
on 3 Feb 2022
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!