AlgART Home
net.algart.math.geom

## Class IntegerCirclePointsGenerator

• java.lang.Object
• net.algart.math.geom.IntegerCirclePointsGenerator

• ```public class IntegerCirclePointsGenerator
extends java.lang.Object```

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).

AlgART Laboratory 2007–2014

Since:
JDK 1.0
Version:
1.0
Author:
Daniel Alievsky
• ### Method Summary

Methods
Modifier and Type Method and Description
`void` `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 of `getCirclePoints(int)` method, but returned points are shifted by delta pixels from (0,0).
`static IntegerCirclePointsGenerator` `getInstance()`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

• #### getInstance

`public static IntegerCirclePointsGenerator 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 of `getCirclePoints(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.