Class Interpolationd
- java.lang.Object
-
- org.joml.Interpolationd
-
public class Interpolationd extends java.lang.Object
Contains various interpolation functions.- Author:
- Kai Burjack
-
-
Constructor Summary
Constructors Constructor Description Interpolationd()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Vector2d
dFdxLinear(double v0X, double v0Y, double f0X, double f0Y, double v1X, double v1Y, double f1X, double f1Y, double v2X, double v2Y, double f2X, double f2Y, Vector2d dest)
Compute the first-order derivative of a linear two-dimensional function f with respect to X and store the result indest
.static Vector2d
dFdyLinear(double v0X, double v0Y, double f0X, double f0Y, double v1X, double v1Y, double f1X, double f1Y, double v2X, double v2Y, double f2X, double f2Y, Vector2d dest)
Compute the first-order derivative of a linear two-dimensional function f with respect to Y and store the result indest
.static double
interpolateTriangle(double v0X, double v0Y, double f0, double v1X, double v1Y, double f1, double v2X, double v2Y, double f2, double x, double y)
Bilinearly interpolate the single scalar value f over the given triangle.static Vector3d
interpolateTriangle(double v0X, double v0Y, double f0X, double f0Y, double f0Z, double v1X, double v1Y, double f1X, double f1Y, double f1Z, double v2X, double v2Y, double f2X, double f2Y, double f2Z, double x, double y, Vector3d dest)
Bilinearly interpolate the three-dimensional vector f over the given triangle and store the result indest
.static Vector2d
interpolateTriangle(double v0X, double v0Y, double f0X, double f0Y, double v1X, double v1Y, double f1X, double f1Y, double v2X, double v2Y, double f2X, double f2Y, double x, double y, Vector2d dest)
Bilinearly interpolate the two-dimensional vector f over the given triangle and store the result indest
.static Vector3d
interpolationFactorsTriangle(double v0X, double v0Y, double v1X, double v1Y, double v2X, double v2Y, double x, double y, Vector3d dest)
Compute the interpolation factors(t0, t1, t2)
in order to interpolate an arbitrary value over a given triangle at the given point(x, y)
.
-
-
-
Method Detail
-
interpolateTriangle
public static double interpolateTriangle(double v0X, double v0Y, double f0, double v1X, double v1Y, double f1, double v2X, double v2Y, double f2, double x, double y)
Bilinearly interpolate the single scalar value f over the given triangle.Reference: https://en.wikipedia.org/
- Parameters:
v0X
- the x coordinate of the first triangle vertexv0Y
- the y coordinate of the first triangle vertexf0
- the value of f at the first vertexv1X
- the x coordinate of the second triangle vertexv1Y
- the y coordinate of the second triangle vertexf1
- the value of f at the second vertexv2X
- the x coordinate of the third triangle vertexv2Y
- the y coordinate of the third triangle vertexf2
- the value of f at the third vertexx
- the x coordinate of the point to interpolate f aty
- the y coordinate of the point to interpolate f at- Returns:
- the interpolated value of f
-
interpolateTriangle
public static Vector2d interpolateTriangle(double v0X, double v0Y, double f0X, double f0Y, double v1X, double v1Y, double f1X, double f1Y, double v2X, double v2Y, double f2X, double f2Y, double x, double y, Vector2d dest)
Bilinearly interpolate the two-dimensional vector f over the given triangle and store the result indest
.Reference: https://en.wikipedia.org/
- Parameters:
v0X
- the x coordinate of the first triangle vertexv0Y
- the y coordinate of the first triangle vertexf0X
- the x component of the value of f at the first vertexf0Y
- the y component of the value of f at the first vertexv1X
- the x coordinate of the second triangle vertexv1Y
- the y coordinate of the second triangle vertexf1X
- the x component of the value of f at the second vertexf1Y
- the y component of the value of f at the second vertexv2X
- the x coordinate of the third triangle vertexv2Y
- the y coordinate of the third triangle vertexf2X
- the x component of the value of f at the third vertexf2Y
- the y component of the value of f at the third vertexx
- the x coordinate of the point to interpolate f aty
- the y coordinate of the point to interpolate f atdest
- will hold the interpolation result- Returns:
- dest
-
dFdxLinear
public static Vector2d dFdxLinear(double v0X, double v0Y, double f0X, double f0Y, double v1X, double v1Y, double f1X, double f1Y, double v2X, double v2Y, double f2X, double f2Y, Vector2d dest)
Compute the first-order derivative of a linear two-dimensional function f with respect to X and store the result indest
.This method computes the constant rate of change for f given the three values of f at the specified three inputs
(v0X, v0Y)
,(v1X, v1Y)
and(v2X, v2Y)
.- Parameters:
v0X
- the x coordinate of the first triangle vertexv0Y
- the y coordinate of the first triangle vertexf0X
- the x component of the value of f at the first vertexf0Y
- the y component of the value of f at the first vertexv1X
- the x coordinate of the second triangle vertexv1Y
- the y coordinate of the second triangle vertexf1X
- the x component of the value of f at the second vertexf1Y
- the y component of the value of f at the second vertexv2X
- the x coordinate of the third triangle vertexv2Y
- the y coordinate of the third triangle vertexf2X
- the x component of the value of f at the third vertexf2Y
- the y component of the value of f at the third vertexdest
- will hold the result- Returns:
- dest
-
dFdyLinear
public static Vector2d dFdyLinear(double v0X, double v0Y, double f0X, double f0Y, double v1X, double v1Y, double f1X, double f1Y, double v2X, double v2Y, double f2X, double f2Y, Vector2d dest)
Compute the first-order derivative of a linear two-dimensional function f with respect to Y and store the result indest
.This method computes the constant rate of change for f given the three values of f at the specified three inputs
(v0X, v0Y)
,(v1X, v1Y)
and(v2X, v2Y)
.- Parameters:
v0X
- the x coordinate of the first triangle vertexv0Y
- the y coordinate of the first triangle vertexf0X
- the x component of the value of f at the first vertexf0Y
- the y component of the value of f at the first vertexv1X
- the x coordinate of the second triangle vertexv1Y
- the y coordinate of the second triangle vertexf1X
- the x component of the value of f at the second vertexf1Y
- the y component of the value of f at the second vertexv2X
- the x coordinate of the third triangle vertexv2Y
- the y coordinate of the third triangle vertexf2X
- the x component of the value of f at the third vertexf2Y
- the y component of the value of f at the third vertexdest
- will hold the result- Returns:
- dest
-
interpolateTriangle
public static Vector3d interpolateTriangle(double v0X, double v0Y, double f0X, double f0Y, double f0Z, double v1X, double v1Y, double f1X, double f1Y, double f1Z, double v2X, double v2Y, double f2X, double f2Y, double f2Z, double x, double y, Vector3d dest)
Bilinearly interpolate the three-dimensional vector f over the given triangle and store the result indest
.Reference: https://en.wikipedia.org/
- Parameters:
v0X
- the x coordinate of the first triangle vertexv0Y
- the y coordinate of the first triangle vertexf0X
- the x component of the value of f at the first vertexf0Y
- the y component of the value of f at the first vertexf0Z
- the z component of the value of f at the first vertexv1X
- the x coordinate of the second triangle vertexv1Y
- the y coordinate of the second triangle vertexf1X
- the x component of the value of f at the second vertexf1Y
- the y component of the value of f at the second vertexf1Z
- the z component of the value of f at the second vertexv2X
- the x coordinate of the third triangle vertexv2Y
- the y coordinate of the third triangle vertexf2X
- the x component of the value of f at the third vertexf2Y
- the y component of the value of f at the third vertexf2Z
- the z component of the value of f at the third vertexx
- the x coordinate of the point to interpolate f aty
- the y coordinate of the point to interpolate f atdest
- will hold the interpolation result- Returns:
- dest
-
interpolationFactorsTriangle
public static Vector3d interpolationFactorsTriangle(double v0X, double v0Y, double v1X, double v1Y, double v2X, double v2Y, double x, double y, Vector3d dest)
Compute the interpolation factors(t0, t1, t2)
in order to interpolate an arbitrary value over a given triangle at the given point(x, y)
.This method takes in the 2D vertex positions of the three vertices of a triangle and stores in
dest
the factors(t0, t1, t2)
in the equationv' = v0 * t0 + v1 * t1 + v2 * t2
where(v0, v1, v2)
are arbitrary (scalar or vector) values associated with the respective vertices of the triangle. The computed valuev'
is the interpolated value at the given position(x, y)
.- Parameters:
v0X
- the x coordinate of the first triangle vertexv0Y
- the y coordinate of the first triangle vertexv1X
- the x coordinate of the second triangle vertexv1Y
- the y coordinate of the second triangle vertexv2X
- the x coordinate of the third triangle vertexv2Y
- the y coordinate of the third triangle vertexx
- the x coordinate of the point to interpolate aty
- the y coordinate of the point to interpolate atdest
- will hold the interpolation factors(t0, t1, t2)
- Returns:
- dest
-
-