public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static float[] |
copyDoubleArrayToFloat(double[] array)
Return a copy of the double array where every value has been casted to float
|
static void |
getXYCircleBounds(int radius,
int[] lineBounds)
Midpoint circle algorithm: store the bounds of a circle in the given array.
|
static void |
getXYEllipseBounds(int a,
int b,
int[] lineBounds)
Store the half-widths of a X line to scan to fill an ellipse of given axis lengths.
|
public static final void getXYEllipseBounds(int a, int b, int[] lineBounds)
a
is the axis half-length in the X direction, and b
is the axis half-length in the Y direction.
The half-widhts will be stored in the array lineBounds
, which must be of size equal
to at least b+1
.
This is an implementation of the McIlroy's algorithm, adapted freely from
http://enchantia.com/software/graphapp/doc/tech/ellipses.html
.
a
- half-length of the ellipse in the X directionb
- half-length of the ellipse in the Y directionlineBounds
- will store the half-length of the ellipse lines in the X directionpublic static final void getXYCircleBounds(int radius, int[] lineBounds)
http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
radius
- the radius of the circlelineBounds
- the array to store bounds inpublic static float[] copyDoubleArrayToFloat(double[] array)
Copyright © 2015–2021 Fiji. All rights reserved.