(Optimization) How to quickly get coordinates (coordinates are integer) of all possible points inside a specific cylinder?
Mostra commenti meno recenti
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. _____________________________________________________________________________
Risposta accettata
Più risposte (1)
Image Analyst
il 4 Ott 2014
0 voti
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 Commenti
Image Analyst
il 4 Ott 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
il 5 Ott 2014
Image Analyst
il 5 Ott 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
il 5 Ott 2014
Categorie
Scopri di più su Systems Of Linear Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!