(Optimization) How to quickly get coordinates (coordinates are integer) of all possible points inside a specific cylinder?
Show older comments
Let's say I know coordinates of the center points of bottom surface and top surface; radius (R) and height (H) of cylinder. I need to write down all points which are inside the cylinder and also have integer coordinates.
The calculation speed could not be too slow since I have lots of calculation to run and need my simulation work down in rational time!
_____________________________________________________________________________
Roger Stafford has given a right method. Is any one can optimize the method for improving calculation speed? Since I need to do lots of that calculation. _____________________________________________________________________________
Accepted Answer
More Answers (1)
Image Analyst
on 4 Oct 2014
0 votes
Why are the (x,y) coordinates at some z level any different than those at the end caps? Why can't you just use repmat() to copy them?
5 Comments
Image Analyst
on 4 Oct 2014
For corresponding points on the upper cap and lower cap, you can simply use the point slope formula of a line to get points at any location along a line connecting them.
Yi
on 5 Oct 2014
Image Analyst
on 5 Oct 2014
Possibly the easiest way is to just rotate the cap so that it is parallel to the x-y plane (it's all in 1 z level), then use repmat(). Then rotate back.
Yi
on 5 Oct 2014
Categories
Find more on Systems Of Linear Equations 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!