Package gov.nih.mipav.util
Class CircleUtil
- java.lang.Object
-
- gov.nih.mipav.util.CircleUtil
-
public class CircleUtil extends java.lang.Object
Public utility class for generating approximations to circles and spheres.- Author:
- senseneyj
-
-
Constructor Summary
Constructors Constructor Description CircleUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
computeEpsilon(int x, int y, int r)
private static int
computeEpsilonX(int epsilon, int x, int dx)
private static int
computeEpsilonXY(int epsilon, int x, int dx, int y, int dy)
private static int
computeEpsilonY(int epsilon, int y, int dy)
static int[]
get1DPointsInCircle(int xCenter, int yCenter, int zCenter, int radius, int dimX, int dimY)
Calculates the points of an approximate sphere whose center is at(xCenter, yCenter)
with a given radius.static int[]
get1DPointsInSphere(int value, int radius, int xDim, int yDim)
Calculates the points of an approximate sphere whose center is atvalue
with a given radius.static int[]
get1DPointsInSphere(int xCenter, int yCenter, int zCenter, int radius, int xDim, int yDim)
Calculates the points of an approximate sphere whose center is at(xCenter, yCenter, zCenter)
with a given radius.static int[][]
get2DPointsInCircle(int xCenter, int yCenter, int r)
Calculates the points of an approximate circle whose center is at(xCenter, yCenter)
with a given radius.static int[][]
get3DPointsInSphere(int xCenter, int yCenter, int zCenter, double xRes, double yRes, double zRes, double radius)
static int[][]
get3DPointsInSphere(int xCenter, int yCenter, int zCenter, int radius)
Calculates the points of an approximate sphere whose center is at(xCenter, yCenter, zCenter)
witha given radius.static int[][]
getQuadrantBoundaryPoints(int radius, int quadrant)
Generates 2D data points in a given quadrant for a specifiedradius
-
-
-
Method Detail
-
get3DPointsInSphere
public static int[][] get3DPointsInSphere(int xCenter, int yCenter, int zCenter, double xRes, double yRes, double zRes, double radius)
-
get3DPointsInSphere
public static int[][] get3DPointsInSphere(int xCenter, int yCenter, int zCenter, int radius)
Calculates the points of an approximate sphere whose center is at(xCenter, yCenter, zCenter)
witha given radius.- Returns:
- Array of (x,y,z) coordinates of an approximate sphere.
-
get2DPointsInCircle
public static int[][] get2DPointsInCircle(int xCenter, int yCenter, int r)
Calculates the points of an approximate circle whose center is at(xCenter, yCenter)
with a given radius.- Returns:
- Array of (x,y) coordinates of an approximate circle.
-
get1DPointsInSphere
public static int[] get1DPointsInSphere(int xCenter, int yCenter, int zCenter, int radius, int xDim, int yDim)
Calculates the points of an approximate sphere whose center is at(xCenter, yCenter, zCenter)
with a given radius.- Returns:
- Array of points of an approximate sphere.
-
get1DPointsInSphere
public static int[] get1DPointsInSphere(int value, int radius, int xDim, int yDim)
Calculates the points of an approximate sphere whose center is atvalue
with a given radius.- Returns:
- Array of points of an approximate sphere.
-
get1DPointsInCircle
public static int[] get1DPointsInCircle(int xCenter, int yCenter, int zCenter, int radius, int dimX, int dimY)
Calculates the points of an approximate sphere whose center is at(xCenter, yCenter)
with a given radius.- Returns:
- Array of points of an approximate sphere.
-
getQuadrantBoundaryPoints
public static int[][] getQuadrantBoundaryPoints(int radius, int quadrant)
Generates 2D data points in a given quadrant for a specifiedradius
- Parameters:
radius
- Radius from origin for circle.quadrant
- Allow 1 - 4 where 1: x>=0, y>0 2: x<0, y>=0 3: x<=0, y<0 4: x>0, y<=0
-
computeEpsilon
private static int computeEpsilon(int x, int y, int r)
-
computeEpsilonX
private static int computeEpsilonX(int epsilon, int x, int dx)
-
computeEpsilonY
private static int computeEpsilonY(int epsilon, int y, int dy)
-
computeEpsilonXY
private static int computeEpsilonXY(int epsilon, int x, int dx, int y, int dy)
-
-