Package net.algart.math.geometry
Class IntegerCirclePointsGenerator
java.lang.Object
net.algart.math.geometry.IntegerCirclePointsGenerator
Service class that quickly returns all integer points of Bresenham circles with integer radii. Uses cache for optimization (don't calculate points of not too large circles twice).
- Author:
- Daniel Alievsky
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Frees all cache memory.int[]
getCirclePoints
(int r) Returns all integer points of the circle with given radius r and center at (0,0).int[]
getExternalCirclePoints
(int r, int delta) Analog ofgetCirclePoints(int)
method, but returned points are shifted by delta pixels from (0,0).static IntegerCirclePointsGenerator
-
Method Details
-
getInstance
-
getCirclePoints
public int[] getCirclePoints(int r) Returns all integer points of the circle with given radius r and center at (0,0). Points are calculated by Bresenham algorithm. Result array consists of (x,y) pairs: [0] element is x0, [1] element is y0, [2] element is x1, [3] element is y1, ... The number of returned points if (result_array).length/2. In a special case r==0, returns {0,0}.Warning: the result array must not be modified!
-
getExternalCirclePoints
public int[] getExternalCirclePoints(int r, int delta) Analog ofgetCirclePoints(int)
method, but returned points are shifted by delta pixels from (0,0). The number of returned points is the same as in getCirclePoints method with the same r. In a special case r==0, returns {0,0}.Warning: the result array must not be modified!
-
dispose
public void dispose()Frees all cache memory. Recommended when ceasing using this class for a long time. System.gc() may be called after this to real freeing memory.
-