public final class MathUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static double |
TWO_PI |
| Modifier and Type | Method and Description |
|---|---|
static double |
clamp(double min,
double value,
double max) |
static float |
clamp(float min,
float value,
float max) |
static int |
clamp(int min,
int value,
int max) |
static long |
clamp(long min,
long value,
long max) |
static double |
distanceToLineSegment(int px,
int py,
int vx,
int vy,
int wx,
int wy)
Calculates the shortest distance of a point to a line segment.
|
static double |
getDistance(double dx,
double dy,
double dz)
Calculates the distance between two points in 3D space.
|
static float |
getDistance(float dx,
float dy)
Calculates the distance between two points in 2D space.
|
static float |
getDistance(float dx,
float dy,
float dz)
Calculates the distance between two points in 3D space.
|
static float |
getDistance(int dx,
int dy)
Calculates the distance between two points.
|
static float |
getDistance(int dx,
int dy,
int dz) |
static float |
getDistance(int x1,
int y1,
int x2,
int y2)
Calculates the distance between two points in two dimensional space.
|
static float |
getDistance(int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
Calculates the distance between two points in three dimensional space.
|
static double |
mod(double a,
double b)
Calculates x modulo y.
|
static float |
mod(float a,
float b)
Calculates x modulo y.
|
static int |
mod(int a,
int b)
Calculates x modulo y.
|
static int |
pow(int x,
int y)
Positive integer powers.
|
static javax.vecmath.Vector3d |
rotateVectorCC(javax.vecmath.Vector3d vector,
javax.vecmath.Vector3d axis,
double angle)
Rotate a vector counterclockwise around an axis.
|
public static final double TWO_PI
public static int pow(int x,
int y)
public static float mod(float a,
float b)
a - The operand.b - The modulus.public static double mod(double a,
double b)
a - The operand.b - The modulus.public static int mod(int a,
int b)
a - The operand.b - The modulus.public static float getDistance(int x1,
int y1,
int x2,
int y2)
x1 - The X coordinate of the first point.y1 - The Y coordinate of the first point.x2 - The X coordinate of the second point.y2 - The Y coordinate of the second point.public static float getDistance(int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
x1 - The X coordinate of the first point.y1 - The Y coordinate of the first point.z1 - The Z coordinate of the first point.x2 - The X coordinate of the second point.y2 - The Y coordinate of the second point.z2 - The Z coordinate of the second point.public static float getDistance(int dx,
int dy)
dx - The difference along the x axis between the two points.dy - The difference along the y axis between the two points.public static float getDistance(float dx,
float dy)
dx - The difference along the x axis between the two points.dy - The difference along the y axis between the two points.public static float getDistance(float dx,
float dy,
float dz)
dx - The difference along the x axis between the two points.dy - The difference along the y axis between the two points.dz - The difference along the z axis between the two points.public static double getDistance(double dx,
double dy,
double dz)
dx - The difference along the x axis between the two points.dy - The difference along the y axis between the two points.dz - The difference along the z axis between the two points.public static float getDistance(int dx,
int dy,
int dz)
public static int clamp(int min,
int value,
int max)
public static long clamp(long min,
long value,
long max)
public static float clamp(float min,
float value,
float max)
public static double clamp(double min,
double value,
double max)
public static javax.vecmath.Vector3d rotateVectorCC(javax.vecmath.Vector3d vector,
javax.vecmath.Vector3d axis,
double angle)
vector - The vector to rotate.axis - The axis around which to rotate it.angle - How many radians to rotate it counterclockwise.public static double distanceToLineSegment(int px,
int py,
int vx,
int vy,
int wx,
int wy)
px - The X coordinate of the point.py - The Y coordinate of the point.vx - The X coordinate of the start of the line segment.vy - The Y coordinate of the start of the line segment.wx - The X coordinate of the end of the line segment.wy - The Y coordinate of the end of the line segment.Copyright © 2011–2025 pepsoft.org. All rights reserved.